Esphome light should not be unavailable in Home Assistant even if it is indeed offline

Hello,
I have a ESPhome powerd light, which is connected to a switchable power socket.
When the powersocket is turned off, the esp light is marked as unavailable in HomeAssistant, and I cannot “control” it. That is basically not wrong but unfortunately bad in my situation :slight_smile:

What I want to do:
I want to be able to “control” the esp light even if it is not power up and not available. I want to catch the event, power on the socket and reply the initial event to get proper light settings.
I do the same for my zigbee devices (zigbee2mqtt), where this is perfectly working.

Any way I can achive this?

Thanks
martin

Since Esphome is software and Esp in not a power supply, your description needs some fine tuning, a simple scheme would be the best.

Indeed, needs more clarity. Why would the socket be turned off?

As you expose it, a plain automation powering on the socket when the ESP becomes unavailable would do the trick.

Hello,
sorry, let me try to be a bit more precise :slight_smile:

I have power sockets which I can turn on and off. There are various triggers for this (leaving home, specific timeslots, etc.), so it can happen that a power socket is turned off, when I want to turn on something, which is connected to it, for instance a zigbee light. In home assistant I can still power on, adjust brightness, etc. on zigbee lights, even if they are not connected to the zigbee network (because they have not power, because power socket is turned off). This itself will of course not do anything (because of no power), but when adjusting such a light (not poweder on) I fetch the event in home assistant, power on the related power socket and send again the light.turn_on (I do this in an appdaemon app). So I can control the light via the home assistant light entity, even if the power socket is turned off. I simply do not need to care about it, because appdaemon turns power socket on for me.

I wanted to do the same with my esphome light, but the esphome light entity gets the status unavailable in home assistant and i cannot control (turn on/off, adjust brightness) in the home assistant dashboard for it. so there is no event I can catch.

For the sake of completness: With esphome light component I mean a simple esp8266 doing some pwm via a mosfet for leds. This thing is working fine.

Hope it is clear now?

cheers
martin

You could create a template light that turns on the power socket if it’s off, then turn on the underlying esphome device.

The only reason you can do this with zigbee is that there is a setting in both ZHA & Z2M which only marks mains powered devices as unavailable after some time has passed (default is 10 mins for Z2M and 2 hours for ZHA).

If you’re asking for the same setting to be applied to ESPHome, then a feature request would be the way forward.

Hello,
well actually I did not adjust these default values in Z2M, and the light entities do not become unavailable, as it is in esphome.

but yes, most likely it’s a feature request, or I need to work around somehow :slight_smile:

If anyone still has an idea or knows a setting in esphome or home assistant I’d be pretty happy to try it out.

thanks
martin