Lovelace: Button card

Hm that sounds like what I want to achieve yes. But not tackling day/night themes just yet. But I will definitely look at this when I do. It does look a bit complicated though (I am a noob when it comes to programming etc). But I will figure it out eventually when I am going to make themes.

Btw I use your card again now, it saved me around 800 lines of code which is awesome. Thanks a lot, oh and the hold_action is perfect thanks.

I have a question, how do I change the icon size? And the placement of the icon? Seems whatever I try the icon stays the same size and same place.

What I am trying to do is to create a horizontal-stack with 2 buttons. The rows beneath it has 4 buttons. But when I set up 2 buttons the buttons and the icon size grow very large and Iā€™d like to make the row with 2 buttons the same height, icon size and have the text/icon centered.

The buttons have to come beneath the red line and above the other buttons (but want them to be same in size) anyone know how to do that (if even possible)?

1 Like

:tada::tada: Version 1.2.0 :tada::tada:
Breaking Changes

  • The default color for the background of a card with color_type: card when the entity is off is now var(--paper-card-background-color). Fixes #129 (@apt)

Fix

  • Fixes #130: color: auto uses also entityā€™s brightness now (@jimz011)
2 Likes

Am I right in thinking custom updater doesnā€™t work in 0.92.x? 1.2.0 isnā€™t showing up.

@apt @RomRider Iā€™m not seeing 1.2 with custom-updater/tracker in v0.91.4.

@jumper @apt, the bot that builds the json file used by custom_updater to track new versions has not yet catched the new version, please wait a bit more (or copy the file manually :slight_smile:)

2 Likes

How do I define the card height please?

For example, the more horizontal buttons I add using the yaml below, the smaller the buttons are:
image
image

      - type: vertical-stack
        cards:
          - type: "custom:button-card"
            color_type: label-card
            color: rgb(44, 109, 214)
            name: Kitchen
          - type: horizontal-stack
            cards:
              - type: "custom:button-card"
                entity: switch.kitchen_scene_1
                color_type: card
                color: rgb(66, 134, 244)
                style:
                  - box-shadow: 3px 3px rgba(66, 134, 244,0.4)
                icon: mdi:numeric-1-box-outline
              - type: "custom:button-card"
                entity: switch.kitchen_scene_2
                color_type: card
                color: rgb(66, 134, 244)
                icon: mdi:numeric-2-box-outline
              - type: "custom:button-card"
                entity: switch.kitchen_scene_3
                color_type: card
                color: rgb(66, 134, 244)
                icon: mdi:numeric-3-box-outline
              - type: "custom:button-card"
                entity: switch.kitchen_scene_4
                color_type: card
                color: rgb(66, 134, 244)
                icon: mdi:numeric-4-box-outline

Thanks.

 style:
   - height: 90px
   - padding-top: 5%

works for me.

1 Like

ahh, Iā€™m not familiar with CSS so didnā€™t realise it could be used that way. Thanks!

Iā€™m too. :grinning:
Just trial and error.
BTW, this doesnā€™t seem to work on buttons with states?

EDIT: Sorry, works, was another button for another user.

I use the size option

  - color_type: label-card
    entity: switch.dockerplex
    entity_picture: /local/docker/plex.png
    show_entity_picture: true
    show_name: false
    size: 30%  #adjust based on your needs
    state:
      - color: var(--paper-item-icon-color)
        value: 'on'
      - entity_picture_style:
          - filter: grayscale(100%)
        value: 'off'
    type: 'custom:button-card'

I have no input for your question. Just wanted to acknowledge that your person ui thing is adorable. Nicely done.

2 Likes

How long does it take the bot to update usually? Still no sign of the new version with tracker card/custom updater.

Sorta neat thing I stumbled across and thought it was worth sharing.

With this site you can generate css gradients: https://cssgradient.io/ itā€™s just a slider and then you copy and paste the code it generates. These can be used in your custom button cards like this:

style:
  - background-image: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 7%, rgba(0,212,255,1) 100%)
  - text-transform: uppercase
  - font-weight: bold

Could also do this with state and have different gradients on a per-state basis.

Hereā€™s one I made in like ten seconds just to demonstrate:

9 Likes

Indeed, no version 1.2.0 showing up in custom_updater.
When looking through the files in github, and at the docs for custom_updater, seems to me the support for custom_updater is broken or removed?

Just reading through and seeing the great progress on this card, Iā€™m considering it to replace the unfortunately now unsupported ā€˜tilesā€™ custom cards Iā€™d been basing my interfaces on. The only thing Iā€™m not sure if I can replicate from my quick read through, is the ability to have secondary text on the button (ideally a template)?

For example in the bottom left on my screenshot, I include a state and name for various items in my ā€˜menuā€™ (selecting any of them opens a relevant page on the right side).

@ludeeus has upgraded custom_updater a few days agoā€¦ I donā€™t know if itā€™s related to that or not. I am not seeing it as available either. Ludeeus did also say heā€™s migrating to a new server to improve thisā€¦ Iā€™m guessing it will pop up soon or tomorrow morning I will just do a manual update.

For now, you can mix it with the config-template-card to use templates and display anything you want in the name field.
Iā€™m working on many things right now and one of them is the ability to add a secondary text in the card and completely customizable layouts using css grids, svg icons coloring support, native templates support, etcā€¦
Please hold on good stuff is coming :slight_smile:

2 Likes

I attempted to try config-template-card today using the yaml below, but all it does is show an error on the browser. Is this the same error you were seeing?

          - type: horizontal-stack
            cards:
              - type: 'custom:config-template-card'
                variables:
                  - states['input_boolean.window_is_open'].state
                  - states['sensor.windows_open'].state
                entities:
                  - input_boolean.window_is_open
                  - sensor.windows_open
                card:
                  type: 'custom:button-card'
                  entity: input_boolean.window_is_open
                  color_type: card
                  color: rgb(66, 134, 244)
                  size: 30px
                  name: Test

image

@DavidFW1960 @bouwew, custom_updater is not broken. Itā€™s just the bot that scans the repositories in https://github.com/custom-cards is down and doesnā€™t generate the file used by custom_updater anymore, itā€™s going to be back up soon

FYI, the file used by custom_updater for cards in the custom-cards github organization is this one: https://github.com/custom-cards/information/blob/master/repos.json

1 Like