Open sciurius opened 2 years ago
You could do something like
type: custom:button-card
entity: counter.door_counter
show_state: true
variables:
tap_action:
action: call-service
service: counter.increment
service_data:
entity_id: counter.door_counter
tap_action:
action: '[[[ return variables.tap_action.action; ]]]'
service: '[[[ return variables.tap_action.service; ]]]'
service_data: '[[[ return variables.tap_action.service_data; ]]]'
hold_action:
action: '[[[ return variables.tap_action.action; ]]]'
service: '[[[ return variables.tap_action.service; ]]]'
service_data: '[[[ return variables.tap_action.service_data; ]]]'
Then you only need to make your settings once, as a variable.
But I discovered that it is not necessary to define hold_action
if you want hold_action
to do the same as tap_action
. It is default behaviour that the tap_action
is also used as hold_action
if no hold_action
was defined.
sadly it's not possible to template tap_action
itself but only the action's properties...
It is default behaviour that the tap_action is also used as hold_action if no hold_action was defined.
This is not how I interpret the docs,
hold_action ... Define the type of action on hold, if undefined, nothing happens.
Is your feature request related to a problem? Please describe. My wife is handicapped and does not have very fine control over her muscles. It is difficult for her to push a UI button, not too long, not too short.
Describe the solution you'd like A simple way to instruct button-card to handle
long_tap_action
the same as a commontap_action
.Describe alternatives you've considered Copy (cut/paste) the
tap_action
YAML into thelong_tap_action
for each and every button... Doable but tedious and prone to errors.