I have been using device tracker to indicate home or away for a while now. Using Phil Hawthorne’s code https://philhawthorne.com/making-home-assistants-presence-detection-not-so-binary/
I have now add life360 and want to use the zones function to show where I am. This all works well but it has broken the startup automation.
There are 2 automations triggered at startup one for home and one for not_home that set the input select to Home or Away
- alias: set me home at startup
trigger:
- platform: homeassistant
event: start
condition:
condition: and
conditions:
- condition: state
entity_id: 'device_tracker.me'
state: 'home'
action:
- service: input_select.select_option
data_template:
entity_id: input_select.me_status_dropdown
option: Home
Now with zones the Device tracker state can be home or (any number of zone names)
My automation is now
- alias: set me home at startup
trigger:
- platform: homeassistant
event: start
action:
- service: input_select.select_option
data_template:
entity_id: input_select.me_status_dropdown
option: Home
How can I change the option: line to select Home when the device tracker is ‘home’ and Away for any other value
I tried this
option: "{%if device_tracker.me == 'home' %}\n Home\n\
{% else %}\n Away\n{%endif}\n"
but it just give an error when I check the config.