MQTT Node-Red light "state" "ON/OFF"

Hallo all

I cant get my light to turn on and off.

My MQTT Broker are connected, and I use MQTT Explorer to see the lamps mqtt topic. zigbee2mqtt/Lille PH Lampe

here are my simple flow
flows.json (1.8 KB)

[{"id":"78056ff7a3ad8df8","type":"tab","label":"Flow 7","disabled":false,"info":"","env":[]},{"id":"e54fdfffe9db6130","type":"mqtt out","z":"78056ff7a3ad8df8","name":"Lille PH Lampe","topic":"zigbee2mqtt/Lille PH Lampe","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"711011c119463c3b","x":660,"y":240,"wires":[]},{"id":"25f602b71e7c4dc2","type":"inject","z":"78056ff7a3ad8df8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":200,"wires":[["2f1ad3b70c8d69bb"]]},{"id":"2f1ad3b70c8d69bb","type":"change","z":"78056ff7a3ad8df8","name":"ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"state\":\"ON\"}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":200,"wires":[["e54fdfffe9db6130"]]},{"id":"90ea93243bc02ae5","type":"change","z":"78056ff7a3ad8df8","name":"OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"state\":\"OFF\"}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":280,"wires":[["e54fdfffe9db6130"]]},{"id":"ad2f7bc33462da99","type":"inject","z":"78056ff7a3ad8df8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":280,"wires":[["90ea93243bc02ae5"]]},{"id":"711011c119463c3b","type":"mqtt-broker","name":"MQTT Broker","broker":"192.168.1.106","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]

I use change node to set payload to {"state":"ON"} and {"state":"OFF"}, but the lamp dont changes

Can you point to documentation for the lamp you are using?

its a normal philips hue bulb

Your topic should end with SET,
So the mqtt node topic should be zigbee2mqtt/Lille PH Lampe/set

edje11

I love you. Now it work :slight_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.