hopefully anyone will be able to help me. Trying to redesign my HA home dashboard, and would like to use single entity for each light to toggle it and see the consumption (sensor state), but only when light is on. Otherwise sensor state should be hidden.
Here is example of my code in glance card, which does not work (resp. everything works expect state hiding when light is off:
I found this and tried to apply it, but no luckā¦
Use {% if ... %} to conditionally apply CSS styles. In this case, visibility: hidden hides the state, but keeps the space reserved. If you want to remove it entirely, use display: none.
Hi guys,
Maybe someone could check my code, please and tell me what is wrong here. The color of the room should change with color of my IKEA-bulb, but it doesnĀ“t
Where have you taken this code?
Is it taken from reddit, chatgpt etc?
Please go to the 1st post of this thraed ā link at the bottom titled āfantasticā ā Glance card, use these examples as a starting point.
This is wrong, you are using smth looking like a JS code from some custom card like button-card.
Go to the 1st post of the thread ā link at the bottom titled āfantasticā ā picture-elements
Yes, it was taken from ChatGPT. Could you please be more specific with examples? I passed through topics and did not found anything helpful for first look. My point is to have entity in Glance card with consumption when turned on:
Since in your initial post there was a wrong DOM path - using provided examples you may define a valid DOM path & then use an appropriate CSS property.
I usually use ādisplay: noneā to hide an element, know nothing about a āvisibilityā property. This might help you.
Correct, but conditionally. When light is turned off, I donāt want to show state, but when on, it shows the consumption.
Could you provide me an example please? My current entity config is as follows:
sure, this is a very mature button-card template, but it has been working for the last 5 years No issue with card_mod at all, all native inside the button-card options
cut it short: my advice would be to use the card that matches your requirements as closely as possible. Use card_mod there where nothing else will do the job. Or when really straightforward.
as for this
I already did in the post above:
just use your template there, replacing the now fixed hidden and it should do what you want, on the entity itself
haha, yes, well, my example was only used in a config where I needed 2 rows of 4 columns, and the top row only displayed 3 entities, so I needed that empty placeholder fixed.
this was the only way of doing that at the time, and, considering what I just tested with the visibility property, it still is.