Action for Dashboard - Call Service on Different Entity

Hi All,

I’m creating my own dashboard and would love some help. I want this one card to show the status of one sensor (garage door binary open/close binary sensor), but when I click it, i want it to call a service on a different entity (the switch that controls the garage door). I think i just have a syntax issue but I can’t figure it out anywhere. Thanks! Here is my code:

 - entity: binary_sensor.garage_door_house_status
    name: Garage House
    value: mdi:garage
    color: white
    map_state:
      'on':
        color: yellow
        value: mdi:garage-open
      unavailable:
        color: black
    action:
      service: cover.open_cover
      service_data:
        entity: cover.garage_door_house
 

here is the error i get when i run it:
Failed to call service cover/open_cover. extra keys not allowed @ data[‘service_data’]

Depending on the card you use (which one ?), but try this instead of “action:”:

  - entity: binary_sensor.garage_door_house_status
    name: Garage House
    value: mdi:garage
    color: white
    map_state:
      'on':
        color: yellow
        value: mdi:garage-open
      unavailable:
        color: black
    tap_action:
      action: call-service
      service: cover.open_cover
      service_data:
        entity_id: cover.garage_door_house

Thanks so much.

It’s a custom banner card (type: custom:banner-card).

No dice though.

When I tried your code and clicked the icon, it just brought me to the entity settings, but didn’t call the service.

Do you respect the correct indentation ? Whats your code for that card ? Please share… Thank you

I think my indentation is right, but def could be wrong. code below.

type: custom:banner-card
heading: Garage
link: garage
entities:
  - entity: light.garage_main_light
    value: mdi:lightbulb-outline
    color: white
    map_state:
      'on':
        value: mdi:lightbulb
        color: yellow
    action:
      service: light.toggle
  - entity: light.garage_center_light
    value: mdi:lightbulb-outline
    color: white
    map_state:
      'on':
        value: mdi:lightbulb
        color: yellow
    action:
      service: light.toggle
  - entity: binary_sensor.inner_garage_door_status
    name: Inner Garage
    value: mdi:door
    color: white
    map_state:
      'on':
        color: yellow
        value: mdi:door-open
      unavailable:
        color: black
  - entity: binary_sensor.garage_door_house_status
    name: Garage House
    value: mdi:garage
    color: white
    map_state:
      'on':
        color: yellow
        value: mdi:garage-open
      unavailable:
        color: black
    tap_action:
      action: call-service
      service: cover.open_cover
      service_data:
        entity_id: cover.garage_door_house
  - entity: binary_sensor.garage_door_hoop_status
    name: Garage Hoop
    value: mdi:garage
    color: white
    map_state:
      'on':
        color: yellow
        value: mdi:garage-open
      unavailable:
        color: black

Hi @RMR414 ,

Try target instead of service_data

    tap_action:
      action: call-service
      service: cover.open_cover
      target:
        entity_id: cover.garage_door_house

OK now it is clear as we have the type of card you use…
tap_action is not the appropriate way to do it (I just read the documenattion of the banner card).

you have to use:

action:
  service:

The problem (as far as I understand the documentation) is that this service is applied on the entity defined in the card… but you have a binary_sensor (binary_sensor.garage_door_house_status)… so the command cover.open_cover will not work on a binary sensor… You have to replace the binary_sensor by the entity cover.garage_door_house. I understand that in this case the layout/behaviour of the card is different… but this should work