Help with 'group' leaving home to trigger automation

I’m still getting my head around HA. I created a group of people in the configuration file and if
the status went from ‘home’ to ‘not home’ certain automations would trigger eg the lights would turn off when everyone left home. This has stopped working and last activated on 4th november so
something must have changed, What is the best way to get this to work?

Thanks

It makes it much easier to answer questions about a particular automation if you include they automation…

While groups used to be necessary for this kind of automation, in most cases you can now just trigger off the state of the Home zone. The state of a zone reflects the number of known persons currently occupying the zone, so if no one is home the state should be 0.

trigger:
  - platform: state
    to: 0
    entity_id: zone.home
condition: []
action:
...

Thanks, yes I realised I forgot to include just now - sorry, Drew. Thanks for the advice. I was wondering if groups had stopped working but I’ve set this up now so hopefully this will work

Any ideas why this isn’t triggering as this what I have come up with:

alias: Lights off when everyone leaves home zone before sunset
description: ""
trigger:
  - platform: state
    entity_id:
      - zone.home
    attribute: persons
    to: "0"
    for:
      hours: 0
      minutes: 5
      seconds: 0
condition:
  - condition: sun
    before: sunset
    after: sunrise
action:
  - service: light.turn_off
    data: {}
    target:
      entity_id:
        - light.hallway
        - light.living_room
        - light.kitchen
        - light.study
        - light.downstairs_toilet
        - light.landing
        - light.main_bathroom
        - light.charlies_room
  - service: notify.mobile_app_iphone
    data:
      message: The lights have turned off as everyone is away from home
      title: Lights turned off
      data:
        message: lights have been turned off as no one at home
mode: single

Because the attribute persons will never be “0”, you need to leave the attribute field blank so that the state is what is being monitored by the trigger.

Thanks, Drew