custom-cards / button-card

❇️ Lovelace button-card for home assistant
MIT License
1.93k stars 233 forks source link

tap_action or hold_action problem #474

Open JPOliveGit opened 3 years ago

JPOliveGit commented 3 years ago

Describe the bug I'm trying to make a button with custom button card when clicked toggle a switch, I copied the yaml from a button generated by the home assistant ui and when I paste the tap_action on the custom button it gives an error: fail to call service switch/toggle. sequence item 0: expected str instance, Optional found

type: button icon: 'mdi:garage-variant' tap_action: action: call-service service: switch.toggle service_data: {} target: device_id: b92d94491e208(continues)

Version of the card Version: 3.4.2

Matt-PMCT commented 3 years ago

If you take a look at the examples it has an example of a service call. I think your syntax is off a little, try this:

      tap_action:
        action: call-service
        service: switch.toggle
        service_data:
          entity_id: b92d94491e208(continues)