OK. I think I need some help.
I have the Lutron Aurora dimmer switch, a zigbee device via z2m, and watching MQTT payloads, it does 2 types of payloads:
Every few minutes, the availability payloads would be like this:
{
"battery": 100,
"last_seen": "2025-06-06T16:02:12.612Z",
"linkquality": 21
}
And if you click or turn the switch, the payload would be like this:
{
"battery": 100,
"last_seen": "2025-06-06T16:52:53.981Z",
"linkquality": 40,
"action": "brightness_move_to_level",
"action_group": 25088,
"action_level": 0,
"action_transition_time": 0.07,
"brightness": null,
"update": {
"installed_version": -1,
"latest_version": -1,
"state": null
}
}
So what I can tell is that, if you click the button, you will get these 2 in the payload:
"action": "brightness_move_to_level",
"action_transition_time": 0.07,
and if you turn the rotary ring, you will get:
"action": "brightness_move_to_level",
"action_transition_time": 0.02,
(and there is only 0.07
and 0.02
, whenever we have the brightness_move_to_level
)
So, I figured I might be able to use MQTT Event with some templating to translate the behaviors above into 2 event types: press
and turn
So here is what I have got so far. Not sure if there is any easier or shorter forms, or whether I’m missing anything.
mqtt:
- event:
name: "Aurora Switch Event"
state_topic: "zigbee2mqtt/Aurora Dimmer Switch"
value_template: |
{% if value_json.action == 'brightness_move_to_level' and if value_json.action_transition_time == '0.07' %}
"event_type": "press"
{% else if value_json.action == 'brightness_move_to_level' and if value_json.action_transition_time == '0.02' %}
"event_type": "turn"
{% endif %}
event_types:
- press
- turn
… and of course it does not work
… and I’m not sure what to do next, or how I go about to debug the thing.
Anything more info I need to provide…? Yes I have read the MQTT Event - Home Assistant document… but can’t say I understand the template part. I have read the Templating - Home Assistant and MQTT docs also.
A pointer would be appreciated.