-
I switched my Zigbee system to zigbee2mqtt but have some questions on how to handle events from switches. I tried setting up a mqtt_trigger like this:
From the zigbee2mqtt logs I can see that the topic 'zigbee2mqtt/schakelaar_ouders_slaapkamer/action' changes when I click on the switch. However I keep getting errors like this:
Am I missing something, or is this a bug? I am using HA 2025.2 and everything is updated to the latest version. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
try this one: @mqtt_trigger('zigbee2mqtt/schakelaar_ouders_slaapkamer')
def handle_mqtt_message(**kwargs):
log.warning(f"{kwargs}")
# and trigger to a certain type of action like so
@mqtt_trigger('zigbee2mqtt/schakelaar_ouders_slaapkamer', "payload_obj['action'] == 'single'")
def trigger_on_action_single(**kwargs):
log.warning(f"action single") |
Beta Was this translation helpful? Give feedback.
-
After rebooting home assistant the errors went away. I guess that pyscript did not load the mqtt libs after I installed mqtt. Only after a reboot that did happen. |
Beta Was this translation helpful? Give feedback.
After rebooting home assistant the errors went away. I guess that pyscript did not load the mqtt libs after I installed mqtt. Only after a reboot that did happen.