Turn off Generic Thermostat when away

I am using a Scheduler to change the target temperature of the Generic Thermostat at different times of the day/week - I believe this means using the “away_temp” parameter will interrupt the scheduled temperatures, because in theory when I return home the temperature will go to the “target_temp” rather than the previous temperature set by the Scheduler?

So rather than set “away_temp” when away I want to turn the heating off.

I’ve tried to create an automation (is this the right thing to do?) with the below values that I assume should trigger when the house has no one present so “Away”. It doesn’t seem to work - any advice would be welcome!

Or is there a better way to go about this?

In an ideal world there would be an “Away” temperature and a “Home” temperature.
When “Away” the thermostat uses that temp, when “Home” it uses the home temperature which the Scheduler can change accordingly.

- id: '1665944585134'
  alias: Thermostat - Away Mode
  description: ''
  trigger:
  - platform: state
    entity_id: group.all_devices
    to: not_home
  condition: []
  action:
  - service: climate.set_operation_mode
    entity_id: climate.thermostat
    data:
      operation_mode: 'OFF'
  mode: single

A small change to pick a specific person (me) works great.
Is it possible to either select the whole house or all people?

I haven’t created “group.all_devices” - is that the issue?

Working automation for a single person

- id: '1665944585134'
  alias: Thermostat - Away Mode
  description: ''
  trigger:
  - platform: state
    entity_id:
    - person.ant
    to: not_home
  condition: []
  action:
  - data:
      entity_id: climate.thermostat
    service: climate.turn_off

Sorted - using the home state going from to and from 0 works great.

- id: '1665947626472'
  alias: Thermostat - Away Mode
  description: ''
  trigger:
  - platform: state
    entity_id:
    - zone.home
    to: '0'
  condition: []
  action:
  - data:
      entity_id: climate.thermostat
    service: climate.turn_off
  mode: single
- id: '1665947764354'
  alias: Thermostat - Home Mode
  description: ''
  trigger:
  - platform: state
    entity_id:
    - zone.home
    from: '0'
  condition: []
  action:
  - service: climate.turn_on
    data: {}
    target:
      entity_id: climate.thermostat
  mode: single