Custom:Button-Card. Different entity from Service

Hello Guys!
I am trying to have a button which I can press to toggle a boolean, which then starts to play music. I want the button to blink when the music is playing. All of this works just great, because the button checks the state of the boolean and reacts on that.
But if I am playing music from a different device, the boolean wont be toggled, which is fine aswell.
I want the button to compare the state to a different enttiy then from the service one. If I change the entity to a different one, it wont start the music.
So my question ist, if it is possible to have a different entity and a different tap_action service.

Welcome to the community. Please learn how to format code. Do not post pictures. Thanks.

Tap actions accept a call service configuration

tap_action:
  action: call-service
  service: switch.toggle
  service_data:
    entity_id: switch.xyz

This is covered in the action docs in the user interface area, here’s a quick link to them. There are many more action options.

1 Like

Sorry about the picture, I didnt know that.
The tap action itself works, it calls the boolean. But I want the state of the button Icon to be reffered to a different entity.
For example:
The button should blink when the lights are turned on, but if I press the button it plays Music.
If I change the entity to the one I like it to be, my button doesnt work correctly anymore. Only if my entity and the service is the same.

type: custom:button-card
entity: media_player.uberall
icon: mdi:music
size: 50%
aspect_ratio: 1/1
color: null
show_name: true
name: Musik
state:
  - value: 'on'
    color: '#e64c4c'
    styles:
      icon:
        - animation: blink 2s ease infinite
tap_action:
  action: call-service
  service: switch.toggle
  service-data:
    entity_id: input_boolean.randommusictoggle

I am getting the error message, that it must contain at least one of entity_id, device_id, area_id.

you’d need to use the input_boolean.toggle service for input_booleans. Not switch.toggle.

tap_action:
  action: call-service
  service: input_boolean.toggle
  service-data:
    entity_id: input_boolean.randommusictoggle

Put in in like that and I am still getting the same error message, that I have to provide an entity_id.

From the Developer Tools it works flawless like that:

service_data, not service-data, see my example:

I am so dumb…Thank you!