Three Events - demo of multiple event programming

In this posting I have explored event programming with three interrupts. I have used three Digital inputs: 0) IR interrupter 1) PIR motion detector & 2) Tilt sensor. There is also an analog input: Air Quality. All three events are processed by the same input websocket node. The top output websocket on the flow initialises the connection with iot.seeedo.cc with the access token. The results from seeedo return payloads for the three digital events: 0) “msg.payload.msg.ir_approached” (IR interrupter) 1) “msg.payload.msg.input_changed” (PIR Motion Detector) & 2) “msg.payload.msg.input_changed” (tilt sensor). Unique names have been assigned by seeedo for 0) & 1) but 2) has a generic name “input_changed”.

My three functions could be combined into one and there global state variables and separate payloads are set up for the events. Nothing is lost and events also have unique numeric codes e.g. PIR Motion Detector is assigned 12, tilt sensor 13 and IR interrupter is 14. These can easily be further processed and cleared. I have used delay triggers on such event so that only one interrupt is captured in any 1 second. The flow also shows a GET request for Air Quality and this is polled every 5 mins with the result displayed on both a gauge and chart on a chrome browser.
DSC_0547.JPG
Flow_Wio02Config5.jpg
Javascript Function.jpeg
Graphs.JPG

What a smart use of node-red, Cool!!!