Listen to Device Online Offline Event
Device Online Event
Right-Click anywhere on canvas, select Event/Device Online
Expand left panel by clicking on tool bar button, select IoT
tab on the side bar, then click on the product which your device is belong:
After clicking on the product, the device list will be shown. Select the device whose Online Event
you want to listen to:
Connect the top right handle of the Device
node to the Device Online
node. Then let's add a Print
node to print some text when device is online. Click Run
on the tool bar (you can skip this step if you are in auto run mode which is the default mode). Now, when your device becomes online, you will see the text printed on the screen.
TIP
Notice that after device is online, the visualization of the device node will change slightly to reflect whether the device is online or offline.
Note that there is an arrow at the bottom of the Device
node, when clicked, the properties of the device will be shown.
You can access device's infomation directly by connecting the handles on the Device
node to the print node, for example:
TIP
The handle's color is based on the data type of the corresponding property.
Listen to device offline event
Similar to the device online event, we can also listen to the device offline event by adding a Device Offline
node and connecting it to the Device
node.
We can also combine the two like the following: