Hello.
I’m struggling with an Entity Button Card Configuration. I would like to do one thing if the light is already on, and another thing if it’s off. Kind of like toggle, except “turning on” and “turning off” are scripts. I’m trying to solve this with using templates, but I don’t know if I get it all wrong, or if templates aren’t supported in this case.
Here’s the entity button card configuration:
type: entity-button
tap_action:
action: call-service
service: |
{% if is_state('light.color_light_1', 'on') %}
script.1573422009426
{% else %}
script.1573422362904
{% endif %}
hold_action:
action: call-service
service: script.1573422080784
show_icon: true
show_name: true
entity: light.color_light_1
name: Nattbord
icon_height: 24px
theme: Backend-selected
The configuration editor keeps changing my ‘>’ for a ‘|’ after saving for some reason. Not quite sure what either of those really mean.
Edit: When clicking it, I get the error Failed to call service {% if is_state( ... ) %} script. Service not found.
.
Any suggestions?