📝 100% Templatable Lovelace Configurations

Sorry I know you are busy @Ildar_Gabdullin but I just want to know if have I hit a dead end with this redraw thing now as I short of reading the code I don’t know where to go with it, and no other card seems to claim to do it so it rather kills the project I’m doing if I can’t solve this. The only other option is to reload the whole dashboard every minute and that will look awful.

Cheers
—Chris

Chris, I am leaving tomorrow for my next shift, so rather limited with time…
Let’s continue this later after a couple of weeks.
I will give you a ready example of a graph card with a dynamic title then.
Please ping me then.

As a starting point:

type: custom:stack-in-card
cards:
  - type: markdown
    content: >-
      Weather is {{states('weather.home_gismeteo')}}
    card_mod:
      style: |
        ha-card {
          font-size: var(--ha-card-header-font-size, 24px)
        }
  - type: history-graph
    entities:
      - entity: sensor.system_monitor_processor_use

Just place “apexharts” instead of “history-graph” card.
Then figure out how to re-write your js-code to jinja.

No worries, will do, thank you! I actually already have it in Jinja so that’s quite quick to do. I’m not sure how that will hide the chart dynamically when the data becomes zero using CSS but I’ll have a play with this all and see if it can have templated styles or something (the main purpose of what I’m doing, the heading is just me being lazy)

I have also just discovered that apex charts has an update interval configuration item (I knew the main apexcharts.js library had an update method but as it’s wrapped up in a card I can’t run it), but I suspect this just redraws the data bars on the chart and doesn’t redraw the card/chart itself (and thus doesn’t reevaluate the css style applied in the card config)

But that might provide me with a workaround if I am wrong on how I think it works.

Thanks again

Chris

Interesting, does it mean that the card updates itself not on every entity’s change - but periodically? (I mean the graph itself, not the scale which is supposed to be “shifted left”)

As for the “hide dynamically” part - do you need to hide the whole card (with a title) or the graph only? Alternatively you may want to show smth different instead of the graph card.

And also discussing card-mod seems to be off-topic here.
In general:

type: entity
entity: sun.sun
card_mod:
  style: |
    {% if .... -%}
    ha-card {display: none}
    {%- endif %}

Yes that does apparently update content periodically. It’s supposed to update when the entity updates but it’s not, same as CTC isn’t. But this seems to force a refresh at a time

I want the title and the graph to disappear. I’m using card mod inside apex chart card as the apex chart card doesn’t have its own style configuration option so if you want to play with css you use that (it has hundreds of styling configurations but nowhere can you set css display to none, it’s all line colours and stuff)

Update in case you see it / to save you testing. After a couple of days it just started refreshing, and hiding/unhiding as it is supposed to. I will check it properly over this week (I need the rain to start and stop a few times!) but my suspicion is that I have been fighting browser cache issues. I usually dev in private browsing to avoid these issues but just realised that I haven’t been recently, my tabs are accidentally normal tabs.

I just noticed today that it had started working as expected (I think) so fingers crossed I have resolved the no-redraw problems I had!

when will I learn that complex dashboards in Lovelace must have browser cache clear before bug hunting

Will update when sure either way

Chris