Lovelace: Button card

Check the breaking changes of 0.1.0 release. action has been reworked.

Edit: See that @RomRider already addressed this while I was typing :slight_smile:

Alright, toggle makes sense as a default and it should be easy to update my buttons to specify more-info.

Though i wonder if itā€™d be possible for the button-card to know if the specified entity begins with sensor prefix and then automatically default to more-info instead for that specific button? Since you canā€™t toggle a sensor. Just an idea that would make it a little more user-friendly.

As for GitHub thing, I was trying to open the readme.md and then trying to hit pencil icon to edit, but it was not allowing me to. Appears to be working now and I just submitted PR.

I want to get rid of the icon here:

image

              - type: custom:button-card
                entity: sensor.sonos_volume
                show_state: true

How do I do that? I used the config in the readme.

This is because card now falls back to showing default icon if no mdi: icon is specified.

You can fix this by adding show_icon: false

1 Like

good to know, iā€™ll update and try the new card later.

Hi @Tomahawk, Iā€™ll look into that. In the meantime, could you open an issue on github please? Itā€™s easier to track there, thanks :pray:

I had switched back too Petro but @RomRider has picked this card up and it is awesome again!

2 Likes

Now I just need to convince him to start contributing to core :wink:

2 Likes

Wow! Good job.

Itā€™s leaving the button at the came color you see if you hover over the card after you tap on the button rather than returning to the normal color. Hopefully @RomRider can fix this. Itā€™s more of an annoyance than anything. If you tap anywhere on the screen it revertsā€¦

Hey @RichardU,
That will be done, once this PR is merged:
https://github.com/custom-cards/button-card/pull/95

1 Like

Hey @Tomahawk,
Your icon position problem should be fixed with this PR once merged:
Home_Assistant

https://github.com/custom-cards/button-card/pull/97

1 Like

Hey @VDRainer, @DavidFW1960,
The button staying selected should be fixed with this PR once merged:
Apr-19-2019%2013-22-21

https://github.com/custom-cards/button-card/pull/97

1 Like

Thanks a lot @RomRider!
Last weekend i decided to change everything to the entity-button. :tired_face:
Now i have something to do this weekend. :grinning:

You should use anchors! I set my system up to use anchors so I only need to swap the button type and attributes in 1 place:

anchors:
  remote_style: &remotestyle
    border-radius: 20px
    
  remote_button: &buttonremote
    type: entity-button
    show_name: false
    tap_action:
      action: toggle
    hold_action:
      action: none

Then in your configuration area just have this:

              - type: 'custom:card-modder'
                style:
                  <<: *remotestyle
                  --paper-item-icon-active-color: '#E45E65'
                card:
                  <<: *buttonremote
                  entity: switch.poweroff
              - type: 'custom:card-modder'
                style:
                  <<: *remotestyle
                  --paper-item-icon-active-color: '#E45E65'
                card:
                  <<: *buttonremote
                  entity: switch.zone_1
              - type: 'custom:card-modder'
                style:
                  <<: *remotestyle
                  --paper-item-icon-active-color: '#E45E65'
                card:
                  <<: *buttonremote
                  entity: switch.zone_2

When you swap to a new card, youā€™ll pretty much only need to update/change the anchor. And possibly do a find and replace on the --paper-item-icon-active-color field name.

I love it for styles. I can add a style and it just changes all cards everywhere that would use it.

7 Likes

Does anyone have any idea why the delay and off is not working?

Thanks, Richard

  - type: 'custom:button-card'
    color_type: icon
    entity: switch.one
    tap_action:
      - action: call-service
        service: switch.turn_on
        service_data:
          entity_id: switch.two
      - delay:
          seconds: 2
      - action: call-service
        service: switch.turn_off
        service_data:
          entity_id: switch.two

Thereā€™s no delay option. Just a single action. Write a script if you want something like that.

@RichardU, the purpose of the frontend is to display things not to handle logic.
For what you want to do, use a script as @iantrich stated and call the script from the button.

In your configuration.yml:

script:
  my_script:
    sequence:
    - service: switch.turn_on
      entity_id: switch.two
    - delay:
        seconds: 2
    - service: switch.turn_off
      entity_id: switch.two

In lovelace:

- type: 'custom:button-card'
  color_type: icon
  entity: switch.one
  tap_action:
    action: call-service
    service: script.turn_on
    service_data:
      entity_id: script.my_script
1 Like

:tada: Version 0.2.0 :tada:

New Features:

  • New url option in tap_action to open a new tab
  • New spin option added to state object to animate spinning

Fixes

  • Restore rounded corners

Breaking Changes

  • Deprecate icon: attribute
3 Likes

Looks cool but I have no idea how I would use that or how it helps changing from the inbuilt button to this cardā€¦ I also donā€™t use card-modder so thereā€™s thatā€¦