Library

User

class rmaker_lib.user.User(username)

User class used to instantiate instances of user to perform various user signup/login operations.

Parameters

username (str) – Name of User

forgot_password(password=None, verification_code=None)

Forgot password request to reset the password.

Parameters
  • password (str) – Password of user, defaults to None

  • verification_code (int) – Verification code received during forgot password request, defaults to None

Raises
  • NetworkError – If there is a network connection issue during password reset

  • Exception – If there is an HTTP issue during forgot password

Returns

True on Success

Return type

bool

login(password=None)

User login to the ESP Rainmaker.

Parameters

password (str) – Password of user, defaults to None

Raises
  • NetworkError – If there is a network connection issue during login

  • Exception – If there is an HTTP issue during login or JSON format issue in HTTP response

  • AuthenticationError – If login failed with the given parameters

Returns

rmaker_lib.session.Session on Success

Return type

object

signup(code)

Sign up of new User for ESP Rainmaker.

Parameters

code (int) – Verification code received in signup request for user

Raises
  • NetworkError – If there is a network connection issue during signup

  • Exception – If there is an HTTP issue during signup

Returns

True on Success

Return type

bool

signup_request(password)

Sign up request of new User for ESP Rainmaker.

Parameters

password (str) – Password to set for new user

Raises
  • NetworkError – If there is a network connection issue during signup request

  • Exception – If there is an HTTP issue during signup request

Returns

True on Success

Return type

bool

Session

class rmaker_lib.session.Session

Session class for logged in user.

get_mqtt_host()

Get the MQTT Host endpoint.

Raises
  • NetworkError – If there is a network connection issue while getting MQTT Host endpoint

  • Exception – If there is an HTTP issue while getting MQTT host or JSON format issue in HTTP response

Returns

MQTT Host on Success, None on Failure

Return type

str | None

get_nodes()

Get list of all nodes associated with the user.

Raises
  • NetworkError – If there is a network connection issue while getting nodes associated with user

  • Exception – If there is an HTTP issue while getting nodes

Returns

Nodes associated with user on Success

Return type

dict

Node

class rmaker_lib.node.Node(nodeid, session)

Node class used to instantiate instances of node to perform various node operations.

Parameters
add_user_node_mapping(secret_key)

Add user node mapping.

Parameters

secret_key (str) – The randomly generated secret key that will be used for User-Node mapping

Raises
  • NetworkError – If there is a network connection issue while adding user node mapping

  • Exception – If there is an HTTP issue while adding user node mapping or JSON format issue in HTTP response

Returns

Request Id on Success, None on Failure

Return type

str | None

get_mapping_status(request_id)

Check status of user node mapping request.

Parameters

requestId (str) – Request Id

Raises
  • NetworkError – If there is a network connection issue while getting user node mapping status

  • Exception – If there is an HTTP issue while getting user node mapping status or JSON format issue in HTTP response

Returns

Request Status on Success, None on Failure

Type

str | None

get_node_config()

Get node configuration.

Raises
  • NetworkError – If there is a network connection issue while getting node configuration

  • Exception – If there is an HTTP issue while getting node config

Returns

Configuration of node on Success

Return type

dict

get_node_params()

Get parameters of the node.

Raises
  • NetworkError – If there is a network connection issue while getting node params

  • Exception – If there is an HTTP issue while getting node params or JSON format issue in HTTP response

Returns

Node Parameters on Success, None on Failure

Return type

dict | None

get_node_status()

Get online/offline status of the node.

Raises
  • NetworkError – If there is a network connection issue while getting node status

  • Exception – If there is an HTTP issue while getting node status

Returns

Status of node on Success

Return type

dict

get_nodeid()

Get nodeid of device

Returns

Node Id of node on Success

Return type

str

remove_user_node_mapping()

Remove user node mapping request.

Raises
  • NetworkError – If there is a network connection issue while removing user node mapping

  • Exception – If there is an HTTP issue while removing user node mapping or JSON format issue in HTTP response

Returns

Request Id on Success, None on Failure

Return type

str | None

set_node_params(data)

Set parameters of the node.

Parameters

data (dict) – Parameters to be set for the node

Raises
  • NetworkError – If there is a network connection issue while setting node params

  • Exception – If there is an HTTP issue while setting node params or JSON format issue in HTTP response

Returns

True on Success

Return type

bool