Home Assistant gives automations direct triggers for a completed update and for requests to restart Home Assistant or reboot its host. A routine can react to these events without maintaining template sensors to compare versions or infer a pending restart.
The update trigger fires after startup only when the version differs from the last run, and includes both version numbers. A restart request identifies the integrations asking for it. Separate conditions let routines check a request that already existed when the automation was enabled; enabling it does not fire an old request again.