#Prevent automation from running on HAOS restart?

1 messages · Page 1 of 1 (latest)

flint lintel
#

Hello everybody,
I am currently struggling with automations that run on HAOS restart. Probably cause the trigger values they depend on get set by the underlying integration on HAOS start. Is there any way to prevent automations from running on reboot?

Thx in advance

tough yoke
#

Not easily/generically unfortunately. You might be able to get away with "not_from: unknown/unavailable" on a state trigger, but it depends how the integration works.
I just try to ensure my automations are written in a way such that running an extra time doesn't change anything

flint lintel
#

Ok, so it seems there are triggers for when HA starts or is shutting down. I could use that to set a helper variable and control this… maybe

#

I could start a timer on HA reboot and, about 15 minutes later, reset the broken helpers to the intended values

#

I have an automation that uses another helper (datetime) to increase another helper (input_number) by the delta from now to that datetime helper in minutes. This is triggered by the power of a zigbee2mqtt connected power socket. Unfortunately this also gets triggered on HA reboot and results in unrealistic values. So, I think I’ll just have to reset that broken value

tough yoke
#

Yeah if not_from doesn't help there you'll need a workaround

flint lintel
#

Im not even aware of the not_from parameter. Will have to read up on that

tough yoke
#

It's a sneaky secret one, you can only add it via yaml

flint lintel
#

That’s fine with me. Unfortunately the „from“ is the same for all situations. I think I’ll handle it another way now by setting the datetime to a very specific datetime once I did use the value in my formulae and will then ignore the trigger when the datetime has that specific value. Should work

hazy haven
#

Why not use the uptime entity?

flint lintel
hazy haven
flint lintel
#

Yeah, I got that entity. Does it store uptime in seconds or minutes?

#

On mobile right now

#

Ah, it’s a datetime

hazy haven
#

2024-12-09T21:16:23+00:00

is what I have on my system

#

I'd convert it into a timestamp and subtract it from the current timestamp which will yield the uptime in seconds

#

And then you can add a condition to the automation(s) that require the uptime to be at least 900 seconds (or whatever time suits you)

flint lintel
#

Yeah, did just that right now. This will help a lot. Thx so much. Definetly a lightweight approach to solving this

hazy haven
#

Bitteschön ♥️