Automate away mode

I have been trying to wrap my head around the away/vacation mode. Doing some trail and error I have it partly working. At the moment I have this:

image

I am tracking persons using the companion app, and that seems to work pretty okay. Zone.home gives me the correct number of family members being at the house too. I made two groups that show whether everybody is home or somebody is home. The code for that looks like this:

somebody_home:
  name: Somebody is home
  entities:
    - device_tracker.huawei_p30_pro_van_con
    - device_tracker.opponancy
    - device_tracker.oppo_rik
  all: false
  
everybody_home:
  name: Everybody is home
  entities:
    - device_tracker.huawei_p30_pro_van_con
    - device_tracker.opponancy
    - device_tracker.oppo_rik
  all: true

These groups give me Home or Away status. Is it possible to use True or False instead? Now, based on either “somebody home” or “zone.home” I want to flip the “input_boolean.no_one_home_mode” to ON or OFF. I have tried this:

- id: '1682512656631'
  alias: Auto State ON nobody home
  description: ''
  trigger:
  - platform: state
    entity_id:
    - zone.home
    attribute: persons
    to: '0'
  condition: []
  action:
  - service: input_boolean.turn_on
    data: {}
    target:
      entity_id: input_boolean.no_one_home_mode
- id: '1682513575229'
  alias: Auto State OFF nobody home
  description: ''
  trigger:
  - platform: state
    entity_id:
    - zone.home
    attribute: persons
    from: '0'
  condition: []
  action:
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.no_one_home_mode

But it does not work. It won’t flip.
Due to the many different approaches I find it hard to choose the best one for this “easy” task.
Any ideas to what I need to do better?
Thanks!

The triggers in the automations don’t look right. Either state and somebody home, or numeric state and persons, surely?

I see what you mean. I changed it to this:

- id: '1682513575229'
  alias: Auto State OFF nobody home
  description: ''
  trigger:
  - platform: numeric_state
    entity_id:
    - zone.home
    attribute: persons
    from: '0'
  condition: []
  action:
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.no_one_home_mode

But the crazy thing is: no_one_home_mode is still not switching.

According to the docs, the state of a zone is a number representing the number of persons currently there - so I don’t think you need the attribute line.

trigger:
  - platform: numeric_state
    entity_id: zone.home
    above: 0
condition: []
action:
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.no_one_home_mode
mode: single

This is a common problem — the automation UI encourages the novice user to select an attribute, whereas it should be left blank when it’s the state under consideration.

@ConTS10 — why do you even need the input_boolean? Just use the fact that zone. home is '0'.