UI icon indicating copy to clipboard operation
UI copied to clipboard

Custom actions no longer working with button card templates

Open panhans opened this issue 3 years ago • 4 comments
trafficstars

Describe the bug Using a generic card with a custom action doesnt work. The template produces an error.

To Reproduce

# doesnt work anymore
- type: custom:button-card
  entity: scene.yourscene
  template:
    - card_generic_swap
  tap_action:
    action: call-service
    service: scene.turn_on
    service_data: 
      entity_id: scene.yourscene
  
# works without template
- type: custom:button-card
  tap_action:
    action: call-service
    service: scene.turn_on
    service_data: 
      entity_id: scene.yourscene

Expected behavior When click the button the scene should be activated. With the template in button-card it results in an error.

panhans avatar Jul 05 '22 07:07 panhans

Hi @panhans

This should still be possible. It will now only affect the outer layer of the card due to the more nested card framework introduced with the custom actions feature.

basbruss avatar Jul 05 '22 07:07 basbruss

Yes, it should but since version 1.0.1 it runs in an error. Workaround is using the script template instead of generic.

panhans avatar Jul 05 '22 08:07 panhans

Hi @panhans

This should still be possible. It will now only affect the outer layer of the card due to the more nested card framework introduced with the custom actions feature.

It seems like it also prevents customizations to the icon and such from working.

My card (below) will still trigger the script when the button edge is tapped, which is annoying enough, but does not respect my other customizations.

- type: "custom:button-card"
  template: card_generic
  entity: sensor.my_sensor
  icon: mdi:car
  styles:
    icon:
      - color: "rgba(var(--color-blue),0.7)"
    img_cell:
      - background-color: "rgba(var(--color-blue), 0.2)"
  tap_action:
    action: call-service
    service: script.turn_on
    service_data:
      entity_id: script.my_script
  hold_action:
    action: more-info
    entity: input_datetime.my_input
image

JSaterdalen avatar Jul 12 '22 04:07 JSaterdalen

See also this ticket #820 and this discussion #821

basbruss avatar Jul 12 '22 04:07 basbruss