Trigger home/away not working

I put a badge on my screen, which mention correctly if I’m home or not

Schermafbeelding 2021-12-22 123354

And a toggle which should do the same (indicating if I’m home)…

Schermafbeelding 2021-12-22 111355

Unfortunately the toggle doesn’t react on the 2 triggers I made…why ? Maybe one trigger is enough, but I’m newby…

alias: Zet Christian als thuis
description: ''
trigger:
  - platform: state
    entity_id: person.christian
    to: HOME
    from: AWAY
condition:
  - condition: state
    entity_id: input_boolean.toggle_christian_is_thuis
    state: 'off'
action:
  - condition: state
    entity_id: input_boolean.toggle_christian_is_thuis
    state: 'on'
mode: single

alias: Zet Christian als weg
description: ''
trigger:
  - platform: state
    entity_id: person.christian
    to: AWAY
    from: HOME
condition:
  - condition: state
    entity_id: input_boolean.toggle_christian_is_thuis
    state: 'on'
action:
  - condition: state
    entity_id: input_boolean.toggle_christian_is_thuis
    state: 'off'
mode: single

Because the states is not HOME or AWAY, it’s home or not_home.
Always look in developer tools for correct states, Lovelace is not a good place to look at states since it will write them differently sometimes.

Keep in mind that not_home means not in any zone. So if you create a zone called work then you will be in work and not not_home

1 Like

Thanks for the developer tools tip, I’ll keep that in mind.
I’ve omitted the “from” part, because I don’t think it matters here.
I have only the home zone defined for the moment.
Unfortunately it still doesn’t work… (even when I remove the condition-part)

alias: Zet Christian als thuis
description: ''
trigger:
  - platform: state
    entity_id: person.christian
    to: home
condition:
  - condition: state
    entity_id: input_boolean.toggle_christian_is_thuis
    state: 'off'
action:
  - condition: state
    entity_id: input_boolean.toggle_christian_is_thuis
    state: 'on'
mode: single
alias: Zet Christian als weg
description: ''
trigger:
  - platform: state
    entity_id: person.christian
    to: not_home
condition:
  - condition: state
    entity_id: input_boolean.toggle_christian_is_thuis
    state: 'on'
action:
  - condition: state
    entity_id: input_boolean.toggle_christian_is_thuis
    state: 'off'
mode: single

Is the automation created in UI or in file explorer?

In UI
I already cleared the cache of my browser, but it stil doesn’t work :thinking:

With a device it’s OK (turns on and off the light)

alias: Test - home
description: ''
trigger:
  - platform: state
    entity_id: person.christian
    to: home
condition: []
action:
  - type: turn_on
    device_id: 7a74e8a0e5c59427d4dd08b85a25577b
    entity_id: switch.sfeerverlichting_dressoir
    domain: switch
mode: single

alias: Test - Away
description: ''
trigger:
  - platform: state
    entity_id: person.christian
    to: not_home
condition: []
action:
  - type: turn_off
    device_id: 7a74e8a0e5c59427d4dd08b85a25577b
    entity_id: switch.sfeerverlichting_dressoir
    domain: switch
mode: single

Found it !

It must be

  - service: input_boolean.toggle
    entity_id: input_boolean.toggle_christian_is_thuis

The reason I asked is because condition as action is not supported in UI:

I didn’t see that earlier but you should be using the call service functions as I see you found now while I was typing.

Thank you for your help…learning a lot :grinning: