Lovelace: Button card

It loads on my PC, though the buttons don’t do anything actionable.

I think the action is call-service not service
My actions all work

Well, the one thing that stands out to me is that there is no tap_action defined in your button. As per the github page

- type: "custom:button-card"
  color_type: card
  color: rgb(223, 255, 97)
  icon: mdi:volume-plus
  tap_action:
    action: call-service
    service: media_player.volume_up
    service_data:
      entity_id: media_player.livimg_room_speaker

yeah that too lol.

Awesome - thank you two. They show up as actionable tiles now, but the service call isn’t working. I’ll work on that now. :wink: However, it still doesn’t load right on my Fire Tablet. Apparently, it’s not using the Chrome engine for Fully Kiosk, and the built-in web renderer doesn’t support custom components. I’ll have to keep digging for a solution.

I know one or two people asked on here, so here’s a link to my Home Assistant config thread, with my Lovelace configuration that makes heavy use of the button card (plus plenty of screenshots on my GitHub repo):

1 Like

I like the orgainization of the yaml file - but I presume that the UI editor doesn’t support the includes? I’m not that well versed at writing yaml, but I’m getting better. Very well done, @apop!

So - I changed the entity from the cover to calling a script. That works fine now. My next question is - can I pull the state of the cover to set the color of the button?

Another question - can I define a button that jumps to another view?

Please read the documentation, all your requests are documented there :slight_smile:

:tada::tada: Version 1.11.0 :tada::tada:

NEW FEATURES

  • Adds the CSS variable --button-card-light-color-no-temperature equivalent to --button-card-light-color but without the color temperature applied.
  • New option: unlock_users: A list of usernames allowed to unlock the button when lock: true. If undefined, everyone is allowed. (Fixes #167)
    - type: custom:button-card
      entity: switch.super_secure_switch
      lock: true
      unlock_users:
        - user1
        - user2
    
  • Support for timer entities. In the state, it will now display the time remaining while running or paused and idle while being idle. (Fixes #156)

FIXES

  • Fix ripple effect when lock is true
  • Fixes #177: name_template and entity_picture_template where not updating the button on state change
2 Likes

This is interesting. there are plenty of discussions about timers and accessing the time remaining (e.g. Display remaining seconds of timer in frontend - #15 by klogg - but only if you’re interested…)

Can I ask a very specific question? Does this display the time remaining for a timer even if the timer is started while it is still running i.e. it resets back to the initial duration and then starts counting down again?

I don’t really understand that question, specifically this part “time remaining for a timer even if the timer is started while it is still running
However, timers are kind of special entities, the time remaining is only processed in the frontend, not on the backend. The time remaining is based on the difference between now and the last time the entity was updated. The frontend is updated every second if the timer is running.

I’m not sure this answers your question, but if you clarify your question, I might be able give you a better answer :slight_smile:

@RomRider - thank you. I’m not sure how I missed that. I just need to figure out how I can get my Fire Tablet 5gen to show the component so I can dress things up a bit

HA! Yes, so some of us are just discovering that! And your following description is something that would have been useful to ‘us’ if the HA docs had included that information! But…

What I mean is if a timer is running and then it is started again while already running, the timer resets it’s duration to the original duration and begins timing again from ‘now’.

For example…

  • Start timer for 00:04:10
  • Timer runs for 00:01:30
  • Timer is started
  • Timer resets to 00:04:00
  • Timer runs for 4 minutes

In this case the frontend will not display the counting down time after the second start but will just show ‘active’.

Really, this isn’t too important, I could test it myself to find out. It is just that it is uncannily relevant to another discussion.

It will behave in the same way I’m afraid. It looks like the last_changed attribute is not updated when you start a timer that is already running. That’s more a HA core component bug… I’ll have a look if I can PR something there.

EDIT: In the meantime, you could timer.cancel and then timer.start again. Use a script to do that and instead of calling timer.start call that script from your automation or your frontend.

Hihi, I actually wanted to report a bug, but it seems it is an iOS 13 problem :stuck_out_tongue:

Everytime I press a button on the iphone it will do it again (so it cancels the previous action). When I turn a light on it will immediately turn off again. Only when doing it in fast succession it will work. Anyways nothing to do about it for now. Safari does the same thing. Though I thought lets try it on my desktop and older ios devices and it works fine there :stuck_out_tongue:

That would be more than brilliant if you managed that.
If you remember, please let me know if you do PR so that I can follow it.

LOL! No iOS13 bugs in here!

That’s why it’s still called a beta :stuck_out_tongue:

Lol I know, that is why I said, “wanted to”. But no worries, I can live with a workaround so np, the darkmode is just too awesome (and all other stuff seems to work fine).

Btw, just a question. I’m a bit confused about the operator stuff, is it used for changing an icon depending on state value? Or is it just for changing color? And if not, how can I change the icon, say I want a power icon when it is on and another icon when it is off.