Lovelace: Button card

Yeah, sorry. I should have said to add to the raw Lovelace

1 Like

Still loving this button and playing around with it. I have created a logo in photoshop which is the tv station, rounded on one side and gradient filled to nothing on the other. Its half the width of a standard full width card.

I was hoping to have this on the left and the channel name on the right but for some reason the button is taller than the image I have created?

I thought it was because i was using layout: icon_name_state to put the channel name on the far right, but even setting show_label: false it does not resize the height of the button.

Any ideas? Its the BBC One card in the image below, you can see its rounded which is the image I supplied but the button is has space above and below the image

Share your config please, we canā€™t do anything without it.

Sorry, couldnā€™t copy and paste the code from my phone. Here it is. There are quite a few bits commented out from having a play trying to fix it so apologies for that:

        
      - type: custom:button-card
        entity: switch.skyq_bbconelounge
        layout: icon_name_state
        show_entity_picture: true
        name: BBC one
        show_name: true
        show_icon: false
        show_label: false
        style:
          - padding: 0px
        styles:
          card: 
        #  - width: 100px  #100% #99px
        #      - height: 100px
          entity_picture:
            - width: 100%
            - height: 100%
         # name:
         #   - justify-self: start
         #   - padding-left: 10px
         #   - font-weight: bold
         #   - text-transform: lowercase    
        entity_picture: "/local/images/remote/bbconefaded2.png"
        #action: on  #skyq_bbconelounge
         

would love to to try this requested feature on the new Lock option.

testing this in my lock template :

button_body_lock:
  lock:
    enabled: true
    unlock: hold
  confirmation:
    text: >
      [[[ return 'Are you sure you want to toggle ${entity.attributes.friendly_name}? If not, do nothing.' ]]]

which changes the lock action to Hold, as requested, and make tap do nothing. so far so good. Holding the button makes the lock open and grey out, but then clicking it again(to get the confirmation) does this:

20

Is this an incorrect configuration?
please have a look?

edit
wait, I used regular quotes, and not backtick quotes. sorry, doing whatā€™s desired now:

28

Guess thereā€™s always a ā€˜cancelā€™ (Annuleer) there? So need to change my confirmation text :slight_smile:

btw do we have options to sale the confirmation box? it now seems so out of context.

thanks

Iā€™m trying to use the state option to change the colour of an input_boolean according to the state (on or off) but it doesnā€™t seems to be working. I have the following:

  - cards:
      - type: entity-button
        entity: input_boolean.temp_alarm
        name: Alarm
        icon: 'mdi:garage-open'
        state:
          - value: 'off'
            color: red
          - value: 'on'
            color: green

Iā€™ve tried changing the colourā€™s, changing the mdi icon but nothing seems to be making a differance. Fairly sure Iā€™m missing something fundamental, any help would be appreciated!

youā€™;re missing the ā€˜stylesā€™ key.

have a look here:

button_default_state:
  state:
    - value: 'on'
      styles:
        card:
          - color: '#555B65'  #'#5daf35'
          - background-color: '#F0C209'
        icon:
          - color: '#555B65'
        label:
          - color: red
      id: on-icon
    - value: 'off'
      styles:
        card:
          - color: '#F0C209'
          - background-color: '#555B65'
        icon:
          - color: '#F0C209'
        label:
          - color: rgba(0, 0, 0, 0.0)
      id: off-icon
    - value: 'unavailable'
      styles:
        card:
          - opacity: 0.6
          - color: grey
          - --paper-item-icon-color: grey

Youā€™re using the core entity-button.
This is about the. type: custom:button-card

Being stupid but why does this code not give me a button that takes me to a different lovelace screen?

      cards:
      - type: custom:button-card
        action: navigate
        navigation_path: /lovelace/5/
        name: Lounge
        
        

oops, yes, that too :wink:

ARGH!!!

Thanks, working as expected now!

sorry, worked it out!

    - type: vertical-stack
      cards:
      - type: custom:button-card
        tap_action:
          action: navigate
          navigation_path: /lovelace/5/
        name: Lounge

Still cannot work out how to solve my display issue above though

a question on the new exemption option:

is it per design the lock flashes quickly on an exemption name which is incorrect? Ive used it with a name listed with lowercase first letter instead of lower case, and it starts flashing quickly (instead of disappearing) and the next tap doesnā€™t do anything.
Using an uppercase username makes the lock disappear alright, but the next tap still gives me the conformation dialogā€¦

this might be a feature request, but Iā€™ll post it anyway, maybe it is already possible:

Id like the confirmation to show up only on the admin account, and not at all for all other accounts, and stay silent (donā€™t toggle at all). Iow, only the admin account would be allowed to unlock (albeit with a conformation).
As I understand the exemption now, the list of users would not see the confirmation, and unlock directly?
thanks for having a look

Iā€™ll have a look soon, it should be pretty easy.
But something like this should work:

styles:
  card:
    - padding: 0px

Yes it is by design, the lock flashes if youā€™re in not in the exemption list.

With this config:

  • Only admin can unlock the button
  • Only admin will have the confirmation since heā€™s the only one who can unlock
lock:
  enabled: true
  exemptions:
    - username: admin
confirmation:
  text: Your text
1 Like

cool! thanks a bunch. great design!

just tested and we can do this too, which is very nice indeed:

    exemptions:
      - username: !secret button_unlock_name

secondly, please let me ask this: Iā€™ve set the unlock name now in a button_template. But I can see use for having different lists of exemptions on different buttons.
Could we set the exemption on an individual button, while all the other lock settings are defined in the template? Would these settings merge?

Problem: the link to install button-card is 404

Use HACS or the release

Thanks.

I have stripped all the surplus code out and have this picture now:

image

from this code:

        
      - type: custom:button-card
        entity: switch.skyq_bbconelounge
        show_entity_picture: true
        styles:
          card: 
            - padding: 0px
          entity_picture:
        entity_picture: "/local/images/remote/bbconefaded2.png"
        

removing the state etc gets me this:

image

with this code:

      - type: custom:button-card
        entity: switch.skyq_bbconelounge
        show_entity_picture: true
        show_name: false
        show_icon: false
        show_label: false
        show_state: false
        styles:
          card: 
            - padding: 0px
        entity_picture: "/local/images/remote/bbconefaded2.png"
        

So I am nearly there, then I found your justify guides for the img cell:

        styles:
          card: 
            - padding: 0px
          img_cell:
            - justify-content: start    

So now have this:

image

I am hoping to put the card name on the far right now in the middle, will have a play and see how I get on.

Thank you for this card!

1 Like

Can someone help me with dynamic color for light brightness? I want the color to change as the brightness changes.

   -  type: 'custom:button-card'
      entity: light.bedroom
      name: |
        [[[
          var bri = states['light.bedroom'].attributes.brightness;
          return 'rgb(248, 222, ' + (bri ? bri : 0) + ')';
        ]]]      
      label: |
        [[[
          var bri = states['light.bedroom'].attributes.brightness;
          return 'Brightness: ' + (bri ? Math.round(bri/255*100) : '0') + '%';
        ]]]
      show_label: true
      icon: 'mdi:ceiling-light'
      color: >
        ${states['light.living_room'].attributes.brightness < 50 ? 'rgb(255, 255, 0)' : 'rgb(255, 255, 125)'}
      state:
        - value: 'off'
          color: 'rgb(0, 0, 0)'

It outputs the correct rgb for the name and the label works fine.

Is it possible to show a toggle on the button? Like an entity toggle header?

image