Lovelace: Button card

Fantastic addon! I just wanted to say thank you! With few extra ones I was able to build my status/control card for Air Purifier! :slight_smile:
firefox_WnhjYXM4vj
One thing I was wondering if it’s possible is to add hover effect on the buttons.

1 Like

That is great!! Love it!

3 Likes

Hi i am having trouble with this can i can’t figure it out.
Can anyone help me please.

     state:
       - value: '[[[ return 'sensor.master_fan_speed' == 'low' ; ]]]'
         spin: true

Thanks

Could you tell us more about your goal and maybe post a bit more of the card’s config.
Based on the docs, you need to use string values (not templates) with value unless operator is template, that’s why your current config doesn’t work.

Thanks @AhmadK i did this and it all works. :grinning:

           state:
              - operator: template
                value: >
                    [[[ if (states['sensor.master_fan_speed'].state == 'low') return 'on' ; ]]]
                spin: true
1 Like

You should be able to use the CSS modifier :hover in extra_styles to handle that.

Oh cool, will check it out!

Where do you put ‘extra_styles’? I don’t think that’s an option for button card right? Or am I missing something, can’t find that line in the documentation.

1 Like

It’s a main option at the root level. It’s in the doc’s in the main options table.

1 Like

Can’t believe I missed that, thanks!

1 Like

It’s a big table, super easy to miss stuff.

@brucehvn, I’ve published a beta release that should fix your issue with nested cards. Would you mind testing? (If you’re using HACS, display the beta releases to be able to install it)

@AhmadK, I’ve also added a better way of handling updates in this release: It only updates when needed and there is some auto-discovery of entities used in templates (I said I wouldn’t do it but in the end I did it :smiley:). However, it’s still possible to add manually entities that would trigger an update or keep the old behaviour and update every time anything is updated in HA.

@all, if you want to test and report back, that would be great. Please read the release notes of the beta there are important information! I plan to release it in some days after people had some time to test (@petro, @Mariusthvdb, @jimz011, … thinking about you here :stuck_out_tongue: ).

It should improve a lot the reactivity of the frontend on low-end devices :slight_smile: (and consume less on high end mobile devices)

1 Like

On it :grinning:

Hi @RomRider,
Great! hope this will ease up my main issue in the config… Lovelace taking a lot of resources for HA, which has its consequences down the system (mainly Hue entities going unavailable all the time). Since the button-card is on each and every page, this has its consequences so I learn now. Had suspicion of that before, but since you are so abundantly clear about it now, I will put all effort on this now.

So, eager to test!

before I do, please let me know how to have the new card update with ‘entity’ in templates/decluttering cards.
If I understand the notes on the new functionality correctly, it only works with hard-coded entities? that would really be un-useful, because most buttons in my setup use templates, not only in the JS department, but fir the main entity of the button itself.

please let me know?
thanks

thanks for the beta!
I can see some broken behaviour when using it, will investigate and report back.
actually, it’s not that bad - apparently it now requires explicit mention of my entity in triggers_update

UPDATE: from my end it looks good, tried it with no triggers_update and noticed some cards not updating because they had templates that use other entities (fixed it by adding their names to triggers_update).
So it seems to work, well done!!
2 polite requests here if I may:

  1. It would be fantastic if triggers_update could accept a list or a string, just one name:
triggers_update: sensor.test

instead of

triggers_update:
  - sensor.test

or

triggers_update: [sensor.test]
  1. Please pay attention to this note - I haven’t hit by it so far as my config is tiny, but I have a feeling that for some it might be a show stopper (with the only option of lovelace_gen maybe?). Maybe you can support templates here? (I know it sounds crazy but…)

but it’s beta, hey!

Seems like triggers_update are combined when using template: so it’s jolly good!

LL is frontend it doesn’t put load on where HA is running! Nothing has changed @Mariusthvdb from what I said before in this thread.

Just to be clear, this will not change anything on the backend (= where HA is installed, a raspberry pi for example), it will only make the frontend a bit snappier (= device where you display the interface, your phone for example) if you have a lot of of button-cards :wink:

1 Like

I think you would need to make a sensor that counts the amount of lights in a given room and then use that on the card.

Thanks, I have the sensor. I just cant figure out how to get it to show that sensor in the corner like that.

Is it possible or maybe a feature request to allow a tap action on a label that is different to the main card?

I have a temperature of the room listed in a label which I would want to show something else if you tap the label.

Maybe it’s better to use a custom entity instead and put that on the card with the grid system?

You need to use the custom bit of the card to create a new section. Add your sensor state to that and it will appear. However you need to adjust the grid layout for it to appear properly.