Lovelace: Button card


#309

try with :
action: toggle


#310

If I use hass.OS’s configure UI feature and hit edit on any of this cards they all get stuck loading. They work properly, just can’t edit them. Is there a fix for this?


#311

How do you know the cards work if you cannot edit the card’s settings? Which lovelace mode are you using?


#312

I know they work because they are set in place and work properly. I just can’t edit them through configure UI so if I want to make changes I have to make a new card from zero (I’m guessing searching for the file would work too). I’m not sure what you mean by what mode but I guess it’s UI mode as opposed to opening the yaml file directly


#313

Lovelace can be configured to run in different modes - YAML or Storage mode. Storage mode enables editing lovelace cards via the UI. YAML mode does not. What you are describing suggests that you are using YAML mode.


#314

Just wanted to thank you again for this update. The new icon feature greatly simplified my Lovelace UI configuration and even resolved an UI issue caused by my Conditional Card workaround. Keep up the great work!


#315

I just read up a bit about the modes. I don’t have mode: yaml set in configuration.yaml and all the changes I have are done through the UI. This does explain why my old yaml file stopped updating the config, I just never knew why. In any case, I can’t seem to edit the custom: button cards once created :confused:


#316

Same result :frowning:


#317

@tom_l If you want a like for like replacement with Custom UI: Tiles, see the thread from here onwards: Custom UI: Tiles and the GitHub page here: https://github.com/rodrigofragadf/lovelace-cards/tree/master/tiles-card


#318

There is a fix for this bug and also how to use local-lit on the github for this card. I’ll find the link and post it but the fix has not been merged yet.

I manually downloaded the fix and edited my username file manually. I’ll post some details about that as well.


#319

Anyone knows what CSS command that I should use to remove the frame/shadow around the buttons? I want to create it so that you can’t see the buttons, but still be able to use functions like conditional cards based on sensor values etc.

Code right now:

  - type: custom:popup-card
    entity: sensor.sparsnas_energy_consumption_momentary
    title: Gräve
    card:
      type: vertical-stack
      cards:
        - type: history-graph
          title: Senaste 3 dygnen
          hours_to_show: 72
          entities:
            - sensor.sparsnas_energy_consumption_momentary
        - type: horizontal-stack
          cards:
            - type: "custom:button-card"
              entity: sensor.am8_current_state
              color_type: label-card
              color: rgb(48, 48, 48)
              color_off: rgb(48, 48, 48)
              name: Förbrukning
              style:
                - text-transform: none
            - type: "custom:button-card"
              color_type: card
              color_off: rgb(48, 48, 48)
              entity: sensor.sparsnas_energy_consumption_momentary
              action: more_info
              show_state: true
              style:
                - text-transform: none

#320

Is there a way to create a button that is just a blank tile i.e. no icon, no text, but uses same background and is the same size as other entity-buttons in a horizontal stack?

I’ve tried this Button Card with color_type: blank-card which for me almost works but it is transparent (transparent tile) instead of same background as other entity-buttons.

Background: I’m trying to create a vertical/horizontal 3x3 stack of buttons, but I only have 7 entity buttons. The first two rows have 3 entity-buttons leaving one left for the last row.
The last row I would like
blank-tile | entity-button | blank-tile.

With color_type: blank-card the last row is
transparent-tile | entity-button| transparent-tile.


#321

Try color_type: card with color: <your desired color>


#322

@kuuji This card is absolutely amazing and it has replaced many cards in my setup. However I do have a question. The first one is:

  • is it possible to have the lit element locally?
  • is it possible to assign a hold_action to the buttons?

I use the standard entity button card for my lights (which I use to turn up/down brightness or adjust color, but I’d like a single press to just turn it on/off and a hold action for more-info)

As it is now I have to choose between more-info or toggle (or a service). Is there any way this would be possible? And if no, will it perhaps be possible in the future? Or is there any “hacky” way to do it?

Thanks a lot and great work


#323

I gave it a try, and do get a color as specified, but the height of the button
is very small.


#324

Did you ever figure out if the extra data was supported or not? I’m trying to see if using fan.set_speed can be used since it needs an entity_id and the speed as data.


#325

I’m also having another issue that I haven’t seen mentioned but looks like no one else is having any issues with so it has to be me doing something wrong but I just can’t see it.

I’m trying to do a horizontal stack nested in a vertical stack. The horizontal stack should contain four buttons. But for some reason if I put all four buttons in it breaks lovelace (blank page with “reload lovelace” in the middle). If I put in three buttons it works perfectly fine.

Here is the code:

      - type: vertical-stack
        cards:
          - type: entities
            title: Master Bedroom
            show_header_toggle: false
            entities:
              - light.master_bedroom_light
              - fan.master_bedroom_fan
              - sensor.mbr_fan_speed_mqtt
              - sensor.mbr_light_mqtt
              - entity: light.zw_light_2_level
                type: custom:slider-entity-row
          - type: "custom:button-card"
            color_type: label-card
            color: rgb(44, 109, 214)
            name: Ceiling Fan
          - type: horizontal-stack
            cards:
              - type: "custom:button-card"
                entity: fan.master_bedroom_fan
                name: "Off"
                color_type: card
                color: auto
                color_off: '#ff4556'
                icon: mdi:fan
                size: 15%
                style:
                  - font-size: 12px
                  - font-weight: bold
                  - width: 100px
                action: service
                service:
                  domain: fan
                  action: set_speed
                  data:
                    entity_id: fan.master_bedroom_fan
                    speed: 'off'
              - type: "custom:button-card"
                name: "Low"
                color_type: card
                color: rgb(223, 255, 97)
                icon: mdi:fan
                size: 15%
                style:
                  - font-size: 12px
                  - font-weight: bold
                  - width: 100px
                action: service
                service:
                  domain: fan
                  action: set_speed
                  data:
                    entity_id: fan.master_bedroom_fan
                    speed: 'low'
              - type: "custom:button-card"
                name: "Medium"
                color_type: card
                color: rgb(223, 255, 97)
                icon: mdi:fan
                size: 15%
                style:
                  - font-size: 12px
                  - font-weight: bold
                  - width: 100px
                action: service
                service:
                  domain: fan
                  action: set_speed
                  data:
                    entity_id: fan.master_bedroom_fan
                    speed: 'medium'
              # - type: "custom:button-card"
                # name: "High"
                # color_type: card
                # color: rgb(223, 255, 97)
                # icon: mdi:fan
                # size: 15%
                # style:
                  # - font-size: 12px
                  # - font-weight: bold
                  # - width: 100px
                # action: service
                  # service:
                  # domain: fan
                  # action: set_speed
                  # data:
                    # entity_id: fan.master_bedroom_fan
                    # #speed: 'high'

It works fine as it’s written. As soon as I uncomment the last block for the button it breaks.

Can anyone see where I’m failing?


#326

Looks like the “service:” line has two extra white spaces before it.


#327

Huh, will you look at that…

Thanks! That was it. I’ve been looking at it for an hour trying to figure that out. :confused:

A fresh set of eyes is usually the thing that works. :slightly_smiling_face:


#328

Yeah, I’ve been there. Couldn’t find a typo in the updated tap-action behavior for two days straight :sweat_smile:

By the way, according to your code I can see that you are using a “custom:button-card”. What’s the difference between this and the official entity-button card?