2020年11月24日 星期二

Node-Red UI control LED ON / LED Off 1 (Publish --> Subscribe delay 2 sec ) 不含SQLite

 Node-Red UI control LED ON / LED Off  (Publish --> Subscribe delay 2 sec ) 不含SQLite






[{"id":"124d8a23.1285f6","type":"mqtt in","z":"681fb23e.69453c","name":"","topic":"alex9ufo/led/led_event","qos":"1","datatype":"auto","broker":"841df58d.ee5e98","x":220,"y":120,"wires":[["42005f54.d3e6c"]]},{"id":"a9d36e8d.37634","type":"ui_text","z":"681fb23e.69453c","group":"57fb2f24.9f1f1","order":0,"width":0,"height":0,"name":"","label":"MQTT Suscribe Data (MQTT 訂閱的資訊)","format":"{{msg.payload}}","layout":"col-center","x":860,"y":80,"wires":[]},{"id":"c40534ff.731628","type":"ui_button","z":"681fb23e.69453c","name":"","group":"57fb2f24.9f1f1","order":0,"width":0,"height":0,"passthru":false,"label":"On led","tooltip":"","color":"white","bgcolor":"","icon":"fa-circle","payload":"LED on","payloadType":"str","topic":"","x":190,"y":320,"wires":[["1bc1f3c3.64d7ac","3a41798c.237d76","c4a49581.6bbe78"]]},{"id":"3e84f6a7.66af1a","type":"ui_button","z":"681fb23e.69453c","name":"","group":"57fb2f24.9f1f1","order":0,"width":0,"height":0,"passthru":false,"label":"Off led","tooltip":"","color":"black","bgcolor":"","icon":"fa-circle-o","payload":"LED off","payloadType":"str","topic":"","x":190,"y":420,"wires":[["1bc1f3c3.64d7ac","3a41798c.237d76","c4a49581.6bbe78"]]},{"id":"1bc1f3c3.64d7ac","type":"mqtt out","z":"681fb23e.69453c","name":"","topic":"alex9ufo/led/led_event","qos":"1","retain":"false","broker":"841df58d.ee5e98","x":440,"y":420,"wires":[]},{"id":"9f100f75.0b215","type":"function","z":"681fb23e.69453c","name":"Format timestamp","func":"var date = new Date();\nvar h = date.getHours();\nvar m = date.getMinutes();\nvar s = date.getSeconds();\nif(h<10){\n    h = '0'+h;\n}\nif(m<10){\n    m = '0' + m;\n}\nif(s<10){\n    s = '0' + s;\n}\nmsg.payload = msg.payload + ' --> Time:(' + h + ':' + m + ':' + s + ')' ;\n\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":200,"wires":[["1975153c.2fe26b"]]},{"id":"1975153c.2fe26b","type":"function","z":"681fb23e.69453c","name":"Set Line API ","func":"msg.headers = {'content-type':'application/x-www-form-urlencoded','Authorization':'Bearer A41wwPNh22Wq2lfeQyyIAwtggn1kfZSI5LkkCdia1gB'};\nmsg.payload = {\"message\":msg.payload};\nreturn msg;\n\n//oR7KdXvK1eobRr2sRRgsl4PMq23DjDlhfUs96SyUBZu","outputs":1,"noerr":0,"x":870,"y":200,"wires":[["b14d166e.9f5108"]]},{"id":"b14d166e.9f5108","type":"http request","z":"681fb23e.69453c","name":"","method":"POST","ret":"txt","paytoqs":false,"url":"https://notify-api.line.me/api/notify","tls":"","persist":false,"proxy":"","authType":"","x":800,"y":260,"wires":[["bbd74828.226738"]]},{"id":"bbd74828.226738","type":"debug","z":"681fb23e.69453c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":990,"y":260,"wires":[]},{"id":"7ceea8ed.6cf8d8","type":"debug","z":"681fb23e.69453c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":40,"wires":[]},{"id":"e48d485c.accce8","type":"ui_audio","z":"681fb23e.69453c","name":"","group":"57fb2f24.9f1f1","voice":"zh-TW","always":true,"x":760,"y":140,"wires":[]},{"id":"3a41798c.237d76","type":"ui_text","z":"681fb23e.69453c","group":"57fb2f24.9f1f1","order":7,"width":0,"height":0,"name":"","label":"MQTT Publish Data (MQTT發行的資訊)","format":"{{msg.payload}}","layout":"col-center","x":500,"y":320,"wires":[]},{"id":"5ea60fcf.51db3","type":"function","z":"681fb23e.69453c","name":"","func":"var pub=msg.payload;\nif (pub=='LED on')\n    msg.payload='LED 開';\nelse if (pub=='LED off')\n    msg.payload='LED 關';\nelse    msg.payload='';  \n   \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":550,"y":120,"wires":[["7ceea8ed.6cf8d8","9f100f75.0b215","e48d485c.accce8","a9d36e8d.37634"]]},{"id":"c4a49581.6bbe78","type":"debug","z":"681fb23e.69453c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":410,"y":360,"wires":[]},{"id":"42005f54.d3e6c","type":"delay","z":"681fb23e.69453c","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":420,"y":120,"wires":[["5ea60fcf.51db3"]]},{"id":"841df58d.ee5e98","type":"mqtt-broker","z":"","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":"57fb2f24.9f1f1","type":"ui_group","z":"","name":"ON OFF 1","tab":"6f605bb4.60a174","order":1,"disp":true,"width":"6","collapse":false},{"id":"6f605bb4.60a174","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]


修改Line Notify 發行權杖為自己的權杖 請參考下面

http://alex9ufoexploer.blogspot.com/2020/10/line-notify.html



//====================================================

 A4wwPNh2WqB7dlfeQyyIAwtggn1kfZSI5LkkCdia1gB'};



沒有留言:

張貼留言

113 學年度第 1 學期 RFID應用課程 Arduino程式

113 學年度第 1 學期 RFID應用課程 Arduino程式 https://www.mediafire.com/file/zr0h0p3iosq12jw/MFRC522+(2).7z/file 內含修改過後的 MFRC522 程式庫 (原程式有錯誤) //定義MFRC522...