2020年12月3日 星期四

Receiving a JSON object via MQTT messaging / Sending a JSON object via MQTT to Node-Red

接收http://www.hivemq.com/demos/websocket-client/ 來的Json資料, 發送Json資料 給http://www.hivemq.com/demos/websocket-client




 

Node-Red 上 收 hivemq 資料

alex9ufo/sensor1/outTopic 

broker.mqtt-dashboard.com Port:1883


hivemq上 收  Node-Red  資料

alex9ufo/sensor2/inTop

http://www.hivemq.com/demos/websocket-client/

broker.mqttdashboard.com  port:8000









[{"id":"995c991a.566ba8","type":"mqtt in","z":"2b3214e5.a3a7cc","name":"","topic":"alex9ufo/sensor1/outTopic","qos":"2","datatype":"auto","broker":"e4d9b72d.d14398","x":350,"y":180,"wires":[["ba25f21f.ffa71"]]},{"id":"ba25f21f.ffa71","type":"json","z":"2b3214e5.a3a7cc","name":"","property":"payload","action":"","pretty":false,"x":550,"y":180,"wires":[["9660236a.9c53d"]]},{"id":"9660236a.9c53d","type":"debug","z":"2b3214e5.a3a7cc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":710,"y":180,"wires":[]},{"id":"f55b4a38.72baf8","type":"mqtt out","z":"2b3214e5.a3a7cc","name":"","topic":"alex9ufo/sensor2/inTopic","qos":"1","retain":"","broker":"e4d9b72d.d14398","x":830,"y":260,"wires":[]},{"id":"1175a0c6.d4ca9f","type":"function","z":"2b3214e5.a3a7cc","name":"","func":"var outstr={\"analyze\": true ,\"value\":50};\nmsg.payload= outstr;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":470,"y":260,"wires":[["4582efd.f2bb31"]]},{"id":"4582efd.f2bb31","type":"json","z":"2b3214e5.a3a7cc","name":"","property":"payload","action":"","pretty":false,"x":610,"y":260,"wires":[["f55b4a38.72baf8","3fb07ae9.09b6b6"]]},{"id":"19c954a9.3f835b","type":"inject","z":"2b3214e5.a3a7cc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":330,"y":260,"wires":[["1175a0c6.d4ca9f"]]},{"id":"3fb07ae9.09b6b6","type":"debug","z":"2b3214e5.a3a7cc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":790,"y":320,"wires":[]},{"id":"e4d9b72d.d14398","type":"mqtt-broker","z":"","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":""}]

沒有留言:

張貼留言

2024_09 作業3 以Node-Red 為主

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