Closed dennyfmn closed 2 years ago
More information: It seems that the issue is sending Json MQTT messages.
Topic: zigbee2mqtt/zig_bulb1/set Message: "ON" works
Topic: zigbee2mqtt/zig_bulb1/set Message:{"state":"ON"} does not work.
I can't figure out how to send a JSON formatted payload.
Well I finally figured it out. The JSON string needed to be enclosed in single quotes. These MQTT commands work for me.
{"clientId":"ha-bridge","topic":"zigbee2mqtt/zig_bulb2/set","message":'{"state":"ON"}',"qos":"1","retain":"false"} {"clientId":"ha-bridge","topic":"zigbee2mqtt/zig_bulb2/set","message":'{"brightness":${intensity.math(X*1)}}',"qos":"1","retain":"false"} {"clientId":"ha-bridge","topic":"zigbee2mqtt/zig_bulb2/set","message":'{"state":"OFF"}',"qos":"1","retain":"false"}
I have some Sengled E11-G13 bulbs that I am using with Zigbee2MQTT. They expose ON, OFF, and dimming commands. Everything works in the Zigbee2MQTT frontend, Node-Red, and manually with MQTT-Explorer. The ON and OFF items work correctly in ha-bridge test and also with Amazon Echo voice commands.
I'm having trouble getting the DIM MQTT command working. The bulb requires a Topic/Message that looks like this.
Topic: zigbee2mqtt/zig_bulb1/set Message: {"brightness": 90} (a JSON string)
In ha.bridge I have tried many variations of quoting but have not found the right syntax. The brightness value can go from 0 to 254. I would like to be able to set the brightness level as a percentage.
I currently have in the ha-bridge device, Type MQTT Message, Content Type application/json: Target Item for DIM {"clientId":"ha-bridge","topic":"zigbee2mqtt/zig_bulb1/set","message":{"brightness": ${intensity.percent}},"qos":"1","retain":"false"}
With all the variations I have tried, I just get ERROR in the log. spark.http.matching.GeneralError
I have searched and can't find an example for this on the net. Any help will be appreciated.