2023年5月24日 星期三

Node-Red MQTT LED

   Node-Red  MQTT LED 






[{"id":"adde122fafe3af0c","type":"ui_led","z":"a4299ecd46a6a475","order":1,"group":"1153ee5f.3a519a","width":0,"height":0,"label":"","labelPlacement":"right","labelAlignment":"right","colorForValue":[{"color":"#ff0000","value":"false","valueType":"bool"},{"color":"#008000","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":true,"name":"","x":510,"y":220,"wires":[]},{"id":"0978db965548023e","type":"mqtt out","z":"a4299ecd46a6a475","name":"LED Out","topic":"alex9ufo/LED","qos":"1","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"841df58d.ee5e98","x":520,"y":120,"wires":[]},{"id":"72a2bbee24a55b2f","type":"mqtt in","z":"a4299ecd46a6a475","name":"LED In","topic":"alex9ufo/LED","qos":"2","datatype":"auto-detect","broker":"841df58d.ee5e98","nl":false,"rap":true,"rh":0,"inputs":0,"x":150,"y":220,"wires":[["304967eed49d0d6b","d3ee9af84c8567e6"]]},{"id":"1a0dd699aeec2315","type":"debug","z":"a4299ecd46a6a475","name":"debug 62","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":340,"y":60,"wires":[]},{"id":"77528689b656f9cc","type":"function","z":"a4299ecd46a6a475","name":"function ","func":"var a;\na=msg.payload;\nif (a===true)\n    msg.payload=\"Hi\"\nelse\n    msg.payload=\"Lo\"\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":120,"wires":[["0978db965548023e"]]},{"id":"304967eed49d0d6b","type":"debug","z":"a4299ecd46a6a475","name":"debug 63","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":300,"y":180,"wires":[]},{"id":"e4ad84ddbc424369","type":"ui_switch","z":"a4299ecd46a6a475","name":"","label":"switch 開關 ","tooltip":"","group":"1153ee5f.3a519a","order":1,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"className":"","x":190,"y":100,"wires":[["77528689b656f9cc","1a0dd699aeec2315"]]},{"id":"d3ee9af84c8567e6","type":"function","z":"a4299ecd46a6a475","name":"function ","func":"var a;\na=msg.payload;\nif (a==='Hi')\n    msg.payload=true\nelse\n    msg.payload=false\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":220,"wires":[["adde122fafe3af0c"]]},{"id":"1153ee5f.3a519a","type":"ui_group","name":"Start / Stop","tab":"620b23a86a619594","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"841df58d.ee5e98","type":"mqtt-broker","name":"","broker":"broker.mqtt-dashboard.com","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"620b23a86a619594","type":"ui_tab","name":"Home_alex9ufo","icon":"dashboard","disabled":false,"hidden":false}]

2024_09 作業3 以Node-Red 為主

 2024_09 作業3  (以Node-Red 為主  Arduino 可能需要配合修改 ) Arduino 可能需要修改的部分 1)mqtt broker  2) 主題Topic (發行 接收) 3) WIFI ssid , password const char br...