What am I doing wrong here? I could of course split this into two automations, but it’s more fun to have it in one
alias: Driveway Lamp On/Off
trigger:
- entity_id: binary_sensor.dark_outside
platform: state
action:
- data:
message: >-
Dark Outside changed state to {{ states("binary_sensor.dark_outside") }} because of a combination of these values: {{ '\n' -}}
- Sun Elevation is {{ state_attr("sun.sun","elevation") }} {{ '\n' -}}
- OWM Cloud Coverage is {{ states("sensor.owm_cloud_coverage") }}
service: notify.mainplatform
- service: >-
{% if (is_state("binary_sensor.dark_outside","on")) -%}
script.driveway_lamp_high
{%- else -%}
script.driveway_lamp_off
{%- endif %}
The error I get is:
Invalid config for [automation]: Service {% if (is_state(“binary_sensor.dark_outside”,“on”)) -%}
script.driveway_lamp_high
{%- else -%}
script.driveway_lamp_off
{%- endif %} does not match format . for dictionary value @ data[‘action’][1][‘service’]. Got None. (See ?, line ?).
Since there is no service.execute which I could use, and then pass the name of the specific script to run in a data part, I’m a bit stuck here…