Lovelace: Button card


#492

Hi all

Is it possible to evaluate an attribute of an entity instead of the state, like this

        state:
          - position: 40
            color: rgb(255, 0, 0)

Thanks


#493

I wish this button had a hold action still kinda surprised almost no one asks for this feature :stuck_out_tongue:

The core button works fine though, though I can’t color the buttons.


#494

Also interested in seeing how @gurukid did that !


#495

cards:

  • color: ‘#f8f8f8
    color_type: labelcard
    name: Office Lamp
    style:
    • border: ‘1px solid #ccc
    • box-shadow: 0px
      type: ‘custom:button-card’
  • cards:
    • color: ‘rgb(66, 134, 244)’
      color_type: icon
      entity: light.office_lamp
      icon: ‘mdi:lamp’
      show_state: true
      state:
      • color: ‘#fdbc22
        value: ‘on’
        type: ‘custom:button-card’
    • color: ‘#fff
      color_type: card
      entity: script.dimoffice10
      icon: ‘mdi:signal-cellular-1’
      name: dim 10%
      state:
      • color: ‘#f5f5f5
        value: ‘off’
        type: ‘custom:button-card’
    • color: ‘rgb(213, 0, 96)’
      color_type: card
      entity: script.dimoffice50
      icon: ‘mdi:signal-cellular-2’
      name: dim 50%
      state:
      • color: ‘#f5f5f5
        value: ‘off’
        type: ‘custom:button-card’
    • color: ‘rgb(66, 134, 244)’
      color_type: card
      entity: script.dimoffice100
      icon: ‘mdi:signal-cellular-3’
      name: dim 100%
      state:
      • color: ‘#f5f5f5
        value: ‘off’
        type: ‘custom:button-card’
    • action: more_info
      color: ‘#fdbc22
      color_type: icon
      entity: light.office_lamp
      icon: ‘mdi:selection-ellipse’
      name: Custom %
      type: ‘custom:button-card’
      type: horizontal-stack
      type: vertical-stack

#496

can you share the config for the link button, that would be awesome… :slight_smile:


#497

Can I have a custom background colour for the card dependent on state and a custom icon at the same time?

So white background and icon A for off, then blue background and icon B for on. From my experimentation it seems you can only do one or the other, is this correct?


#498

I’ve been wanting this for a while as well. I have looked through the code to try and add on hold, but since it’s not using HTML elements I can’t figure out how to add it to the current set up. I’ll mess around with it a bit more this weekend.


#499

I think our time is better spent trying to improve entity-button. Feel free to contribute to core. Should get show/hide icon/name soon


#500

Indeed I think this is better as well, for that reason I have reverted back to the core button as I need the hold action. It would be better if some of this cards features come to core like button color for example.

Pretty happy with the core button now, as the hold action finally works as it should on my iphone whereas it wouldn’t before (and thus the reason why I started using this custom card). Still some features would be nice like the empty button for example.


#501

Sounds like a better idea indeed. For some reason the show/hide options are on the docs, but don’t seem to be working yet :frowning:

Also I managed to get pretty similar results using entity-button, the one thing I’m mainly missing is the card background coloring instead of just the icon coloring.


#502

Those shouldn’t have been merged, I put them against next with a linked PR, but the frontend PR has not been merged

Will be in 0.91


#503

Is that going to include changing the icon colour according to the state (like currently for switches & lights)?


#504

My PR? No. It’s for show/hide of name/icon


#505

Are you still planning on moving those other features over to core entity-button?


#506

My point was that people not be trying to hack this card to work for them, they are better off contributing to core. I do have any concrete plans on what features will be brought over.


#507

Doc’s got updated a little too soon. Was wondering why that didn’t work when I tried it Wednesday. EDIT: Referring to show/hide icon/text.