Monitor using the dashboard node

Hello everyone!

I am trying to make an "IamAlive" monitor in which my arduino device publishes an "OK" message every 30 seconds in a mqtt topic and every time it is published, the day and time is indicated in a graph on the Dashboard node. I would also like to make a led for when I no longer send the message to the topic, the led would turn red, but I'm not able to do it, I thought of some ways but it doesn't work.

Would anyone have an idea how I could do this?

The flow

[{"id":"24c867d.13a0c98","type":"tab","label":"Flow 5","disabled":false,"info":""},{"id":"a288d7e8.92c538","type":"mqtt in","z":"24c867d.13a0c98","name":"","topic":"esp32/test/alive","qos":"2","datatype":"auto","broker":"4c966331.a132ec","x":100,"y":180,"wires":[["6a4b2e5.f0a0ed"]]},{"id":"6a4b2e5.f0a0ed","type":"function","z":"24c867d.13a0c98","name":"","func":"if(msg.payload == \"OK\")\n{\n    msg.payload = 1;\n}\nelse\n{\n    msg.payload = 0;\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":300,"y":180,"wires":[["e88ab21d.7c41a","74fba7b6.e0ff48"]]},{"id":"e88ab21d.7c41a","type":"ui_chart","z":"24c867d.13a0c98","name":"","group":"81478044.b9caf","order":3,"width":"6","height":"6","label":"Test","chartType":"line","legend":"false","xformat":"D/M/Y - HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"1","removeOlder":"1","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#e16e09","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"x":490,"y":120,"wires":[[]]},{"id":"74fba7b6.e0ff48","type":"ui_led","z":"24c867d.13a0c98","order":3,"group":"81478044.b9caf","width":0,"height":0,"label":"Status: ","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"#ff0000","value":"0","valueType":"num"},{"color":"#008000","value":"1","valueType":"num"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":true,"name":"","x":490,"y":220,"wires":[]},{"id":"4c966331.a132ec","type":"mqtt-broker","name":"","broker":"test.mosquitto.org","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"81478044.b9caf","type":"ui_group","name":"PlaceTest","tab":"8e0a919b.4d71f","order":1,"disp":true,"width":"6","collapse":false},{"id":"8e0a919b.4d71f","type":"ui_tab","name":"Test","icon":"dashboard","disabled":false,"hidden":false}]

image

image

Use a trigger node and a change node. e.g.

[{"id":"a288d7e8.92c538","type":"mqtt in","z":"24c867d.13a0c98","name":"","topic":"esp32/test/alive","qos":"2","datatype":"auto","broker":"4c966331.a132ec","x":160,"y":140,"wires":[["8d37b44a.418378","e4b45a98.beaa18"]]},{"id":"8d37b44a.418378","type":"trigger","z":"24c867d.13a0c98","name":"","op1":"","op2":"0","op1type":"nul","op2type":"num","duration":"35","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":400,"y":200,"wires":[["e88ab21d.7c41a","1b999449.10732c"]]},{"id":"e4b45a98.beaa18","type":"change","z":"24c867d.13a0c98","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":140,"wires":[["e88ab21d.7c41a","1b999449.10732c"]]},{"id":"e88ab21d.7c41a","type":"ui_chart","z":"24c867d.13a0c98","name":"","group":"81478044.b9caf","order":3,"width":"6","height":"6","label":"Test","chartType":"line","legend":"false","xformat":"D/M/Y - HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"1","removeOlder":"1","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#e16e09","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"x":650,"y":120,"wires":[[]]},{"id":"1b999449.10732c","type":"debug","z":"24c867d.13a0c98","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":670,"y":200,"wires":[]},{"id":"4c966331.a132ec","type":"mqtt-broker","name":"","broker":"test.mosquitto.org","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"81478044.b9caf","type":"ui_group","name":"PlaceTest","tab":"8e0a919b.4d71f","order":1,"disp":true,"width":"6","collapse":false},{"id":"8e0a919b.4d71f","type":"ui_tab","name":"Test","icon":"dashboard","disabled":false,"hidden":false}]
1 Like

If you have the arduino set with a LWT, you could monitor that topic in a flow to control the led.

Thank you for every answer! :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.