Z2M scene in HA

Yes. Should be released by the end of the week from what I’ve heard.

1 Like

Just out of curiosity: why would you want to do this instead in HA?

Because ZigBee scenes are much more efficient than HA scenes (lower load on the ZigBee network, faster response).

1 Like

They really are MUCH faster if you have many lights in a scene. For instance, I have a total of 26 lights in my kitchen. when turning all on / off from a physical (Hue) switch, it can take several seconds using a HA scene, as opposed to virtually instant using z2m scenes. This slight lack of delay gives the switch a much more reliable feel.

Okay, I get it: it’s like creating z2m groups which are passed on to HA.

Thanks for clarifying! :+1:

I’m having a bit of a nightmare with the Z2M scenes at the moment!

They seem to randomly change their name (discovered scenes) in HA to either add or remove a suffix.

So for example I have a scene called scene.kitchen_0_kitchen_bright. This then becomes scene.kitchen_0_kitchen_bright_2. There are other scenes which have the ‘_2’ at the end, which then gets removed.

This obviously throws out all my automatons in NR and my many scene buttons on my Dashboard.

Anyone else seeing this?

It’s a race condition between deleting the old entities and creating the new ones. I’ve proposed a fix in Prevent scene entities from being duplicated by mundschenk-at · Pull Request #20097 · Koenkk/zigbee2mqtt · GitHub, I assume it will be in the next version.

1 Like

That’s fantastic news. I’ve had to drop back to regular HA scenes for now as it’s a live system and my wife was about to kill me as nothing was working reliably. :rofl:

Any idea when the next version will be released, or how I can try the new version?

No, sorry. (You will be able to try the new version by switching to the dev branch, but the changes are not merged yet.)

1 Like

Has this fix been released yet? Not sure if I’ve missed it. I’m not using the Dev branch btw.

Releases happen at the beginning of each month, so no. Should be out tomorrow though.

1 Like

Had a little play with it today, and it seems to be working well so far. only difference from before being that if I create a scene in Z2M, I have to restart the Z2M add-on for the new scenes to be picked up in HA. I’m guessing that this is standard behavior.

Is there any way to get transitions working with the scenes? Now that all my lights operate together (no delay due to using HA scenes) when they all change at once, it can be quite jolting!

Unfortunately, transitions currently can only be set when creating the scene. It’s actually something I wanted to make a feature request on Z2M (though I don’t know if this is Hue extension or a generic ZigBee capability).

Regarding the restart being necessary for newly created scenes: Actually no, that is not the intended behavior. I’ll look into it.

Hi. I would also have a question and no idea what is going on.

I created a scene in Z2M via the UI. If I now activate this with the command scene.turn_on in an automation for a switch and the light is off before, the light or scene is switched on slowly. More precisely, the set brightness is adjusted slowly. As if a transition of maybe 1-3 seconds was set. But I didn’t set a transition anywhere. I don’t know why this could be?

For example, if I create a scene with the same settings in HA and use it in the automation, then this effect does not occur. The light comes on immediately at the brightness set in the scene.

Can anyone give me a hint on what I can do?

Edit: The same behavior when I activate the scenes with the Home Assistant UI, for example as a button in the dashboard. So automation is not the culprit.

I’m finding some more oddities with the scenes…

If I restart HA, the scenes often don’t come back as they should. They kind of exist if I look in the scenes settings, but they have a different name (eg ‘bright’ instead of ‘Kitchen Bright’) and they also say “this entity is no longer being provided by the mqtt integration…”

Once I restart the Z2M addon, they then come back as expected.

What Z2M version are you on? Scenes should work correctly for several versions now.

I’m on version 1.36.0-1.

So am I right in thinking that no one else is getting this error? Or is this just a very niche thing to do (use scenes in Z2M).

I can replicate the problem 100% of the time:
Restart HA - Z2M scenes stop working correctly
Restart Z2M add-on - scenes work normally again

I don’t have this issue, no, even though I am using Z2M scenes. Are you running the Mosquitto and Z2M add-ons? There have been some complaints about auto-discovery in general not working correctly after a HA restart, but I haven’t seen those on my setup. (I am using external VMs for both the MQTT broker and Z2M though, but that should not make a difference in theory,)

Yes I am running both as add-ons.
Any idea how I can go about troubleshooting this?