Lovelace: Button card

anchors are a part of yaml, they go anywhere in the yaml file outside your main yaml structure. Read up on it here. This is not a home-assistant thing, it’s how yaml works as a whole.

https://blog.daemonl.com/2016/02/yaml.html

That’s what I thought. This gives me an error when placed in customize.yaml:

anchors:
  remote_style: &remotestyle
    border-radius: 20px

Then I read this:
http://www.thomasloven.com/blog/2018/08/YAML-For-Nonprogrammers/

This does not give an error in customize.yaml:

package.node_anchors:
  remote_style: &remotestyle
    border-radius: 20px

But even after a reboot, entering <<: *remotestyle in a Card Configuration gives me:

YAML Error: YAMLException: unidentified alias “remotestyle” at line 6, column 25: <<: *remotestyle ^

Thanks for this, loving it! Might have been asked before (tried searching), but is there a way to display secondary info on this underneath the name? Like the last changed?

That is not a current feature

1 Like

thanks @iantrich, I am using state-switch card at present.

Thanks for keeping development going on this one!

Question; I was trying to simplify a button setup for alarm state which was previously quite complicated. I would expect below to also show the text (show_name=true) but does not show it. Did I miss anything?

type: 'custom:button-card'
entity: alarm_control_panel.ha_alarm
icon: 'mdi:bell'
action: more_info
show_state: false
show_name: true
state:
  - value: disarmed
    color: 'rgb(255, 0, 0)'
    icon: 'mdi:bell-off'
    name: "OFF"
  - value: pending
    color: 'rgb(251, 210, 41)'
    icon: 'mdi:security'
    name: "PENDING"
  - value: armed_away
    color: 'rgb(0, 255, 0)'
    icon: 'mdi:security'
    name: "ARMED" 

Hi @Tyfoon,

Edit: just released 0.3.0 which includes it.

Note that your config is not valid anymore for action, please check the new documentation (it’s now in the tap_action YAML object)

This feature is not yet part of the latest release (0.2.0) even though it has been merged into master. It’s going to arrive soon :slight_smile:
In the meantime, if you want you can use the button-card.js from the master branch.

Cheers.

1 Like

:tada::tada: Version 0.3.0 :tada::tada:

New features

  • Possibility to define a name per state and defaults to retrieving entity’s name if no name is provided

Breaking change

  • Introduces a new show_name boolean parameter (default is true) to display the name or not. Before if the name property was ommited, nothing would be displayed. Now it uses entity’s friendly name or entity’s name by default unless redefined in state or general config

@rsachoc, please open a feature request on github. Thanks

that’s because it doesn’t go in customize.yaml. It goes in ui-lovelace.yaml. Because that’s where you’d use that anchor.

@petro thanks for helping me debug this.

Looks like I need to put Lovelace in YAML mode.

Done! Hope I opened it correctly, it’s an issue but I googled and couldn’t find a better way to open a feature request

Issue 112

1 Like

Am I doing something wrong or does color_type: card not play nice with rounded corners?

image

                - type: custom:button-card
                  icon: mdi:start
                  entity: input_boolean.cycle1_manual_run
                  name: Morning Cycle
                  tap_action:
                    action: toggle
                  size: 15%
                  color_type: card
                  confirmation: true
                  state:
                    - value: 'on'
                      name: Start Morning Cycle
                      icon: mdi:play-circle
                      color: var(--background-card-color)
                    - value: 'off'
                      name: Stop Morning Cycle
                      color: green
                      style:
                        - animation: blink 2s ease infinite
                      icon: mdi:fountain

I’m happy to open a GitHub issue if it is one but I’ve only just started to use this card.

1 Like

:tada::tada: Version 0.4.0 :tada::tada:
New Features

  • Introduce the same ripple effect as the default button
  • Long Press support (Fixes #55)
    - type: "custom:button-card"
      entity: switch.my_switch
      name: more-info
      hold_action:
        action: more-info
    
    Thanks @thomasloven for the piece of code to achieve this easily.

Fix

  • It fixes the button staying selected after a click (Fix #93)
    Apr-19-2019 13-22-21

  • It fixes misalignment issues (Fix #89)
    Home_Assistant

4 Likes

@klogg, please open a github issue. I think I have a fix ready for this.

Looks like the buttons perform no actions with 0.4.0, or am i doing somethin wrong?

  - entity: switch.test_switch
    name: Custom 1
    state:
      - icon: 'mdi:fan'
        spin: true
        value: 'on'
      - icon: 'mdi:fan'
        value: 'off'
    type: 'custom:button-card'

If i click the button it does nothing.
Auswahl_193

Can you try placing a entity-button on the same view?

Yepp! Works with one entity-button in the view.
Thanks @iantrich, for the fast reply.

Yeah. Unfortunately with the method used it is using the long press defined in HA core. So if you don’t have an element that supports long-press in your view, it won’t work

1 Like

So what!
Button-Card IS BACK!
Thanks a lot @iantrich and @RomRider

2 Likes