I have a few map cards for my electric car, and I would like the titles of the maps to include the electric range, so I won’t have to jump up and down to check that while following my wife from charging station to charging station on longer trips, or the one today, a long trip in cool weather (just above zero - not the weather an EV enoys most) with a big trailer…
Moving the quotes inside the curly brackets gave me “object object”. So does that mean that the title simply doesn’t support any templating?
It would be even better if I could exchange the name on the car from MDT (Mastiff Device Tracker) to the sensor value, but maybe that’s not possible either?
I would not suggest placing a Map card into config-template-card (CTC).
To update itself when an entity changes (like “moved to another location”), the CTC card needs to have this entity declared as “monitored”:
But then the CTC will redraw the whole Map on every update - i.e. you can set a needed zoom or focus a needed marker - and suddenly on a next update everything is reset to default.
To avoid this redraw:
Either DO NOT declare this entity as “monitored” - but since at least ONE entity must be set as “monitored”, use any entity which is not changed frequently:
But then you will not see an updated map every time the entity is changed, you will need to refresh manually (F5).
2. OR - place the Map card into a custom auto-entities card - search in the main auto-entities thread for my example for Gauge card.
But in fact this whole thing may be avoided if you place a stock Markdown card (which supports jinja) along with a Map card into a custom stack-in-card which allows to stack cards seamlessly:
type: custom:stack-in-card
... set needed settings, check docs for stack-in-card
cards:
- type: markdown
content: ... place jinja template
- type: map
....
Here the Markdown card will play a role of your title; you will need to style a font-size etc to make it looking like a title.
I would wonder why you not just set only the entity from the template as monitored. This was the only described requirement. Why monitoring another entity?
sensor.mastiff_range_electric
This needs to be monitored and is used in the template. It is not the tracker.
My explanations give a general idea. They are not meant for a particular user entity.
As for the “sensor.mastiff_range_electric”: in case of using CTC, both entities should be declared as monitored, otherwise a user will see an outdated location of the device_tracker entity (unless he wants to press F5 for update). Note that ALL entities used inside CTC (incl. not used in templates) should be declared as “monitored”, otherwise CTC will not update an inner card if any of these entities changes . Of course this is not an obligation - just declare only really needed ones.
A quick note that with UIX 6.1.0-beta.13, UIX Forge now has a map spark with memory mode. With this you can template all map config with a memory mode so when templates update it stays at the current center and zoom.