This library includes two nodes. One of them is IoT Scope, and the other one is IoT SQL. They both uses MQTT protocol to send data to the cloud.
- IoT Scope
Data sent by this node can be monitored at IoT Scope's web page with the given IoT ID. The sampling rate is 1 second, and the chart starts the drawing when the browser is opened. It shows last 1 hour data as it gathers data from the node.
- IoT SQL
Same concept applies here, but the main difference is that data sent by this node is stored in database, so history of the data can be tracked. The sampling rate is 1 minute.
cd ~/.node-red
npm install node-red-contrib-cbus
As a first step, an IoT ID should be requested. To do that, the following site can be used.
IoT Scope or IoT SQL ID Request Website
Just enter valid e-mail adress and hit enter.
After installing node package, enter the IoT ID in node properties.
After preparing node-red project, you can use the following link to observe IoT Scope value.
https://iot.cbus.io/iotscope?ID=0123456789012345
Basically, replace 0123456789012345 with your IoT ID.
Node-red flow :
You can import this example as follows.
[{"id":"934df569c8ec9982","type":"iot-scope-in","z":"be8de71f8b865057","name":"IoT Scope","broker":"nr.cbus.io","brokerport":"1883","iot":"","projectname":"Trial Project","valuename":"Counter","unit":"Tick","x":830,"y":140,"wires":[]},{"id":"456f3ed31ecd2cf2","type":"inject","z":"be8de71f8b865057","name":"","props":[{"p":"payload"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Trigger","payloadType":"str","x":380,"y":140,"wires":[["86cde155107cf0e6"]]},{"id":"86cde155107cf0e6","type":"function","z":"be8de71f8b865057","name":"Counter","func":"var counter = context.get('counter') || 0;\ncounter += 1;\nif(counter > 60)\n counter = 0;\nmsg.payload = counter;\ncontext.set('counter', counter);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":140,"wires":[["934df569c8ec9982"]]}]
IoT Scope :
Same concept in IoT Scope node applies here. After preparing node-red project, you can use the following link to observe IoT SQL value.
https://iot.cbus.io/sql?ID=0123456789012345
Basically, replace 0123456789012345 with your IoT ID.
IoT SQL :
Node-red flow :
You can import this example as follows.
[{"id":"51b26449adc16038","type":"iot-sql","z":"be8de71f8b865057","name":"IoT Sql","broker":"nr.cbus.io","brokerport":"1883","iot":"","valuename":"Node-Red Counter","x":840,"y":180,"wires":[]},{"id":"8ffa8a36f4ffd078","type":"inject","z":"be8de71f8b865057","name":"","props":[{"p":"payload"}],"repeat":"60","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Trigger","payloadType":"str","x":400,"y":180,"wires":[["7f7c01660e5cd7c4"]]},{"id":"7f7c01660e5cd7c4","type":"function","z":"be8de71f8b865057","name":"Counter","func":"var counter = context.get('counter') || 0;\ncounter += 1;\nif(counter > 60)\n counter = 0;\nmsg.payload = counter;\ncontext.set('counter', counter);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":600,"y":180,"wires":[["51b26449adc16038"]]}]
For any question -> info@cbus.io