Gauge Card name: not updating?

This is the yaml for my Gauge:

type: custom:config-template-card
entities: sensor.givtcp_sa2219g385_soc
card:
  type: gauge
  entity: sensor.givtcp_sa2219g385_soc
  name: ${ states['sensor.my_givenergy_battery_state'].state }
  severity:
    green: 50
    yellow: 20
    red: 0
  needle: true
  min: 0
  max: 100

Although the sensor sensor.my_givenergy_battery_state updates instantly (as seen by watching Development Tools | States | filter=my_givenergy_battery_state), the Gauge Card display does not?

Is it possible to somehow force a refresh of the Gauge Card or the whole Dashboard when sensor.my_givenergy_battery_state changes?

Regards, Martin

you have to add the entity to watch, when the state changed…

As it was already advised, you need to declare the as entity as monitored, and the way you did it could be wrong (away from pc, cannot say for sure). The option expects a list, you defined a single string. You need to define a list containing 2 entities - for the gauge itself and for a name.
But there is another issue here which you probably have not faced yet - on every change of the entity the whole gauge card will be redrawn causing the needle “jumping”.
To avoid this, consider using auto-entities card instead of config-template. Go to the main auto-entities thread, search by “gauge” keyword to find my post with a solution.

You could also consider Ring Tile Card which has lots of OOB config options. I think it will give what you need as you can have the main entity as one entity and then an alternate entity for the ring. So you would choose sensor.my_givenergy_battery_state for the main entity and sensor.givtcp_sa2219g385_soc for the ring.

Thank you for the suggestion. I have tried hunting for the example you refer to. With no luck. Could you offer a direct link please?

Regards, M.

Cannot give a link, typing from a mobile.
But here is a rather long way to get to the point - and you will also get other useful info:
Main cardmod thread in Share your projects - 1st post - fantastic link at the bottom - auto- entities - this will take you to my consolidated post in auto-entities thread which contains a link to the gauge solution.

Thanks very much for you patience,

But I’m sorry for my incompetence! But I can’t find what I’m looking for?
If you remember, maybe you could find a link when you are back at the PC?
I’ll wait…

Regards, M.

Sorry, can’t you find the main cardmod thread? Will be able to give you a link in a few weeks. Perhaps you should try searching harder.

Hopefully this isn’t sarcasm

Here is the link

Detailed guides provided by @Ildar_Gabdullin are conveniently defined by each card type.

1 Like

No. It most definitely is NOT sarcasm.

It is a beginner trying to find some logic in a sea of conflicting, jumbled-up and miss-spelled threads. I am genuinely grateful to all who are trying to help. My problem here, is that advice being given is little vague and what I am finding does not match with what I would expect. For example, I assume that the link to “main cardmod [sic] thread” is this:

Then search for “Guage”, and the examples that are suggested are these:

Unfortunately (as far as I can see), none of those four show example of:

type: custom:config-template-card

Additionally (although I nearly always get abuse for quoting), ChatGPT has this to say:

“Unfortunately, custom:auto-entities cannot replace dynamic values like ${...} in the name field the way config-template-card can. The auto-entities plugin is mainly used to dynamically select entities (based on filters) and insert them into card parameters like entities, entity, or cards.

It does not evaluate templates or expressions, and it cannot dynamically modify attributes inside a card, such as the name field using another entity’s state.”.

Whether this is true or not, it does introduce the possibility that I am chasing a “red hearing”?

Best regards, M.

But I suggested you to go to the auto-entities section of that consolidation post.
Then you will get a link in auto-entities thread as was promised. Your solution has nothing with cardmod, but that cardmod consilidation post is the only place where a link to my auto-entities collection link is posted)
As I said, do not have Pc nearby, so that was the easiest way to give you a pointer.

We are here to help and I assure you, WE are pointing you in the right direction.

Auto-Entities will work with dynamic values

Directly from GitHub

Templates also give a great opportunity for customization:

type: custom:auto-entities
card:
  type: entities
filter:
  template: |
    [{% for e in area_entities("bedroom") %}
      {'entity': '{{e}}',
       'name': 'Lamp at {{device_attr(e, "name").removesuffix("Light").removesuffix("Lights")}}',
      },
    {% endfor %}]

Thank you all very much. I need a rest now.
And anyway … I quite like the needle jumping. It tells me the program hasn’t frozen!

M.

Also note that you are using a custom card on your own risk. Every new update of HA may bring issues into a custom card and even a card’s author may not know about a possible reason.