Automation based on other event

Hi,
I have tried to build an automation based on the event “anyone at home?”.

The event: arrivo_primo_a_casa works well

image

but the automation “Benvenuti a casa”, that should start if the above event occurs, not.

alias: Benvenuti a Casa
description: ""
trigger:
  - platform: event
    event_type: arrivo_primo_a_casa
    context:
      user_id:
        - eef6ee10995a4255aa11bc525eb45cdd
        - 1f46317b578f4d8ba0ab79555b45c481
condition: []
action:
  - service: media_player.play_media
    target:
      entity_id: media_player.casa
    data:
      media_content_id: media-source://radio_browser/283c064d-25f4-487c-a47e-6d919ca09eeb
      media_content_type: audio/mpeg
    metadata:
      title: Kiss kiss italia
      thumbnail: ""
      media_class: music
      children_media_class: null
      navigateIds:
        - {}
        - media_content_type: app
          media_content_id: media-source://radio_browser
        - media_content_type: music
          media_content_id: media-source://radio_browser/country/IT
  - service: notify.mobile_app_iphone_di_solarflor
    data:
      message: Benvenuti a Casa
mode: single

What was wrong?
thanks

Maybe I just used the wrong trigger event.
the correct one problably is:

event_type: group.anyone_at_home

Let’s see. I will let you know

none of the two works.
any suggestion?

Why not just use the state of group.anyone_at_home?

You haven’t clearly explained what you are trying to do or what conditions need to be met.

That does not look like a normal event…

If you are just trying to trigger when the first person comes home, you can use either the state of the group as Taras suggested or use a Numeric state trigger based on zone.home like:

trigger:
  - platform: numeric_state
    above: 0
    entity_id: zone.home

The appropriate choice for your automation depends on what other conditions need to be met.

Hello,
thanks to both.
What I would like to do is to start my google nest as soon as I or my wife will arrive at home.

Thanks to Henrik Sozzi I used some of his scipts

alias: Persone - Evento - Rientro del primo a casa
description: Chiama l'evento rientro del primo a casa
trigger:
  - platform: state
    entity_id: group.anyone_at_home
    to: "on"
action:
  - event: arrivo_primo_a_casa

So, if I have understood well, the suggestion is to use the state of the entity group.anyone_at_home as trigger and not the event: arrivo_primo_a_casa.

Is my understanding correct?

If group.anyone_at_home is composed of only person and/or device_tracker entities it will have a state of home not on.

If you two are the only tracked people in your HA instance, you can use the state of zone.home as shown in my previous post. Otherwise use the state of the group.