How to know the author of HA reboot?

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?

Refer to the table in the following post:

Unless the triggering source was via the UI, the value of user_id is normally null (none).

Also, are you certain that the trigger object produced by a Homeassistant Trigger contains an event property?

trigger.event.context.user_id
        ^^^^^