Zone trigger not triggering

Hello, im trying to trigger this automation depending on which zone im currently in. As a state trigger i use my person.entity which has a device tracker on it that works, it changes state accordingly to the zone im in.
I dont want to have a “from” and “to” option as that would limit the automation

Someone on discord suggested to put down null, as then it would trigger on state changes only.
But unfortunately it does not trigger. Here is my code, does anyone have a working trigger ?
Thank you

alias: Arrived Kevin
description: ''
trigger:
  - platform: state
    entity_id:
      - person.kevin
    for:
      hours: 0
      minutes: 0
      seconds: 1
    from: 'null'
condition: []
action:
  - choose:
      - conditions:
          - condition: zone
            entity_id: person.kevin
            zone: zone.dollartree
        sequence:
          - service: tts.google_translate_say
            data:
              entity_id: media_player.living_room_display
              message: Kevin arrived at Dollartree.
          - service: light.turn_on
            data:
              brightness_pct: 100
              effect: Sine
              rgb_color:
                - 255
                - 180
                - 0
            target:
              entity_id: light.wled_infinty_cube
          - delay:
              hours: 0
              minutes: 0
              seconds: 15
              milliseconds: 0
          - service: script.stop_streaming
            data: {}
          - service: light.turn_off
            data: {}
            target:
              entity_id: light.wled_infinty_cube
      - conditions:
          - condition: zone
            entity_id: person.kevin
            zone: zone.kftea
        sequence:
          - service: tts.google_translate_say
            data:
              entity_id: media_player.living_room_display
              message: Kevin arrived at KFtea.
          - service: light.turn_on
            data:
              brightness_pct: 100
              effect: Sine
              rgb_color:
                - 255
                - 180
                - 0
            target:
              entity_id: light.wled_infinty_cube
          - delay:
              hours: 0
              minutes: 0
              seconds: 15
              milliseconds: 0
          - service: script.stop_streaming
            data: {}
          - service: light.turn_off
            data: {}
            target:
              entity_id: light.wled_infinty_cube
      - conditions:
          - condition: zone
            entity_id: person.kevin
            zone: zone.wallmart
        sequence:
          - service: tts.google_translate_say
            data:
              entity_id: media_player.living_room_display
              message: Kevin arrived at Wallmart.
          - service: light.turn_on
            data:
              rgb_color:
                - 255
                - 180
                - 0
              brightness_pct: 100
              effect: Sine
            target:
              entity_id: light.wled_infinty_cube
          - delay:
              hours: 0
              minutes: 0
              seconds: 15
              milliseconds: 0
          - service: script.stop_streaming
            data: {}
          - service: light.turn_off
            data: {}
            target:
              entity_id: light.wled_infinty_cube
      - conditions:
          - condition: zone
            entity_id: person.kevin
            zone: zone.brigitte
        sequence:
          - service: tts.google_translate_say
            data:
              entity_id: media_player.living_room_display
              message: Kevin arrived at Home.
          - service: light.turn_on
            data:
              rgb_color:
                - 255
                - 180
                - 0
              brightness_pct: 100
              effect: Sine
            target:
              entity_id: light.wled_infinty_cube
          - delay:
              hours: 0
              minutes: 0
              seconds: 15
              milliseconds: 0
          - service: script.stop_streaming
            data: {}
          - service: light.turn_off
            data: {}
            target:
              entity_id: light.wled_infinty_cube
      - conditions:
          - condition: zone
            entity_id: person.kevin
            zone: zone.costco
        sequence:
          - service: tts.google_translate_say
            data:
              entity_id: media_player.living_room_display
              message: Kevin arrived at Costco.
          - service: light.turn_on
            data:
              rgb_color:
                - 255
                - 180
                - 0
              brightness_pct: 100
              effect: Sine
            target:
              entity_id: light.wled_infinty_cube
          - delay:
              hours: 0
              minutes: 0
              seconds: 15
              milliseconds: 0
          - service: script.stop_streaming
            data: {}
          - service: light.turn_off
            data: {}
            target:
              entity_id: light.wled_infinty_cube
      - conditions:
          - condition: zone
            entity_id: person.kevin
            zone: zone.kfc
        sequence:
          - service: tts.google_translate_say
            data:
              entity_id: media_player.living_room_display
              message: Kevin arrived at KFC.
          - service: light.turn_on
            data:
              rgb_color:
                - 255
                - 180
                - 0
              brightness_pct: 100
              effect: Sine
            target:
              entity_id: light.wled_infinty_cube
          - delay:
              hours: 0
              minutes: 0
              seconds: 15
              milliseconds: 0
          - service: script.stop_streaming
            data: {}
          - service: light.turn_off
            data: {}
            target:
              entity_id: light.wled_infinty_cube
      - conditions:
          - condition: zone
            entity_id: person.kevin
            zone: zone.amazon
        sequence:
          - service: tts.google_translate_say
            data:
              entity_id: media_player.living_room_display
              message: Kevin arrived at Amazon.
          - service: light.turn_on
            data:
              rgb_color:
                - 255
                - 180
                - 0
              brightness_pct: 100
              effect: Sine
            target:
              entity_id: light.wled_infinty_cube
          - delay:
              hours: 0
              minutes: 0
              seconds: 15
              milliseconds: 0
          - service: script.stop_streaming
            data: {}
          - service: light.turn_off
            data: {}
            target:
              entity_id: light.wled_infinty_cube
      - conditions:
          - condition: zone
            entity_id: person.kevin
            zone: zone.brigitte_s_parents
        sequence:
          - service: tts.google_translate_say
            data:
              entity_id: media_player.living_room_display
              message: Kevin arrived at memee.
          - service: light.turn_on
            data:
              rgb_color:
                - 255
                - 180
                - 0
              brightness_pct: 100
              effect: Sine
            target:
              entity_id: light.wled_infinty_cube
          - delay:
              hours: 0
              minutes: 0
              seconds: 15
              milliseconds: 0
          - service: script.stop_streaming
            data: {}
          - service: light.turn_off
            data: {}
            target:
              entity_id: light.wled_infinty_cube
    default: []
mode: single

This is null:

    from:

This is the string ‘null’

    from: 'null'

They are not the same.

Use the first one.

Also I think it might have to be a null to: rather than from: to prevent attribute changes triggering the automation. So, use this:

trigger:
  - platform: state
    entity_id:
      - person.kevin
    for:
      hours: 0
      minutes: 0
      seconds: 1
    to:

Thank you Tom,

I will try this one and leave an update when i can test it out.

when i try to change it via automations, i can edit it in yaml but it gives me the following

platform: state
entity_id:
  - person.kevin
for:
  hours: 0
  minutes: 0
  seconds: 1
to: null

i can not remove the null it keeps putting it back in automatically

This is fine:

to: null

This is not:

to: 'null'

Ok, thanks Tom. I’ll mark it as solved when i get to test it.

1 Like