After connection application creates PubSub nodes for every device or sensor connected to RPi and registered in application.
Node name is always generated in following form:
devices/iot-device-id
, where iot-device-id
is ID of a IoT device connected to RPi. This node is created with type collection
.
This newly created node is always a subnode of root PubSub node used by IoT devices named devices
.
As a result for devices with id’s iot-1
, iot-2
and iot-3
at this point we have following nodes created:
- devices
- Root node (collection)
- devices/iot-1
- Contains data related to iot-1 device (collection)
- devices/iot-2
- Contains data related to iot-2 device (collection)
- devices/iot-3
- Contains data related to iot-3 device (collection)
After this is completed then for every device framework creates 2 leaf subnodes for every device:
- config
- Contains configuration of a device (including information about device type, options, etc.)
- state
- Contains current state of a device (and previous states depending on configuration)
So for a device listed about we will get following nodes:
- devices
-
Root node (collection)
- devices/iot-1
-
Contains data related to iot-1 device (collection)
- devices/iot-1/state
- Current state of iot-1 device
- devices/iot-1/config
- Configuration of iot-1 device
- devices/iot-2
-
Contains data related to iot-2 device (collection)
- devices/iot-2/state
- Current state of iot-2 device
- devices/iot-2/config
- Configuration of iot-2 device
- devices/iot-3
-
Contains data related to iot-3 device (collection)
- devices/iot-3/state
- Current state of iot-3 device
- devices/iot-3/config
- Configuration of iot-3 device
At this point application is ready for work.