lovelace-paper-buttons-row
lovelace-paper-buttons-row copied to clipboard
Templating tap_action
I'm trying to template a tap_action to run different scripts based on the state of an entity
- type: custom:paper-buttons-row
buttons:
- entity: input_boolean.ac_fan_dryout_running
icon: mdi:hair-dryer
layout: icon|state
tap_action:
action: call-service
service_data: {}
target: {}
service: >
{% if is_state('input_boolean.ac_fan_dryout_running',
'off') %}
script.s_room_ac_fan_dryout_begin
{% else %}
script.s_room_ac_fan_dryout_cancel
{% endif %}
state_styles:
'on':
color: green
'off':
color: red
state_text:
'on': Cancel Dryout Sequence
'off': Begin Dryout Sequence
The error I get is "Failed to call service {% if is_state('input_boolean.ac_fan_dryout_running', 'off') %}"
Would this mean this feature is not implemented yet?
Yeah currently no part of the actions can be templated. It's a cool idea though so maybe in the future.
Ok thank you. No worries.
For anyone needing a fast solution, one workaround is to toggle a separate input boolean via the tap-action and running automations on that input boolean's state.
Another workaround and the one I'm going for, is to use 2 conditional cards to contain alternate versions of these button rows.