Checking uptime or restarts does not fix it because this problem also appears if you reload automations in the configuration.
Also running into this issue as well. Automation will immediately trigger, including as soon as the automation is turned on if using initial_state: false
.
Anyone ever find a fix for this?
I still happily use the uptime timer and never reload automations (instead I always restart Homeassistant)
Since Home Assistant 2020.12.0, a fix is needed:
The way I have done it is this.
input_boolean:
homeassistant_booted:
name: Home Assistant has started up
initial: off
automation:
- alias: 'Hass Startup Notification'
initial_state: on
trigger:
- platform: homeassistant
event: start
action:
- service: notify.mobile_app_ios
data:
title: "HASS"
message: "Home Assistant started!"
- delay: '00:00:30'
- service: input_boolean.turn_on
data:
entity_id: input_boolean.homeassistant_booted
And then check input_boolean.homeassistant_booted
in the automations.
Hi all, sorry for digging this up, but I tried to use this solution and I get errors like this: In ‘numeric_state’: In ‘numeric_state’ condition: entity sensor.uptime state ‘2022-07-18T10:25:40+00:00’ cannot be processed as a number
The sensor was set up as described. Anyone else having this problem?
The uptime sensor back then was a duration in minutes that the server has been alive. The uptime sensor now is a time stamp when the server started. His post won’t work with that sensor.
replace that with:
{{((now() - as_datetime(states('sensor.uptime'))).seconds)|int > 60}}
for 1 minute