User - Node Mapping
Before the devices under a node can be monitored and controlled remotely, the node should be first mapped to a user so that only that specific user can have permissions to access it. The workflow is driven from a client like the Phone app or RainMaker CLI.
The below sequence diagram will help to understand the steps.
Here are the steps:
During the Wi-Fi provisioning, the client sends the User ID and a randomly generated secret key to ESP32. It gets back the Node ID in return.
The client sends the node ID and a secret key to the RainMaker Cloud over a secure and logged-in session. User ID is not sent as it is extracted by the Cloud from the session information. It gets back a request ID in return.
ESP32 sends the Node ID, User ID, and Secret Key to the RainMaker Cloud over secure MQTT.
Steps 2 and 3 can occur even in a reversed order, without affecting the workflow.
The client keeps checking the status of the request based on the request ID. The possible responses are as follows:
1) Confirmed: If the RainMaker Cloud gets the same information from both the client and the ESP32, the mapping is considered successful. 2) Timed Out: If one minute has passed since the request was made, but no matching information was received from the other end, a time-out is triggered. 3) Requested: Mapping is still in progress. Keep checking.
For details on the node side communication, please refer to the specifications. For details on the client side communication, please refer to the Cloud API documentation.