th3jesta / ha-lcars

LCARS theme for Home Assistant
MIT License
290 stars 22 forks source link

Errors in log since 2024.02 #89

Closed airwolf79 closed 9 months ago

airwolf79 commented 9 months ago

Hi there,

Since the recent update of HA to 2024.02 (or since the recent bugfix in lcars theme, I am not quite sure about the specific timing) i am getting my log file spammed with errormessages.

The specific message is: 2024-02-11 07:38:50.030 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'entity' when rendering '/ Header classes and fixes for specific card types /

Followed by the complete lcars template code. I think the problematic part is:

ha-card { padding: 0px !important; border-top-right-radius: var(--ha-card-border-radius) !important; border-top-left-radius: var(--ha-card-border-radius) !important; --mdc-theme-primary: var(--lcars-ui-secondary) !important; {% if has_value(config.entity | string) %} {% if is_state(config.entity | string, 'off') %} --state-color: var(--lcars-dark-gray); {% else %} --state-color: var(--lcars-gray); {% endif %} {% else %} --state-color: var(--lcars-dark-gray); {% endif %} }

I have removed the if-then-else part from there and the problems have gone away

I am not sure if it is a problem on my specific instance, a problem on HA side or something that can be corrected on the template side?

kwbeck commented 9 months ago

Same issue here, and removing the referenced lines also stopped the error messages for me.

th3jesta commented 9 months ago

I didn't see these errors, but it might be because I have a different logging level. Either way, the if/else block wasn't doing what I wanted it to anyway, and I prefer not changing the state-color altogether and let the icons change per their normal behavior. This is resolved in the latest release.