Automation not working when outside of home

Can somebody help me to find why this automation is not triggered when i am out of home?

- alias: Nessuno a Casa Spegni Luci
  trigger:
    platform: state
    entity_id:
      - group.all_devices
      - sensor.living_room_tado_mode
    to: not_home
#    for:
#      minutes: 3
  action:
    service: homeassistant.turn_off
    entity_id: group.all_lights

not_home needs to be in quotes.

Other than that is your presence detection working?

One more thing to bear in mind, if you’re not home but are in a defined zone (e.g. work), not_home won’t be true.
I personally changed it this way:

  condition:
    - condition: template
      value_template: '{{ states.group.all_devices.state != "home"}}'

^ that’s wrong. Grouped device trackers can only be home or not_home, that’s the point in not_home, so you are ‘anywhere but home’.

Ah thanks, I retract the above then, ( I had actually amended the code to replace my tracker to the group)
As far as I remember it still stands for actual individual trackers (actually took me a while to understand why some automations would work some days and not others)
Or is it too late and time for me to go to sleep?

Not sure with individual trackers tbh, I would like to think it would be the same because it’s a good idea to have a not_home state, but yeah, maybe that’s the point in group.all_devices, so you can track basically whether home is occupied or not, but the individual trackers only state to not_home if not in a predefined zone. Dunno :thinking:

Guess I just gave you a challenge / something to play about for later? :smiley:

Ha, I have enough problems with presence detection thanks to the ladies in my life insisting on using those ridiculous iPhone things, but by all means test away yourself and update the docs (which I’ve just discovered don’t answer this question, unless I’m missing something).

Lol. I’m pretty sure that was the one reason why one of my automations would not run. I’ll see if I have time to try this weekend. (I’ll most likely be busy setting up LED Strips though)

And for your ladies, simply install owntracks on their iPhone, I find it works better than using the app, though in my experience it requires an app restart once in a while (like 1-2 times a month)

Yeah, owntracks/similar is my next port of call when I can get them off facetime for long enough.

What are the possible states of that sensor tado? Is it looking for both of those to be not_home?

Try listing each with its own entity ID or make a condition that contains the requirement of the sensor state

Yes, my presence detection is working good… so you think it’s only about quotes the problem?

These are the automations regarding presence or not at home. Could it be possible to join all of them in only one automation?

- alias: Movimento al buio Accendi Luci salotto
  initial_state: true
  trigger:
    platform: state
    entity_id: binary_sensor.motion_sensor_158d0001a98a62
    to: 'on'
  condition:
  - condition: time
    after: 00:01:00
  - condition: sun
    before: sunrise
  action:
  - service: light.turn_on
    entity_id: light.gateway_light_7811dcb25b7c
    data:
      color_name: gold         
  - service: light.xiaomi_miio_set_scene
    entity_id: light.philips_salotto
    data:
      scene: '3'
  - delay: 00:01:00
  - service: light.turn_off
    entity_id:
      - light.gateway_light_7811dcb25b7c
      - light.philips_salotto

- alias: Nessuno a Casa Spegni Luci
  trigger:
    platform: state
    entity_id:
      - group.all_devices
      - sensor.living_room_tado_mode
    to: "not_home"
#    for:
#      minutes: 3
  action:
    service: homeassistant.turn_off
    entity_id: group.all_lights
    
- alias: Maurizio a Casa Accendi Luci
  trigger:
    platform: state
    entity_id: device_tracker.galaxy_s8
    to: "home"
  condition:
    condition: sun
    after: sunset
    after_offset: '+02:00:00'
  action:
    service: homeassistant.turn_on
    data:
      entity_id:  
        - light.yeelight_rgb_34ce008d0019
        - light.yeelight_rgb_34ce008b8362
        - light.gateway_light_7811dcb25b7c
      brightness: 254
      color_name: goldenrod

Tado follows only the people who has installed his application and tells if you are at home or away from home based on the distance from home you set on the app.

now with a little clarification

  - service: xiaomi_miio.light_set_scene
    entity_id: light.philips_ceiling
    data:
      scene: 4