I creatred a button-card in another button-card. I’m a complete newbie in html and css. Can anybody explain, how to remove the white boxes around the small icons?
Is there a way to wrap these buttons to a new line within the same “card” space? instead of them being all squashed up like this?
Im using Sam’s code that Ive kinda bastardised
This is my code;
I’m sure I’m just missing something, but I don’t know what
Thanks!
EDIT: Just FYI, the top two lines are two different cards. They look a bit weird, id love to be able to get them to wrap to two lines within one card as well.
Also as I’m sure you can tell by my terminology, I know nothing about CSS etc. I can seem to work things out most of the time though if I’m pointed in the right direction LOL
I have a short question regarding show_last_changed. If I use this option, it should show me the last_changed attribute from the sensor. So far, so good.
Unfotunately after a restart of HA I get the time from the last restart, despite the dev-tools show the correct time from the last change.
Thanks @Petro for the link! In theory I know that, but I found the dev tools show the real value for last_changed and not the HA restart. That’s why I was working with this for a while now.
In the dev-tools I did a simple
{{ states.input_boolean.puppy_big_out.last_changed }} #gives the "real" timestamp from the last change
opposing to button-card that shows the HA restart timestamp (friendly format).
I use this in custom:logbook-card (link) as well, and there it shows the real value, too. Only button-card does show the value from the restart?
Can it be, that button-card works with the last_updated state attribute? That would explain the difference, but I haven’t checked…
Last changed 100% gives you the last value, which will be the restart if you restarted, it will not give you anything before the restart timestamp. When did you restart last? Paste this into your template editor and you’ll see they all match around the restart time and build up later dates. So if you restarted yesterday, most that don’t update once a day will be yesterday while the rest will be random times between yesterday and today.
{{ states | map(attribute='last_changed') | map('string') | sort | list }}
Logbook will show you the histories last changed, not what’s on the state object.
There is no last_updated attribute. There is a last_updated property. It behaves very similar to last_changed in that it will always be past your last restart.
I can’t figure out to stretch my mini-graph-card inside a button-card. There is a space between bottom of the card and the graph.
The only thing which is working is increasing the height of the row with grid-template-rows, but the aspect_ratio 1/1 isn’t kept.
Thanks @petro! I did some more checks and it is like you said. The dev-tols show the same timestamp as button-card. Must have been a mixup or me not looking close enough. So far, so good, thank you!
But I still didn’t get what I wanted. You don’t happen to know where I could get the last time an input_boolean was switched (preferrably to on) even with one or many HA restarts in between? In theory the value the logbook card is using. I can look it up in logbook card, but if you would know it right away…
There is no easy way to do it. The fastest to the goal option would be to create an input_datetime and set it in the automation that turns on the boolean.
So whenever the temperature differs from 18, I would like the button to be grey. Whenever the value equals 18, I would like it to be red.
However, the state itself is not “18”. The temperature is a state attribute.
The value has to be written differently, but I do not know how.
I have another small question: is it possible to make the font color conditional? I saw that there is color_type: card and color_type: label but I did not find a way to make the font change color.
I am asking because I am creating some buttons with text only and I do not want to color the card to highlight the current value.
But I thought one of the main features of the button-card is that the color is applied if the state condition is true and you then do not need to define a second condition.
After all, icon color and card color change without an if statement.
In Germany we have a saying, that translates to “all pathes go to Rome!” (coming from the ancient roman empire), meaning, whatever you choose, you’ll end up in Rome.
You can define the colors you want with the way you choose, it doesn’t really matter which one. Both should work. For “your” way to work, you just need to set the same style definitions as you would with the second way.
Quick additional question:
am I correct in understanding that it is possible to define background images for this button card? I saw the background changing example on github but strangely no example for a simple, permanent background, so not sure if this is possible with the animation css.