Groupe zone automation question

Hello, I want to switch off the watter heater when all person of the familly group are more than 100 km of the building, and switch on when one person is below 100km of the building.
I write a trigger but didn’t fire:

trigger:
  - platform: zone
    entity_id: group.family
    zone: zone.100km_zone
    event: leave

Can you tell me how to write the automation ?
Regards

Did you create the zone and automation when you were more than 100 km from home?

Yes I create it:

Thanks for your help !

That wasn’t really the question. When did you create the automation and zone, before or after you left the 100 km zone?

It was nobody at home from 15:09 to 19:39. Why at this time the status is 2 ?

The variable Famille is right: nobody at home from 15:09 to 19:39.

Whay the trigger didn’t fire ?

alias: "Plus de 100 km de la maison"
trigger:
  - platform: zone
    entity_id: group.family
    zone: zone.100km_zone
    event: leave

action:
  - service: switch.turn_off
    entity_id: switch.chauffe_eau

  - service: notify.gmail
    data:
      title: "Home assistant warning"
      message: "Thierry et Line à plus de 100 km de la maison"

Many thanks for your help !

You’re not answering my question, I’m not asking it for no reason.

I create the automation befor leaving 100 km zone.

I just noticed you have group.family.
I believe groups of device trackers become binary sensors.
What happens if you use person entities?

Hello,
Thanks for your reply,
I can use person instead of group of course.
So for switching on the water heater it is easy: if one person is present I start the water heater.
But for switching off the water heater it is needed to have nobody at home. How can I do that ?
Is the group of device tracker a bad idea ?

Thanks for helping me !

I’m not sure how zones work when they are nested so I can’t help with that but group is probably not going to work.

ok no problem.
Can you tell me how to fire the trigger if both persons leave the zone ?

thanks !

If you have one trigger when person A leaves and one trigger when person B leaves.
Then condition needs to be person A not in zone, and person B not in zone.

That means both will trigger but only when the last one has left will the action be performed