The or
operator is case sensitive:
- service_template: >
{% if is_state('device_tracker.pal_presence', 'home') or is_state('device_tracker.eva_presence', 'home') %}
^^
'Lower case'
However you have no else statement so the service could end up being empty and generate an error. You would be better off using the choose
action.
action:
- choose:
- conditions:
- condition: template
value_template: "{{ is_state('device_tracker.pal_presence', 'home') or is_state('device_tracker.eva_presence', 'home') }}"
sequence:
- service: script.adults_coming_home
- other actions here if you have them.
This could also be written without templates (but is considerably more verbose):
action:
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: device_tracker.pal_presence
state: home
- condition: state
entity_id: device_tracker.eva_presence
state: home
sequence:
- service: script.adults_coming_home
- other actions here if you have them.
If you don’t have other actions after the call to the script, I think you can simplify it to this, but have seen people have issues with using a condition as the first action:
action:
- condition: template
value_template: "{{ is_state('device_tracker.pal_presence', 'home') or is_state('device_tracker.eva_presence', 'home') }}"
- service: script.adults_coming_home
If that is the case you could fudge it with:
action:
- delay: '00:00:01'
- condition: template
value_template: "{{ is_state('device_tracker.pal_presence', 'home') or is_state('device_tracker.eva_presence', 'home') }}"
- service: script.adults_coming_home
The other option is to use an automation using either a template trigger or two state triggers, and the script (or it’s contents) as the action.