Node-Red & MQTT &Dashboard UI &MQTT Explorer
http://mqtt-explorer.com/
Function 設定
var led=msg.payload;
if (led==='ON'){
msg.payload=true;
}
else
{
msg.payload=false;
}
return msg;
[{"id":"5a45b8da.52b0d8","type":"mqtt in","z":"a14ac84e.f72398","name":"","topic":"alex9ufo/esp32/dht/temperature","qos":"1","datatype":"auto","broker":"e4d9b72d.d14398","x":190,"y":120,"wires":[["3042e15e.80a4ee"]]},{"id":"3042e15e.80a4ee","type":"ui_gauge","z":"a14ac84e.f72398","name":"","group":"ac0f1141.eb50e","order":2,"width":"3","height":"2","gtype":"gage","title":"Temperature","label":"ºC","format":"{{value}}","min":0,"max":"40","colors":["#00b500","#f7df09","#ca3838"],"seg1":"","seg2":"","x":450,"y":120,"wires":[]},{"id":"8ff168f0.0c74a8","type":"mqtt in","z":"a14ac84e.f72398","name":"","topic":"alex9ufo/esp32/dht/humidity","qos":"1","datatype":"auto","broker":"e4d9b72d.d14398","x":180,"y":180,"wires":[["29251f29.6687c"]]},{"id":"29251f29.6687c","type":"ui_gauge","z":"a14ac84e.f72398","name":"","group":"ac0f1141.eb50e","order":2,"width":"3","height":"2","gtype":"gage","title":"Humidity","label":"%","format":"{{value}}","min":"30","max":"100","colors":["#53a4e6","#1d78a9","#4e38c9"],"seg1":"","seg2":"","x":440,"y":180,"wires":[]},{"id":"76ff0708.6cfb98","type":"mqtt out","z":"a14ac84e.f72398","name":"","topic":"alex9ufo/esp32/dht/humidity","qos":"1","retain":"","broker":"e4d9b72d.d14398","x":520,"y":300,"wires":[]},{"id":"5595d22f.f517bc","type":"mqtt out","z":"a14ac84e.f72398","name":"","topic":"alex9ufo/esp32/dht/temperature","qos":"1","retain":"","broker":"e4d9b72d.d14398","x":530,"y":360,"wires":[]},{"id":"c7d10b69.439238","type":"function","z":"a14ac84e.f72398","name":"亂數10-100","func":"var min= 30;\nvar max= 100 ;\n\nmsg.payload = Math.floor(Math.random()*(max-min+1))+min;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":290,"y":300,"wires":[["76ff0708.6cfb98"]]},{"id":"209f02c1.6c6a5e","type":"function","z":"a14ac84e.f72398","name":"10-40亂數","func":"var min= 10;\nvar max= 40 ;\n\nmsg.payload = Math.floor(Math.random()*(max-min+1))+min;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":290,"y":360,"wires":[["5595d22f.f517bc"]]},{"id":"93cb2ee9.76dea","type":"inject","z":"a14ac84e.f72398","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"20","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":121,"y":300,"wires":[["c7d10b69.439238"]]},{"id":"4b88a9f2.6e2ff8","type":"inject","z":"a14ac84e.f72398","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"20","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":360,"wires":[["209f02c1.6c6a5e"]]},{"id":"a49f7111.8ad3b","type":"ui_button","z":"a14ac84e.f72398","name":"","group":"ac0f1141.eb50e","order":0,"width":"2","height":"1","passthru":false,"label":"LED 開","tooltip":"","color":"white","bgcolor":" purple","icon":"fa-circle","payload":"ON","payloadType":"str","topic":"","x":120,"y":420,"wires":[["d225a53d.306a38"]]},{"id":"e83bb5b4.b33b88","type":"ui_button","z":"a14ac84e.f72398","name":"","group":"ac0f1141.eb50e","order":0,"width":"2","height":"1","passthru":false,"label":"LED 關","tooltip":"","color":"black","bgcolor":"","icon":"fa-circle-o","payload":"OFF","payloadType":"str","topic":"","x":120,"y":460,"wires":[["d225a53d.306a38"]]},{"id":"d225a53d.306a38","type":"mqtt out","z":"a14ac84e.f72398","name":"","topic":"alex9ufo/inTopic/led/led_event","qos":"1","retain":"true","broker":"841df58d.ee5e98","x":350,"y":440,"wires":[]},{"id":"1c937d70.b216f3","type":"mqtt in","z":"a14ac84e.f72398","name":"","topic":"alex9ufo/inTopic/led/led_event","qos":"2","datatype":"auto","broker":"e4d9b72d.d14398","x":180,"y":240,"wires":[["1d351370.11523d"]]},{"id":"3870456d.2a0f9a","type":"ui_led","z":"a14ac84e.f72398","group":"ac0f1141.eb50e","order":68,"width":"0","height":"0","label":"LED Status","labelPlacement":"left","labelAlignment":"center","colorForValue":[{"color":"red","value":"false","valueType":"bool"},{"color":"green","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"name":"","x":490,"y":240,"wires":[]},{"id":"1d351370.11523d","type":"function","z":"a14ac84e.f72398","name":"","func":"var led=msg.payload;\nif (led==='ON'){\n msg.payload=true;\n}\nelse\n{\n msg.payload=false;\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":240,"wires":[["3870456d.2a0f9a"]]},{"id":"e4d9b72d.d14398","type":"mqtt-broker","name":"","broker":"broker.mqtt-dashboard.com","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"ac0f1141.eb50e","type":"ui_group","name":"LED","tab":"834e019a.2dfbb","order":1,"disp":true,"width":"8","collapse":true},{"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":"834e019a.2dfbb","type":"ui_tab","name":"MongoDB","icon":"dashboard","disabled":false,"hidden":false}]
沒有留言:
張貼留言