#Condition to check if system is being restarted? or other solution to problem?

1 messages · Page 1 of 1 (latest)

glacial venture
#

So i have an issue that when i reboot home assistant it triggers an automation that runs when presence changes from detected to clear on a sensor which adjusts lighting. i imagine that this is because it shuts down the esphome integration before the automation stuff and the light controlling stuff which then triggers it when its disconnected. but when it comes back up it doesnt trigger the reverse automation. so i am left sat in the dark...

any ideas on stopping the automation from starting if the system is going down for reboot? is there a flag somewhere i can check with a template condition perhaps?

its a minor inconvenience really as i am not really restarting a lot and if i am i can disable the automation. but i feel like there is probably a solution but i haven't found it as of yet. Its just a pain when i update a couple of integrations and end up in the dark...

dull folio
#

In your light changing automation triggers, make sure you have both a from and a to. That should prevent it from triggering when the binary sensor goes unavailable.

#

But, to the actual question, I have an input_boolean that gets set as the first action in my HA stop automation and then gets turned off as the last action in my HA start automation. I use it kinda for the same thing. Since it only gets turned off after HA fully starts up, it’s a good condition for some of my weirder automations.

glacial venture
glacial venture
dull folio
# glacial venture I have set both from and to, it doesnt seem to work. maybe its a quirk on how th...

I don't think it's the integration per se and the entites, once created, are just entities. the ESPHome integration really isn't doing anything special at that point. I have a bunch of mmWave sensors through the integration and I don't see the behavior you are. BUT, I also use from: "on/off" and to: "on/off" in all my automations that use them. So, I'm not sure what's going on with yours. Feels weird.

glacial venture
dull folio
#

Huh. Yeah... Do you have any of the traces from when you restart HA and the automatino fires when it shouldn't?

glacial venture
#

give me a moment ill restart it now

#

there is no trace

dull folio
#

But it ran?

glacial venture
#

and i was plunged into darkness to prove it

dull folio
#

hahaha... sorry... that sucks (but still kinda funny)

#

What version of HA are you on?

glacial venture
#

yeah, its not without its humour

#

fully up to date

#

i have had this before this version though. its just i have been putting off trying to fix it. so its not a new thing

#

ah, i think i have found the issue. so the sensor that its triggered from is a helper which i think is the issue

dull folio
#

Huh... interesting... which helper is it?

glacial venture
#

so if the actual sensors goes != on e.g. unavailable then it shows clear

#

so its not the automation not beinmg to/from thats the issue. its the helper

#

same problem different location

dull folio
#

Yup. You'd need to adjust the template to ignore unavailable and unknown.

glacial venture
#

yeah. just need to remember how to do that. I made this helper a long time ago... i have something to work with now anyway

#

thanks for talking the problem through with me. helped me realise the issue if not directly

#

i took a lazy solution until i can be bothered to do it correctly 😛