Automation last_boot

Hello,
I reboot my RPi then Homeassistant start
I need to restart only one time homeassistant with homeassistant.service restart.
my problem is in condition:
I need: if sensor.last_boot < 50 seconds
then action:
‘- service: homeassistant.restart’

how I do the correct condition
thanks

last_boot is timestamp 2019-09-03T23:48:42+01:00

This is not an answer, but why do you need to restart Home Assistant after reboot?

One idea is to use an uptime sensor and build your automation on that, i.e. grab the current system uptime (not the Home Assistant uptime sensor)

sensor:
  - platform: command_line
    name: sys_uptime
    command: awk '{print $1}' /proc/uptime

This will give you the system uptime in seconds.

Hello, my card weather forecast api IPMA is every time lost after reboot but if i do an restart in HA it will be ok and display the weather.
I think the service request for weather is to soon when i reboot.

ok. How are you running Home Assistant, hass.io, docker etc.? You could try adding a delay before the Home Assistant service starts.

I’m in Venv on RPI3.
How can i test the delay?
Best regards, Nelson

That’s easy. Edit your home-assistant.service file. The file is located in /lib/systemd/system.
Between the [Service] line and the ExecStart line, add a delay, for example,
ExecStartPre=-/bin/sleep 30

This will delay the start of Home Assistant for 30 seconds.
After editing the file, you need to reload it with

sudo systemctl daemon-reload

And then restart Home Asssistant with

sudo systemctl restart home-assistant

Hello, Tomas.
Many thanks, the delay resolved . The servisse it’s located in /etc/systemd/system/

just another question:
how can I test in automation condition sensor.uptime (value in seconds) > 30 then action……

Ah, yes, a different location from Ubuntu which I am running.