Getting a failed to call service not found when trying to toggle an entity

I am trying to control a Lutron scene. The auto generated file has an entity toggle with the record of:

type: entities
entities:
  - switch.left_room_shades_down
  - switch.left_room_shades_up
  - switch.middle_room_shades_down
  - switch.middle_room_shades_up
  - switch.right_room_shades_down
  - switch.right_room_shades_up

But when I create a new card and I click on it, I get the error “failed to call service, service not found”

  - type: horizontal-stack
    cards:
      - type: button
        tap_action:
          action: toggle
        entity: scene.middle_room_screen_scenes_left_projector_dn
        name: Left Room Projector Down
      - type: button
        tap_action:
          action: toggle
        entity: scene.middle_room_screen_scenes_left_projector_up
        name: Left Room Projector Up

Thank you

The tap_action you specified is action: toggle which exists for certain domains, like switch, light and input_boolean but not for scene.

In other words, the card is effectively trying to execute scene.toggle which doesn’t exist.

Thank you. So I switched the tap to be default action, I dont get the error anymore. But I do get a pop up. I would want it to execute without a pop up. I manually edited the code to be Action: Activate but that gave me an error.

Thank you

That’s what will happen when you use default with a scene entity.

According to the last line of the documentation for tap_action’s action, the default setting will produce the more-info panel (the pop up) for entities that do not support toggle (like a scene entity).

action string Required

Action to perform (more-info, toggle, call-service, navigate, url, none)
Default: toggle (some cards overwrite default to more-info if the provided entity cannot be toggled)

There’s simply no way to toggle a scene so the best you can do is turn it on. If that’s acceptable, you’ll need to use call-service with service_data. Something like this:

      - type: button
        tap_action:
          action: call-service
          service: scene.turn_on
          service_data:
            entity: scene.middle_room_screen_scenes_left_projector_dn

Thank you. So I tried the following code

      - type: button
        tap_action:
          action: call-service
          service: scene.turn_on
          service_data:
            entity: scene.middle_room_screen_scenes_left_projector_dn
        name: Projector Down
        icon: hass:flash

And I get the error “Failed to call service scene/turn_on. extra keys not allowed @ data[‘entity’]”

Thank you. Am I missing something?

That’s my mistake. Replace the option name entity with entity_id.

As an alternative, you can adopt the new style:

      - type: button
        tap_action:
          action: call-service
          service: scene.turn_on
          target:
            entity_id: scene.middle_room_screen_scenes_left_projector_dn
        name: Projector Down
        icon: hass:flash

Thank you that worked.

Glad to hear it.

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. It will also place a link below your first post that leads to the solution post. All of this helps users find answers to similar questions.

1 Like

Weirdly enough, using “target” instead of “service_data” does not work - it complains about missing entity_id, even though it’s there.

I guess the then-new format was service_data instead?


Also, I think it’s worth pointing out that toggle DOES work on a button card - but not in other places. This is VERY weird, but not that surprising since I’m already getting used to require Google whenever I’m working in my HA setup lol