Did you upgrade to Zigbee2MQTT 2.0?
Also restart HA and refresh browser cache may be needed sometimes
Did you upgrade to Zigbee2MQTT 2.0?
Also restart HA and refresh browser cache may be needed sometimes
yes i did it and still nothing
First lets see if it is supposed to be there
If you go to Integrations → MQTT and find your device. Click on it.
You should see something like this for a 4-button Hue switch
Note that there is an Events window in center column at the top.
You should see an Action device there.
Unfortunately there is no UI in this view that can show attributes. You have to go to developer tools → States (NOT Actions!)
In the top of Filter Entities you can type event.
and you should see your remotes
Here are a sniplet of mine
Something is wrong. Your screen looks like before Zigbee2MQTT 2.0. It is not picking up the changes.
Look at your setttings in zigbee2mqtt.
If you want events to show up, select “Home Assistant experimental even entities”.
You can also select “Home Assistant legacy action sensors” and all is working as before the upgrade tot zigbee2mqtt 2.0
perfect thank you
I set that already in the December release and assumed it was on by default on a 2.0. It is not experimental any longer.
Hi everyone, since i struggled for an hour or so to find a solution for my Hue Switch and bridge my existing flows in node-red with the new event types, i am sharing the below for reference and hopefully helping someone in the process.
In the past i was getting on my hue dimmer a payload like
“on_press_release” or “off_press_release” etc for each button i was using. This msg was then passed to a switch node and depending on the payload different actions were activated.
On my exploration of the message received from the new events, i realized that i wanted to refer to the msg.data.new_state.attributes.button and msg.data.new_state.attributes.event type which they hold the information i needed for the switch node to work. So, i wrote a small function that gets the msg data from the message and jointed the values to create the old behaviour, while keeping the new changes as is.
// Example: Node-RED Function node
// Assume the incoming msg contains data in msg.data.new_state
const newState = msg.data.new_state;
if (newState && newState.attributes) {
const buttonValue = newState.attributes.button;
const eventType = newState.attributes.event_type;
// If both properties exist, create a combined string.
if (buttonValue && eventType) {
msg.payload = `${buttonValue}_${eventType}`;
} else {
// If either property is missing, handle it gracefully.
msg.payload = null;
}
} else {
// If msg.data.new_state or .attributes is missing, handle it.
msg.payload = null;
}
// Return the updated message.
return msg;
For this to work, i use an event node for the device action entity, i pass the event to this function node, and the output to my switch which i handled the different actions.
I hope this will help someone like me to cope with the new changes.
Thanks @KennethLavrsen for the write-up. I tried this out earlier today but instead using the example YAML provided at Event - Home Assistant
In the couple of hours since I set that up I had been seeing a lot of “ghost events” where lights were toggled on without actual button presses. According to the logbook it was due to state of the event.xyz entity changing but without any more detail than that. Is this because I didn’t include a condition for “unavailable”, or maybe the "to: null"
part of the trigger?
I’ve since reverted to using mqtt triggers, which so far seem to be working ok and don’t require a lot of code refactoring:
- trigger: mqtt
topic: "zigbee2mqtt/Kitchen Xiaomi Cube White/action"
payload: "tap"
The topic you refer to seems written with ZHA in mind.
This start of the automation
triggers:
- trigger: state
entity_id: event.bedroom_switch_action
to: null
conditions:
- condition: template
value_template: "{{trigger.from_state.state != 'unavailable'}}"
comes from the newly added documentation for Zigbee2MQTT so I am sure the extra bits added there are added for a good reason.
Yes, you can also use the old MQTT way. I never tried that so I cannot say if it would be easier or more difficult. There must be a reason the event way was added to Zigbee2MQTT. The old binary_sensor way was always marked as not recommended and to be deprecated so that is why I was avoiding it.
So, just a quick question for confirmation.
In order to prepare for the move to 2.0, is this considered best practice?
In the Zigbee2MQTT settings, I enable ‘Home Assistant experimental event entities’ but keep the ‘Home Assistant legacy triggers’ box ticked still.
Restart Zigbee2MQTT
Change the YAML code from
alias: BTN_07 Double Click 4 Printer
description: ""
mode: single
triggers:
- entity_id: sensor.xa_btn_07_action
to: double
trigger: state
conditions: []
actions:
- data: {}
target:
entity_id: switch.officeplug_6
action: switch.toggle
to
alias: BTN_07 Double Click 4 Printer
description: ""
mode: single
triggers:
- trigger: state
entity_id:
- event.xa_btn_07_action
to: double
attribute: action
conditions: []
actions:
- data: {}
target:
entity_id: switch.officeplug_6
action: switch.toggle
Test & Ready to go!
Once I’ve done this for all my sensor actions I upgrade to Z2M 2.0 and I’m fine?
Or do I also need to make changes to MQTT topics and/or anything else?
Addition after seeing the last post:
Should I add this condition to all automations as well?
conditions:
- condition: template
value_template: "{{trigger.from_state.state != 'unavailable'}}"
I noted when I enabled some entities of a Zigbee2MQTT device that the entire MQTT integration goes off and on on again making 1000+ entities go unavailable for a short moment. It seems to avoid a lot of false triggers of automations to have that extra condition. I can think of many examples where we upgrade Zigbee2MQTT or MQTT server itself where we have a lot of events going to unavailable and back.
After zigbee2MQTT 2.0 upgrade it died.
zigbee2MQTT now states it cannot find the network address of smlight.
The smlight integration in Home Assistant is finding it fine.
13)
at start (/app/index.js:161:5)
[19:21:53] INFO: Preparing to start...
[19:21:53] INFO: Socat not enabled
[19:21:54] INFO: Starting Zigbee2MQTT...
Starting Zigbee2MQTT without watchdog.
[2025-01-04 19:21:55] error: z2m: Error while starting zigbee-herdsman
[2025-01-04 19:21:55] error: z2m: Failed to start zigbee-herdsman
[2025-01-04 19:21:55] error: z2m: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start_crashes-runtime.html for possible solutions
[2025-01-04 19:21:55] error: z2m: Exiting...
[2025-01-04 19:21:55] error: z2m: Error: Cannot discover TCP adapters at this time. Specify valid 'adapter' and 'port' in your configuration.
at findTCPAdapter (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/adapter/adapterDiscovery.ts:470:15)
at discoverAdapter (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/adapter/adapterDiscovery.ts:496:26)
at Function.create (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/adapter/adapter.ts:68:54)
at Controller.start (/app/node_modules/.pnpm/zigbee-herdsman@3
Trying to figure it now.
Specify your adapter in the config
SLZB-06 over Ethernet was working great prior to 2.0
Trying work out the extra config v2.0 needs
serial:
port: tcp://ip.ip.ip.ip:6638
adapter: zstack
The adapter thing is what you are missing now.
Hi, I just tried updating my automations YAML config to suit Zigbee2MQTT 2.0 and the automations still don’t seem to work. Can someone help me work out what I’m doing wrong?
Old config:
- alias: Dining room light switch single
trigger:
- platform: state
entity_id: sensor.dining_room_light_switch_action
to: single
action:
service: light.toggle
entity_id: light.dining_room
id: 18cdee8f3f4aca34719087f8f3ec7e40
New config:
- alias: Dining room light switch single
trigger:
- platform: state
entity_id: sensor.dining_room_light_switch_action
to: ~
conditions:
- condition: template
value_template: "{{trigger.from_state.state != 'unavailable'}}"
- condition: template
value_template: "{{trigger.to_state.attributes.event_type == 'single'}}"
action:
service: light.toggle
entity_id: light.dining_room
You still use the old sensor. Change to event entity