Closed robvanoostenrijk closed 1 week ago
I looked into this further, and its not an error with zigbee2mqtt-automations, but zigbee2mqtt parsing potentially invalid JSON.
This happened because I used the examples from zigbee2mqtt-automations:
action:
- entity: Miboxer RGB led controller
payload: { brightness: 255, color: { r: 0, g: 0, b: 255 }, transition: 5 }
- entity: Moes RGB CCT led controller
payload: { brightness: 255, color_temp: 500, transition: 10 }
The JSON objects in these, do not use quoting which apparently can configure zigbee2mqtt message parsing.
For my example above, the correct YAML would be:
remote_den_on:
active: true
trigger:
- entity: Remote - Den
action: on
action:
- entity: Airconditioning - Den
logger: info
payload: { "system_mode": "cool", "preset": "manual", "current_heating_setpoint": 26 }
I cross-verified this with the following MQTT messages:
mosquitto_pub -t 'zigbee2mqtt/Airconditioning - Den/set' -m '{ "system_mode": "cool", "preset": "manual", "current_heating_setpoint": 26 }'
versus
mosquitto_pub -t 'zigbee2mqtt/Airconditioning - Den/set' -m '{ system_mode: cool, preset: manual, current_heating_setpoint: 26 }'
Without the quoted JSON, zigbee2mqtt will set:
{"current_heating_setpoint":26,"preset":"manual","system_mode":26}
With quoted JSON, zigbee2mqtt will set:
{"current_heating_setpoint":26,"preset":"manual","system_mode":26}
Closing this issue, as its not a zigbee2mqtt-automations issue.
Defined is the following automation:
In Zigbee2MQTT this generates the following in the log:
Updating the automation as follows resolves the issue:
Interestingly enough, the failed Z2M MQTT message causes MatterBridge to end up failing its session. I will report this as an issue separately on MatterBridge.