Lovelace: Button card

It’s just for cleaning up your lovelace yaml. I made a full remote with 180 buttons. I don’t want to configure something 180 times when I can use anchors to share all the common functionality.

In regards to normal lovelace, it would be this:

  - type: entity-button
    entity: switch.zone_1
    show_name: false
    tap_action:
      action: toggle
    hold_action:
      action: none
  - type: entity-button
    entity: switch.zone_2
    show_name: false
    tap_action:
      action: toggle
    hold_action:
      action: none
  - type: entity-button
    entity: switch.zone_3
    show_name: false
    tap_action:
      action: toggle
    hold_action:
      action: none

or with anchors:

anchors:
  remote_button: &buttonremote
    type: entity-button
    show_name: false
    tap_action:
      action: toggle
    hold_action:
      action: none
  - <<: *buttonremote
    entity: switch.zone_1
  - <<: *buttonremote
    entity: switch.zone_2
  - <<: *buttonremote
    entity: switch.zone_3

what’s easier to maintain when you want to change show_name to true for all 3 switches? The old way, I.E change all 3 individually. Or the anchor way, just changing the anchor. Now imagine that with 180 buttons with the same configuration.

1 Like