ZHA zigbee device connect event?

Hi!

I have this automation which works on my Zigbee bulbs.
when I turn on/off the lamp from HA or when I turn off/on the lamp from
physical button IF the lamp is lit.

If I turn of the lamp via HA, then power it off then on via physical switch it does not turn on again.
So state_changed is not fired when the device reconnects to my Zigbee network

I cant seem to find any other event trigger, is there any “zigbee device avalible” event? Or something that can force my bulb to ON if it was OFF when it went “offline”

- id: livarno_colorreset
  alias: Livarno RGB Reset Color
  trigger:
    - platform: state
      entity_id:
        - light.livarnolux_rgb_01
        - light.livarnolux_rgb_02
        - light.livarnolux_rgb_03
        - light.livarnolux_rgb_04
      to: "on"
  action:
    - service: light.turn_on
      data:
        entity_id: "{{ trigger.entity_id }}"
        brightness_pct: 80 
        kelvin: 3000

Wow really… No one?
I thought this was an helpful community.

The idea with smart bulbs is not to cut the power to them. Without power they have no ability to be smart.
Surely the light entities go from ‘unavailable’ to ‘whatever state it powers on to’ when the bulb powers up again.

This won’t help your cause.

Yes I’m aware of that, having children in the house who are not of age for a phone the physical button needs to remain.
Hence the need of the functionality.

Maybe, maybe not… I do not know what else to say after making several unhelped posts, trying to be as detailed as possible in my requests for help and them going unheard. What other conclusion was there to make.

Thank you for your time, I’ve been trying to get to such an event with no luck.
Somewhere there should be an event when the device reconnects to the zigbee network, when turned physically on, it should broadcast its presence atleast. No dice so far

How about using a ZigBee button instead? That’s what I do for a lot of my lights. It even gives you a lot more functionality. You can have automations based on single click, double click etc rather than just on/off. They are really cheap and by having the light powered up all the time you won’t be in a situation where an automation can’t turn on the light because someone left the power to it turned off.

That would solve some of my issues, untill the day my server halts because < reasons >
then the button wont to anything. I’ll think about it, thank you.

That’s when you can revert to using the power switch as a last resort… but your server shouldn’t be doing that…

I know it shouldnt, but I need to cover my bases

  • Windows 10 reboots… (have not yet managed to auto-start Oracle VM)
  • Possibility of router crashes
  • Possibility of PC crashes (faulty components/end of lifetime)

I can’t lock myself in to a heavy dependancy on the PC and Hassio server.

In regards to bold, thats where I’m stuck, if the device is “turned off via software” it stays off when powered/unpowered physically. I need to solve that first :slight_smile: I know solving that wont remedy the issues I’ve mentioned, but I have to start somewhere :stuck_out_tongue:

This depends on your bulb you are using, some can be configured to stay off or turn on after being powered.

Doesn’t need to be as some zigbee buttons can bind directly to a buld or group of bulds.

Anyway, @sparkydave already gave you a solution;

Trigger on state changing from unavialable.