Hi! I’m unable to make this work… I have a zigbee doorlock in zigbee2mqtt. I want to trigger an automation when a specific user id unlock the door. It was working flawless with ZHA using zha_event but now that I’ve moved to Z2M, I’m unable to make this work with the trigger type MQTT. If anyone could give me hint/help that would be really appreciated!
Here’s the output of mosquitto_sub when I unlock the door with the user, as you can see the important part for me here is “action_user”:6 and the topic is "zigbee2mqtt/mqtt doorlock "
I think the problem is that your topic contains a space. The topic from the mqtt trigger needs to match exactly the topic sent by your mqtt broker, but you added an underscore.
That was my main concern, I tried replacing the space with a _, escaping before the space with a backslash, put int double quote, as is with the space. None of them worked … I’ll try the suggestion bellow. Thanks for your help!
The space wasn’t the problem, I confirmed it by changing the device name. This automation doesn’t work and I can’t understand why or how can I debug this…
alias: Unlock notification - User6
description: ''
trigger:
- platform: mqtt
topic: zigbee2mqtt/DoorlockAvant
condition:
- condition: template
value_template: '{{ trigger.payload_json.action_user == ''6'' }}'
action:
- service: notify.mobile_app_cell
data:
message: User 6 unlocked the door
title: User 6 unlocked the door
data:
ttl: 0
priority: high
mode: single
variables:
slot: '{{ trigger.event.data.args.code_slot }}'
I still get the " This node was not executed and so no further trace information is available." or “Stopped because of unknown reason “null” at 18 January 2022, 07:53:10 (runtime: 0.00 seconds)”
That’s a great idea. After removing the condition the automation seems to “trigger”, but it doesn’t really. By that I mean, there’s new traces but they all show the exact same messages I had before and action doens’t run:
that was literally stuck in my automation, I used this variables in my old automation with ZHA, I can’t remove it when I delete, save the yaml it come back… So I created a brand new automation with the exact same code minus the variables and this one work like a charm…
Thanks for your help, I’m not sure if I should open a bug or something because there’s definitely something not working as expected but I’m not sure I would be able to produce any good info/logs on that…