• V
 

topicにメッセージをpublishする

課題

MQTTブローカーのtopicにメッセージをpublishしたい。

解決

MQTT Output ノードを使用してtopicにメッセージをpublishする。

[{"id":"9c138886.116928","type":"mqtt out","z":"eda2a949.74ea98","name":"","topic":"sensors/livingroom/temp","qos":"","retain":"","broker":"61de5090.0f5d9","x":430,"y":100,"wires":[]},{"id":"ff654e7f.32e9e","type":"inject","z":"eda2a949.74ea98","name":"temperature","topic":"","payload":"22","payloadType":"num","repeat":"","crontab":"","once":false,"x":230,"y":100,"wires":[["9c138886.116928"]]},{"id":"61de5090.0f5d9","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]

議論

MQTTブローカーに接続済の MQTT Config ノードが関連付けられている MQTT Output ノードが、 あらかじめ設定されたtopicにメッセージをpublishします。