gadgetchnnel / lovelace-card-templater

Custom Lovelace card which allows Jinja2 templates to be applied to other cards

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get an error box on screen updates

finity69x2 opened this issue · comments

I'm getting an occasional red error box on screen updates in the Lovelace UI.

It is fixed by doing a browser refresh.

I posted about this in the forum thread but got no response so I'm posting it here.

Here is a screenshot of the error:

ex1

What is the full template you have for the name_template?
It looks like that is referring to a sensor (it starts with "{{ states.sensor") and that sensor will also need to be added to the entities collection of the card-templater so it knows to listen for changes to it.

Here is the entire code for the card:

  - type: 'custom:card-templater'
    card:
      type: entity-filter
      show_empty: false
      card: 
        type: glance
        state_color: true
      state_filter: 
        - "on"
      entities:
        - binary_sensor.water_heater_not_ok
        - binary_sensor.ha_update_avail_template
        - binary_sensor.potential_breaking_changes
        - entity: binary_sensor.nuc_memory_usage_high
          name_template: "NUC High Memory Usage - {{ states.sensor.memory_use_percent.state }}%"
        - binary_sensor.haapi_mqtt_test
        - input_boolean.low_batteries
    entities:
      - entity: binary_sensor.nuc_memory_usage_high

And the error doesn't ever occur unless I reload lovelace for a change in the frontend config or very occasionally when I switch from the tab to another and back again. I don't remember it happening after a restart of HA.

A ctrl-F5 refresh always fixes it immediately. So I don't think the issue is caused by a missing entity to update on.

I was able to reproduce something similar to what you are seeing, and realised that this card was using an old version of card-tools which meant that it may not have worked properly with the lazy loading of cards introduced in 0.107.
I have updated this and pushed a new version, 0.0.11 0.0.12, can you please give that a try and let me know if it works for you?

i just updated to the latest version.

i'll let you know if it does or doesn't happen again.

It's been a few days now and I haven't seen the same issue since updating so I think it's probably OK to call this one solved and close it.

Thanks for the help. :)