[Example] Use MQTT nodes
Posted: Thu Oct 12, 2023 1:37 pm
Install mosquitto mqtt windows broker.
The below is IoT Studio Flow for try:
The below is IoT Studio Flow for try:
Code: Select all
[{"id":"14727b20ba9a4464","type":"inject","z":"bcd01373ec78fda2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":120,"wires":[["33aae1d206e80f4c"]]},{"id":"20d604a0d2955c8a","type":"mqtt in","z":"bcd01373ec78fda2","name":"","topic":"AICCLOUD_TEST","qos":"2","datatype":"auto-detect","broker":"e122a5dd65c0705c","nl":false,"rap":true,"rh":0,"inputs":0,"x":250,"y":180,"wires":[["51e81364e008b213"]]},{"id":"2e70f0fb0b7d490a","type":"mqtt out","z":"bcd01373ec78fda2","name":"","topic":"AICCLOUD_TEST","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"e122a5dd65c0705c","x":550,"y":120,"wires":[]},{"id":"33aae1d206e80f4c","type":"function","z":"bcd01373ec78fda2","name":"data","func":"msg.payload = {\n temp: 25.3,\n humi: 60.8\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":120,"wires":[["2e70f0fb0b7d490a"]]},{"id":"51e81364e008b213","type":"debug","z":"bcd01373ec78fda2","name":"debug 41","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":460,"y":180,"wires":[]},{"id":"e122a5dd65c0705c","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"3","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]