Combine slider-button-card with a switch?

Hey there community,
I need some help with slider-button-card on a template switch I have set up.

I have a smart switch (lets call it switch.plug1) from which I’ve created a custom template switch (lets call it switch.heater) that behaves in such way that if turned on, it will turn the switch on for a number of minutes, and then turn back off automatically. If the switch is turned off manually, it will be turned off normally. (I am doing this via a script and a delay… I believe not relevant).

This number of minutes is specified by a helper,input_number.minutes_heater.

Now, I have set up on the UI a slider-button-card, which allows me to change the value of this input_number.minutes_heater, but what I’d like to do with it is that the action button of the slider actually controls the switch.heater.

This is as far as I’ve reached.

  - type: custom:slider-button-card
    entity: input_number.minutes_heater
    action_button:
      mode: custom
      tap_action:
        action: call-service
        service: switch.toggle
        target:
          entity_id: switch.heater

If I add a button card to toggle the switch.heater, it all works correctly, but when I press on the action button of the slider-button-card, I get an error:

Failed to call service switch/toggle. must contain at least one of entity_id, device_id, area_id

Can anyone guide me on to what I might be doing wrong here???

Thank you!

Suggest to start testing tap_action with a standard Entities card.

I finally figured it out, working it out from Entities card as a mid-step as recommended by Ildar (thanks for the tip!)

For anyone looking for the answer to this, chatGPT was the only thing that could solve it, since documentation was heavily lacking :confused:

Here’s how I solved it:

type: custom:slider-button-card
entity: input_number.minutes_heater
action_button:
  mode: custom
  icon: mdi:power
  tap_action:
    action: call-service
    service: switch.toggle
    service_data:
      entity_id: switch.heater

Thanks for the solution, I use an input_boolean in combination with input_number.
service: input_boolean.toggle just works as expected. However, what I miss is the state change of the “switch” icon. I tried:

  - type: custom:slider-button-card
    entity: input_number.bewasserungsvolumen_ruckseite
    compact: true
    action_button:
      mode: custom
      icon: |-
        {% if is_state('input_boolean.zone_ruckseite', 'on') %}
        mdi:toggle-switch-off
        {% else %}
        mdi:toggle-switch-on
        {% endif %}
      tap_action:
        action: call-service
        service: input_boolean.toggle
        service_data:
          entity_id: input_boolean.zone_ruckseite

but this just lets disappear the icon. I believe this kind of icon templating isn’t supported? Any other hints on this?