Good evening!
For logging purposes I would like to know the user who restarted HA.
Here I found a nice method to understand the type of HA shutdown.
Since I already have an automation that triggers when HA reboots (and I would like to avoid creating one for when shutdown) I thought of something like this:
- trigger:
- platform: homeassistant
event: shutdown
sensor:
name: "autore_ultimo_riavvio_piattaforma"
icon: mdi:information-variant-circle-outline
state: "{{ user_info(trigger.event.context.user_id).name}}"
In order to record in the sensor the user who requested the reboot and go and read it in the reboot automation.
But the state is: unknown
Same in:
state: "{{ trigger.event.context.user_id}}"
Where I’m wrong?
2 posts - 2 participants