Hi Guys - Brand new to Home Assistant, read the docs and jumped straight in. I’ve tried to implement the presence ‘feature’ Here and run into an issue, the error I’m getting is:
Invalid config for [automation]: invalid template (TemplateSyntaxError: Expected an expression, got ‘end of statement block’) for dictionary value @ data[‘action’][0][‘data_template’][‘entity_id’]. Got None
invalid template (TemplateSyntaxError: Expected an expression, got ‘end of statement block’) for dictionary value @ data[‘action’][0][‘data_template’][‘option’]. Got None. (See /config/configuration.yaml, line 29). Please check the docs at https://home-assistant.io/components/automation/
The template detail I’ve added is below and line 29 (which I’ve not changed so can’t be the issue) is group: !include groups.yaml:
sensor:
# Weather prediction
- platform: yr
- platform: template
sensors:
kevin_status:
value_template: '{{ states.input_select.kevin_status_dropdown.state }}'
friendly_name: 'Kevin'
wendy_status:
value_template: '{{ states.input_select.wendy_status_dropdown.state }}'
friendly_name: 'Wendy'
luke_status:
value_template: '{{ states.input_select.luke_status_dropdown.state }}'
friendly_name: 'Luke'
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
Any pointers would be really appreciated TIA
The error is in one of your automations. If you don’t have any automations directly in configuration.yaml, then what’s in automations.yaml?
- alias: Mark person as just arrived
trigger:
- platform: state
entity_id: device_tracker.kevin_iphone
from: 'not_home'
to: 'home'
- platform: state
entity_id: device_tracker.wendy_iphone
from: 'not_home'
to: 'home'
- platform: state
entity_id: device_tracker.lukes_iphone
from: 'not_home'
to: 'home'
action:
- service: input_select.select_option
data_template:
entity_id: >
{% if trigger.entity_id == 'device_tracker.kevin_iphone' %}
input_select.kevin_status_dropdown
{% elif %}
input_select.wendy_status_dropdown
{% elif %}
input_select.luke_status_dropdown
{% endif %}
option: >
{% if trigger.entity_id == 'device_tracker.kevin_iphone' %}
{% if states.input_select.kevin_status_dropdown.state == 'Just Left' %}
Home
{% elif %}
Just Arrived
{% endif %}
{% elif %}
{% if states.input_select.wendy_status_dropdown.state == 'Just Left' %}
Home
{% elif %}
Just Arrived
{% endif %}
{% elif %}
{% if states.input_select.luke_status_dropdown.state == 'Just Left' %}
Home
{% elif %}
Just Arrived
{% endif %}
{% endif %}
#==============================================================================
- alias: Mark person as home
trigger:
- platform: state
entity_id: input_select.kevin_status_dropdown
to: 'Just Arrived'
for:
minutes: 10
- platform: state
entity_id: input_select.wendy_status_dropdown
to: 'Just Arrived'
for:
minutes: 10
- platform: state
entity_id: input_select.luke_status_dropdown
to: 'Just Arrived'
for:
minutes: 10
- platform: state
entity_id: input_select.kevin_status_dropdown
from: 'Just Left'
to: 'Just Arrived'
- platform: state
entity_id: input_select.wendy_status_dropdown
from: 'Just Left'
to: 'Just Arrived'
- platform: state
entity_id: input_select.luke_status_dropdown
from: 'Just Left'
to: 'Just Arrived'
action:
- service: input_select.select_option
data_template:
entity_id: >
{% if trigger.entity_id == 'input_select.kevin_status_dropdown' %}
input_select.kevin_status_dropdown
{% elif %}
input_select.wendy_status_dropdown
{% elif %}
input_select.luke_status_dropdown
{% endif %}
option: Home
- alias: Mark person as just left
trigger:
- platform: state
entity_id: device_tracker.kevin_iphone
from: 'home'
to: 'not_home'
- platform: state
entity_id: device_tracker.wendy_iphone
from: 'home'
to: 'not_home'
- platform: state
entity_id: device_tracker.lukes_iphone
from: 'home'
to: 'not_home'
action:
- service: input_select.select_option
data_template:
entity_id: >
{% if trigger.entity_id == 'device_tracker.kevin_iphone' %}
input_select.kevin_status_dropdown
{% elif %}
input_select.wendy_status_dropdown
{% elif %}
input_select.luke_status_dropdown
{% endif %}
option: Just Left
- alias: Mark person as away
trigger:
- platform: state
entity_id: input_select.kevin_status_dropdown
to: 'Just Left'
for:
minutes: 10
- platform: state
entity_id: input_select.wendy_status_dropdown
to: 'Just Left'
for:
minutes: 10
- platform: state
entity_id: input_select.luke_status_dropdown
to: 'Just Left'
for:
minutes: 10
action:
- service: input_select.select_option
data_template:
entity_id: >
{% if trigger.entity_id == 'input_select.kevin_status_dropdown' %}
input_select.kevin_status_dropdown
{% elif %}
input_select.wendy_status_dropdown
{% elif %}
input_select.luke_status_dropdown
{% endif %}
option: Away
- alias: Mark person as extended away
trigger:
- platform: state
entity_id: input_select.kevin_status_dropdown
to: 'Away'
for:
hours: 24
- platform: state
entity_id: input_select.wendy_status_dropdown
to: 'Away'
for:
hours: 24
- platform: state
entity_id: input_select.luke_status_dropdown
to: 'Away'
for:
hours: 24
action:
- service: input_select.select_option
data_template:
entity_id: >
{% if trigger.entity_id == 'input_select.kevin_status_dropdown' %}
input_select.kevin_status_dropdown
{% elif %}
input_select.wendy_status_dropdown
{% elif %}
input_select.luke_status_dropdown
{% endif %}
option: Extended Away
Your elif’s don’t have any expressions.