button-card icon indicating copy to clipboard operation
button-card copied to clipboard

A tap_action question.

Open Opontios opened this issue 3 years ago • 3 comments

Don't know if it's been already answered, but is it possible to define 2 different actions under tap_action, as 2 different call services? I tried any possible way that I could, but it isn't validated by the card editor. Thanks.

Opontios avatar Aug 18 '22 13:08 Opontios

This is what scripts are for. The example below gives you a button to perform actions for when you are not at home, like turning off the lights and the thermostat.

Card config:

type: custom:button-card
name: Not at home
tap_action:
  action: call-service
  service: script.not_at_home_actions

Script:

alias: Not at home actions
icon: mdi:script
mode: single
sequence:
  - service: light.turn_off
    data: {}
    target:
      entity_id: light.luca
  - service: climate.turn_off
    data: {}
    target:
      entity_id: climate.luca_thermostat

Wombosvideo avatar Sep 15 '22 10:09 Wombosvideo

I'm aware about the scripts. I wanted to know if it was possible to send 2 different service calls in the card config.

Opontios avatar Sep 15 '22 22:09 Opontios

I'm aware about the scripts. I wanted to know if it was possible to send 2 different service calls in the card config.

I think you need 'multi_calls', please see in my question body. (https://github.com/custom-cards/button-card/issues/620#issue-1387396576)

JayChun avatar Sep 28 '22 02:09 JayChun