Open tbrasser opened 9 months ago
I'm having similar issues, I have a config that will center text in a picture-elements card that only sometimes works. Sometimes it centers the text, sometimes it defaults to left aligned. Here is my card config. All I do to "fix" it is refresh multiple times and 1/5 times it will display correctly. Happens on the web, and in the app. Cleared cache, reinstalled apps, nothing seems to make it consistently work.
type: picture-elements
elements:
- type: conditional
conditions:
- entity: person.brian
state_not: home
elements:
- type: image
entity: person.brian
image: local/media/images/PeopleImages/Brian.jpg
style:
top: 50%
left: 50%
width: 100%
height: 100%
filter: saturate(30%)
- type: conditional
conditions:
- entity: person.brian
state: not_home
elements:
- type: image
entity: person.brian
image: local/media/images/PeopleImages/Brian.jpg
style:
top: 50%
left: 50%
width: 100%
height: 100%
filter: saturate(0)
- type: image
entity: person.brian
image: local/media/images/PeopleImages/person_background.png
style:
top: 50%
left: 50%
width: 100%
height: 100%
opacity: 0.5
- type: state-label
entity: sensor.places_brian
style:
top: 81%
left: 50%
width: 100%
color: white
font-size: 1.2em
card_mod:
style: |
div {
white-space: unset !important;
text-align: center !important;
}
- type: conditional
conditions:
- entity: person.brian
state_not: home
elements:
- type: state-label
entity: sensor.brians_iphone_travel_time
suffix: ' from home'
style:
top: 96%
left: 50%
color: white
font-size: 1.0em
image: local/media/images/PeopleImages/Brian.jpg
This is how it looks when it's broken.
And this is how it looks when it works right.
What would mine look like after changing it? I don't see anything to really change in my example. Also, I did enable card mod as an extra module in configuration.yaml but that didn't fix it either.
ok, so I just realized that I can set the style's directly in the picture elements card, so I no longer need card mod for this use case. My issue is resolved simply by putting the text-align directly under the style: section instead of inside card-mod.
Also no idea where in my lovelace / theme I'd apply that conversion, seems I already do that.
A couple of things I found:
since 2024.2.0b card mod is spasming out for a few seconds before settling to a correctly applied state. Hoped this would fix my issue at the cost of initial view loading behavior, but unfortunately it still creeps up everywhere.
I'm using card mod themes / classes
Not sure whether I can apply that simplified conversion you posted to my styles. I remember initially getting it to style the way I want by having something like this for example:
card_mod:
class: invisible
style: |
ha-card: { something: 42px; }
.:
ha-card { otherthing: -42px; }
I'm also having issues with card-mod, I'm only changing colors of icons but sometimes it doesn't work and the page needs to be refreshed a few times.
card_mod:
style: |
:host {
--paper-item-icon-color: #984ea3;
}
I'm still hitting this issue with 3.4.3. Downgrading to 3.4.1 doesn't help. So first off I believe that #85 and #346 are related.
I can consistently repro this via Chrome by having the console open in the Chrome debugger and doing a ctrl+shift+r hard reload (or with the debugger open right click on the refresh button next to the address bar). If anyone else can confirm that would be awesome.
Looking at the console output I can see that when the issue is reproed CARD-MOD 3.4.3 IS INSTALLED
shows up much later, than when the issue isn't present. So this seems to be some sort of race condition.
I have around 35 HACS frontend resources loaded. I reduced that down to 28. The issue is happening slightly less frequently but still present.
I'm also encountering this issue on the companion app on Android. This was happening on desktop as well but solved after I followed the recommendation to load card-mod.js as a frontend module. On the companion app, I've tried clearing the cache, ensuring the app is up-to-date, and I also confirmed that when I access HA from mobile chrome, it works as expected.
Edit: I noticed that the problem goes away when I clear the cache of the Android Webview app under Apps > AndroidWebview > Storage usage Maybe this is what I was missing after changing to a frontend module
Not sure if I should update here or on #400 or #346 or #359. @thomasloven any chance you've got time to just consolidate these tickets? The QA manager in me is happy to offer you a hug and a drink. ❤️
I've been running card-mod 3.4.0 to mitigate the problem outlined in this issue and the other issues I linked to above.
I updated HA to 2024.10.0 today. All of a sudden I'm hitting a bug where adding in card-mod items via the yaml editor in the UI causes them to disappear/delete if I switch over to the visual editor. If I take a look at the raw yaml file through the UI I can see the card-mod lines just fine. Someone in the HA Discord server was kind enough to forward #337 to me.
Updating card-mod to 3.4.3 fixed that issue, however I'm back to slow loading/inconsistent behavior of the UI.
My Home Assistant version: 2024.1.5 Frontend: 20240104.0
My lovelace configuration method (GUI or yaml): lovelace_gen
What I am doing: lots of card_mod and some mod-card usage.
What I expected to happen:
Card mod applying consistently:
What happened instead:
See screenshots:
I just noticed that at least on my desktop browser (where it also happens, and I was looking into the browser console) after a while (like more than a minute) the problem seems to go away, but only for that view.
Also the problem appears sometimes only on certain views and not in others (inconsistent which).
Minimal steps to reproduce:
Unsure, have tried clearing cache on affected devices. It doesn't seem to happen on ios companion app but does happen on my android 14 phone companion app and on tablets running fkb. Made sure all style keys are wrapped with card_mod:.
Here is my config: https://github.com/tbrasser/config
Error messages from the browser console:
Lots of this, but not sure if related:
By putting an X in the boxes ([]) below, I indicate that I:
[X] Understand that this is a channel for reporting bugs, not a support forum (https://community.home-assistant.io/).
[X] Have made sure I am using the latest version of the plugin.
[X] Have followed the troubleshooting steps of the "Common Problems" section of https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins.
[X] Understand that leaving one or more boxes unticked or failure to follow the template above may increase the time required to handle my bug-report, or cause it to be closed without further action.
Important note I forgot to add, closing companion app and starting it again always solves it, and it comes back only after I left the dashboard (different app or for example home assistant settings). Same on fsk, reloading start url works, albeit temporarily.