Zigbee2mqtt, hassio, powerloss, all zigbee devices with state 'on'

Hi guys,

On my second installation I have a strange issue and can’t figure out what I can do to change the behavior of my Hassio with zigbee2mqtt add-on. It might be a really simple fix but haven’t been able to resolve it yet.

Issue is when there is a power outage and on resume of power, ALL of my zigbee devices get’s turned on (lights, fan’s, water, heater etc etc). I want it to just resume last known state… I assumed this was the default behavior…?

1 Like

Really? Nobody experienced this ?

It’s default behaviour for zigbee devices to turn on when power is restored. It’s so that if the zigbee fails you can still operate your devices the old fashioned way.

Hi Marc, really a bad default behavior :slight_smile:
An example are my summer house - I control heaters, fans, lights, water etc through HA and Z2M. Like now in October it is closed for the winter. A power-loss then results in all lights coming on, heater turns on, water … well you see my point?

It should definitely been a config entry with an option for default behavior;

  • Restore to last state
  • Turn it all on

The worst is that HA is not updated after power are restored, meaning HA’s states starts with last state but not the entities itself. The result is that HA show everything off but in real lifte - it’s on.

My solution are then to create an automation where I notify myself with a message upon homeassistant startup:

  trigger:
    - platform: homeassistant
      event: start

You can set ‘reporting’ (I think it’s called) on so that after a short time homeassistant gets the correct state of the entities and you can use them all being on as a trigger to turn them off.

I personally think it’s good default behaviour, imagine that your homeassistant goes down, or your zigbee dongle fails. If the default was for all your devices to stay off after the power has been cut then you would never be able to use the devices again. Whereas the current default means that you can simply turn the devices off at the switch and then use the switches to manually turn them on and off until you replace the dongle or fix homeassistant.

It’s levels of degradation of the system, if all else fails you can drop back to manual control. If you remove that, then you are always reliant on the system working perfectly at all times, and in the event of failure you’re sat in the dark.

Marc, I can agree that the default behavior is probably something that fit for some but not for all.
That is why a setting in config would be a good option where me as a user could define what best fit my needs. Agree ?

1 Like

I can see that people may want this behaviour in certain circumstances, but I would pose this question.

If you are at your summer house and your zigbee dongle fails and you can’t get a replacement for 2 weeks, and you have overridden the default behaviour for things to stay off, how would you get hot water during those 2 weeks? Or light in the evenings?

It’s a sensible default, and there are ways to ensure that you are not left in a situation where everything turns on and remains on without your knowledge with reporting.

The same way you described - turn off and on the switch of the entity (bulb, fan etc), then it turns on.

But you just said that you want the bulbs and water heater to resume their last state when power is restored, so they will remain off when you do it.

:wink:

That’s why the default is what it is.

Do you mean zigbee devices in general or in conjunction with zigbee2mqtt?
For instance hue bulbs have configurable behavior after power loss.

IMO it should be the user choice depending on device. For example bulbs should stay off while sockets should turn on. In general because there might be specific use cases.

I only hope OP is not talking about ha/dongle power loss and restart which causes turning all devices on.

It’s default behaviour for all zigbee devices. The Hue hub allows you to change the behaviour, but for the reasons I outlined above I think people should be really selective when they use it because it takes away your ability to manually control the devices if there is a failure elsewhere.

tbh I don’t understand how default off might impact further ability to control it. It still can be turned on manually or using automation.

Yes, but in this case when the building is unattended, if there was an option saying “on startup, resume last known state” this would ensure any unwanted reboot would make sure no entity changed state. HA works this way and store last known state.

In this scenario, HA thinks they are off and show them as off, even if they got turned on after the power-loss. Only way (I’ve found) to update the states of HA is to actually toggle the buttons in the GUI so they get ON and then turn off again. Not good at all.

Is there a way where I could force HA to check the physical state of each entity and update itself on startup?

1 Like

Not default OFF, default to last known state.

How?

If you set the device to remain off (or retain its last known state, and that state was off) then you cannot control it with the switch anymore, as all you are doing is cutting the power and restoring it, and the bulb restores the state to off.

You can’t control it with an automation because your automation system is down, or your zigbee dongle has failed.

So how are you going to turn that light on?

1 Like

For the third time in this thread, turn on reporting in zigbee2mqtt and homeassistant will see the correct states.

Afaik at least with bulbs, they work bu turning OFF and ON. But I see your point.

Ahh understand. I agree then that defaulting to last known state is one of those things which should be rethinked twice before using.

1 Like

Yes, but they work like that because it is the default behaviour. This entire thread is you asking to change that default behaviour, so you would be removing this option and removing manual control of the devices.

1 Like

God damn, it is on at home, it was NOT on in my summerhouse… Thx for making me check that! :slight_smile:

1 Like