2021年10月11日 星期一

使用Node-Red 控制 Blynk

 使用Node-Red 控制 Blynk  

參考來源https://community.blynk.cc/t/controlling-blynk-with-node-red-and-vice-versa-demo/31185




1) 手機上Blynk -->Device: Node-Red

 












  

2) Blynk 的設定

 url : ws://blynk-cloud.com/websockets

Auth Token: 



12 Oct 09:12:47 - [warn] [blynk-ws-client:Node-Red Blynk1]  Cmd. HW, Id. 7778, len. 5, data. "ar|17"

12 Oct 09:12:47 - [info] [blynk-ws-client:Node-Red Blynk1] writeEvent: -> cmd {"type":20,"typeString":"HW","msgId":26,"len":6,"msgLength":11,"body":"vw\u00001\u00000","operation":"vw","pin":"1","value":"0","array":["0"]}

12 Oct 09:12:48 - [info] [blynk-ws-client:Node-Red Blynk1] writeEvent: -> cmd {"type":20,"typeString":"HW","msgId":27,"len":6,"msgLength":11,"body":"vw\u00002\u00000","operation":"vw","pin":"2","value":"0","array":["0"]}

12 Oct 09:12:48 - [warn] [blynk-ws-client:Node-Red Blynk1]  Cmd. HW, Id. 7778, len. 5, data. "ar|17"

12 Oct 09:12:48 - [info] [blynk-ws-client:Node-Red Blynk1] writeEvent: -> cmd {"type":20,"typeString":"HW","msgId":28,"len":6,"msgLength":11,"body":"vw\u00000\u00000","operation":"vw","pin":"0","value":"0","array":["0"]}

12 Oct 09:12:49 - [warn] [blynk-ws-client:Node-Red Blynk1]  Cmd. HW, Id. 7778, len. 5, data. "ar|17"

Node-Red程式

[{"id":"83f90803.178f38","type":"ui_button","z":"dbfdc850db420e05","name":"","group":"d71d0ea4.12585","order":4,"width":0,"height":0,"passthru":false,"label":"Notify","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"Hello Blynkers","payloadType":"str","topic":"","topicType":"str","x":490,"y":540,"wires":[["b9fc19ad.40ec68"]]},{"id":"257c303.51e2dd","type":"ui_numeric","z":"dbfdc850db420e05","name":"","label":"Input Sensor","tooltip":"","group":"e13edb2e.3aa3b8","order":2,"width":"6","height":"1","wrap":false,"passthru":true,"topic":"","topicType":"str","format":"{{value}}","min":0,"max":"100","step":".1","className":"","x":510,"y":460,"wires":[["73e159a5.bfd658","eb4a25ae.f11ee8","6f7ccaff.afc4a4"]]},{"id":"6f7ccaff.afc4a4","type":"ui_slider","z":"dbfdc850db420e05","name":"","label":"Sensor","tooltip":"","group":"e13edb2e.3aa3b8","order":1,"width":"6","height":"1","passthru":true,"outs":"all","topic":"","topicType":"str","min":0,"max":"100","step":".1","className":"","x":500,"y":380,"wires":[["eb4a25ae.f11ee8","73e159a5.bfd658","257c303.51e2dd"]]},{"id":"e97b1aa9.a43038","type":"blynk-ws-out-write","z":"dbfdc850db420e05","name":"Slider - V3","pin":"3","pinmode":0,"client":"189291a1.d1446e","x":730,"y":260,"wires":[]},{"id":"eb4a25ae.f11ee8","type":"blynk-ws-out-write","z":"dbfdc850db420e05","name":"Value slider - V4","pin":"4","pinmode":0,"client":"189291a1.d1446e","x":740,"y":380,"wires":[]},{"id":"b9fc19ad.40ec68","type":"blynk-ws-out-notify","z":"dbfdc850db420e05","name":"","client":"189291a1.d1446e","queue":false,"rate":5,"x":690,"y":540,"wires":[]},{"id":"73e159a5.bfd658","type":"ui_text","z":"dbfdc850db420e05","group":"e13edb2e.3aa3b8","order":3,"width":"6","height":"1","name":"","label":"Sensor :","format":"{{msg.payload}}","layout":"row-center","className":"","x":720,"y":460,"wires":[]},{"id":"91a875dd.41c558","type":"ui_switch","z":"dbfdc850db420e05","name":"","label":"LED 2","tooltip":"","group":"73ce4f22.05854","order":2,"width":"6","height":"2","passthru":true,"decouple":"false","topic":"","topicType":"str","style":"","onvalue":"1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"0","offvalueType":"str","officon":"","offcolor":"","animate":true,"className":"","x":490,"y":160,"wires":[["4d77e20d.e2780c"]]},{"id":"4d77e20d.e2780c","type":"blynk-ws-out-write","z":"dbfdc850db420e05","name":"Button 2 - V2","pin":"2","pinmode":0,"client":"189291a1.d1446e","x":730,"y":160,"wires":[]},{"id":"42d3d69b.35b9c8","type":"blynk-ws-in-write","z":"dbfdc850db420e05","name":"Value slider - V4","pin":"4","pin_all":0,"client":"189291a1.d1446e","x":280,"y":380,"wires":[["6f7ccaff.afc4a4"]]},{"id":"a5138efa.c786e","type":"blynk-ws-in-write","z":"dbfdc850db420e05","name":"Button 1 - V1","pin":"1","pin_all":0,"client":"189291a1.d1446e","x":270,"y":80,"wires":[["575dc4cf53794321"]]},{"id":"42664708.536ed8","type":"blynk-ws-in-write","z":"dbfdc850db420e05","name":"Button 2 - V2","pin":"2","pin_all":0,"client":"189291a1.d1446e","x":270,"y":160,"wires":[["91a875dd.41c558"]]},{"id":"a3a886fb.a3e3e8","type":"blynk-ws-out-write","z":"dbfdc850db420e05","name":"Button 1 - V1","pin":"1","pinmode":0,"client":"189291a1.d1446e","x":730,"y":80,"wires":[]},{"id":"4208c7fb.d33878","type":"blynk-ws-in-write","z":"dbfdc850db420e05","name":"Slider - V3","pin":"3","pin_all":0,"client":"189291a1.d1446e","x":260,"y":260,"wires":[["e767551d7406b2a1"]]},{"id":"575dc4cf53794321","type":"ui_switch","z":"dbfdc850db420e05","name":"","label":"LED 1","tooltip":"","group":"73ce4f22.05854","order":2,"width":"6","height":"2","passthru":true,"decouple":"false","topic":"","topicType":"str","style":"","onvalue":"1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"0","offvalueType":"str","officon":"","offcolor":"","animate":true,"className":"","x":490,"y":80,"wires":[["a3a886fb.a3e3e8"]]},{"id":"e767551d7406b2a1","type":"ui_slider","z":"dbfdc850db420e05","name":"","label":"slider","tooltip":"","group":"f8d995.22561668","order":9,"width":0,"height":0,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":0,"max":"1023","step":1,"className":"","x":490,"y":260,"wires":[["e97b1aa9.a43038"]]},{"id":"d71d0ea4.12585","type":"ui_group","name":"Notify","tab":"da9fe531.af0fd8","order":4,"disp":true,"width":"6","collapse":false},{"id":"e13edb2e.3aa3b8","type":"ui_group","name":"Value","tab":"da9fe531.af0fd8","order":3,"disp":true,"width":"6","collapse":false},{"id":"189291a1.d1446e","type":"blynk-ws-client","name":"Blynk Demo","path":"ws://blynk-cloud.com/websockets","key":"blv6rHkYb_C3me78YBDz5LCYZfddO8l7","dbg_all":true,"dbg_read":false,"dbg_write":false,"dbg_notify":false,"dbg_mail":false,"dbg_prop":false,"dbg_sync":false,"dbg_bridge":false,"dbg_low":false,"dbg_pins":"","multi_cmd":false,"proxy_type":"no","proxy_url":"","enabled":true},{"id":"73ce4f22.05854","type":"ui_group","name":"Button","tab":"da9fe531.af0fd8","order":1,"disp":true,"width":"6","collapse":false},{"id":"f8d995.22561668","type":"ui_group","name":"Slider","tab":"da9fe531.af0fd8","order":2,"disp":true,"width":"6","collapse":false},{"id":"da9fe531.af0fd8","type":"ui_tab","name":"BLYNK","icon":"dashboard","order":3}]

沒有留言:

張貼留言

Messaging API作為替代方案

  LINE超好用功能要沒了!LINE Notify明年3月底終止服務,有什麼替代方案? LINE Notify將於2025年3月31日結束服務,官方建議改用Messaging API作為替代方案。 //CHANNEL_ACCESS_TOKEN = 'Messaging ...