#Prevent automation from running on HAOS restart?
1 messages · Page 1 of 1 (latest)
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
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
Yeah if not_from doesn't help there you'll need a workaround
Im not even aware of the not_from parameter. Will have to read up on that
It's a sneaky secret one, you can only add it via yaml
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
Why not use the uptime entity?
Oh! I wasn’t aware of that entity! Gonna check it out! Thx a lot
It's provided by the uptime integration
Yeah, I got that entity. Does it store uptime in seconds or minutes?
On mobile right now
Ah, it’s a datetime
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)
Yeah, did just that right now. This will help a lot. Thx so much. Definetly a lightweight approach to solving this
Bitteschön ♥️