Lovelace: Button card

Check the last example in the custom fields section

2 Likes

Ah yes I see, but wouldnā€™t that just put an entities card inside the button card?

The thing is, I want the button to just be a button like the other buttons and only show a dropdown menu when I press it. If it is what I think it is, it will also show the ugly line and arrow inside the button-card.

Anyways thanks for the info, I will go and try this later on and will post my findings back here.

Has anyone successfully leveraged Auto-Entities with Button-Card?

auto-entities is for cards that accept a list of entities

Iā€™m just thinking that is a slippery slop. First you add support for input_select, then someone wants input_datetime, input_text, etc

Auto-entities also accepts a card declaration. Iā€™d much rather use Button-Card than any of the default cards with auto entities

The card parameter is for if you want something instead of the entities card, like a glance card.

From the ReadMe:
"It then creates a card based on the configuration given in card:, and fills in entities: of that card with the entities from above."

@thomasloven need an auto-card plugin that takes a list of entities and applies it to a card template :stuck_out_tongue_winking_eye:

I know you jest, but this is exactly what I want. I want button-cardā€™s recreation of the Homekit style button to be leveraged and populated by auto-entities. Or vice-versa. Either way, I just want nice looking buttons for my entities and I want an easy way to create them in large quantities.

Edit: I also want new entities to automatically have the aforementioned button created and added to the HA interface at the time they are added/detected, thus eliminating the need to create a button for each new entity and saving me time.

Like how auto-entities does if you feed it layout-card?

:man_facepalming:

Thanks for the replies. Really helpful and not at all condescending.

Yeah that might be true. Though input_select would seem to be very common (whereas the other two are not so much). Oh well, no big deal. Iā€™ll play around with my designs and find a solution for it.

Thanks for the reply though. I havenā€™t heard of @RomRider in a while. Is he alright?

Not sure if your joking or not? I was sincere in all my responses; minus the one to thomas, which blew up in my face :slight_smile:

Just busy from what I understand

Iā€™m sorry you feel that way. That was not at all my intention.

I havenā€™t been part of this discussion, but I guess you want to automatically create a number of button-cards the same way auto-entities can create rows in an entities or icons in a glance card?

If so, youā€™d need my layout-card too, which has a pretty new feature that it can take an entities: parameter (in this case populated by auto-entities) and break that into several cards with an entity setting.

Thereā€™s an example at the very bottom of the readme: https://github.com/thomasloven/lovelace-layout-card#a-few-tips

ā€¦I guess I should add a note about this to the auto-entities readme tooā€¦

But again, Iā€™ve just been pinged into this, so I may have misunderstood the premise completely.

2 Likes

Hi,

Some questions about this Button card. Is it possible to change the Name when I click on the button in order to match the status ? For example, I would like to change the ā€œActivation Timerā€ name by ā€œDesactivation Timerā€ when I click on it, as the input boolean status change :

Is it possible ?

Futhermore, the three buttons at the end of the card are calling some scripts. When I click on the CONFORT button, I would like to illuminate it in ORANGE, and set both other buttons to GRAY. THEN, if I click on the ECO button, the confort button should become GRAY, and the ECO button ORANGE.

Is it possible ?

Thanks

Iā€™ve been playing our for a while but cannot seem to be able to get what Iā€™m looking for

Iā€™m trying to update this

image

with just the Name(s) and instead of a switch a checkbox

state:
  - value: 'on'
    icon: 'mdi:check-box-outline'
    styles: null
  - operator: default
    icon: 'mdi:checkbox-blank-outline'

using this I can make a button thatā€™s close, but I was hoping for a long button with the text left justified and the icon right justified. Either the icon is tiny, or the text does not justify.

Ultimatly more like this with checkboxes
image

Any suggestions?

hey @iantrich
please let me ask you directly, since you were the architect of the extra fields (thatā€™r right isnt it?) how to solve this issue I have with a capitalization on one of those fields.

this is my button:

01

and I like the yellow to show as Yellow.

for that, I made this style:

    level:
      - padding-bottom: 2px
      - align-self: middle
      - justify-self: start
      - --text-color-sensor: >
          [[[ return entity.attributes.awareness_level.split(' ')[1].slice(0,-1) ]]]
      - --color-name: >
          [[[function capitalizeFirstLetter(string) {
            return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
            }
            var id = entity.attributes.awareness_level.split(' ')[1].slice(0,-1);

this is the current field config itself:

  level: >
    [[[
      return `<ha-icon
        icon=${'mdi:numeric-' + entity.attributes.awareness_level.split(';')[0] + '-box'}
        style='width: 12px; height: 12px;'>
        </ha-icon><span>Level: <span style='color: var(--text-color-sensor);'>${entity.attributes.awareness_level.split(' ')[1].slice(0,-1)}</span></span>`
    ]]]

What I want to do is replace the ${entity.attributes.awareness_level.split(' ')[1].slice(0,-1)} bit with the var(ā€“color-name) but no matter what I try, it doesnt work. It either shows the literal text, or no button at allā€¦

i know the function itself is correct, because if I enter the code as a template for the name of the button it works fine:

17
Would seriously appreciate some guidance here, thanks if you would!

I was not the architect on that, but try using text-transform: capitalize

1 Like