does not go in customize, it goes in lovelace on the card you are configuring. And that purely depends on the card you are using. Some cards do not accept state_image. You need to review the documentation for that.
You can’t use templates outside template fields. What you’re trying to do is piece meal configurations all over the place. This is not correct. What is listed in the documentation is what can be done. If the field in the documents does not mention templates, you cannot use templates. For glance card, you cannot dynamically change the image.
If you want to change the image dynamically on the glance card, you’d need card mod (a custom lovelace card, or a templating card) to make the change.
every time I need a dynamic config in Lovelace which isnt natively supported, I try to see if I can come up with a backend template sensor, which can then be used in the concrete Lovelace frontend.
Example, you can do something like this for entity_pictures on Person. On anything really.
marijn_picture:
value_template: >
{% set person = states.device_tracker.life360_marijn %}
{% set zones = states.zone | map(attribute='name')|list %}
{% set name = person.entity_id.split('360_')[1] %}
{% if person.state in zones %} /local/family/{{name}}_zoning.png
{% elif person.state in ['moving','driving'] %} /local/family/{{name}}_not_home.png
{% else %} /local/family/{{name}}_{{person.state|lower|replace(' ','_')}}.png
{% endif %}
And use these in your glance card. Of course it all depends on your device_trackers and composite set of these trackers. This is a value_template for a separate sensor. You could also use it as entity_picture_template elsewhere
I customized my person like this (using custom-ui) :
btw, to be precise, have a look here for what is available in native HA and customize:
in fact, biggest difference now adays is the icon_color which can be templated through custom-ui.
furthermore, custom-ui uses the browser front-end (and its processor power) while native jinja is back-end, server side processing. Depending on your hardware, and the RPi’s as advised device, it can be very welcome to use custom-ui…
Sorry for the late response. Yesterday the new Hassio update (which was done by the update button in hassio) killed my rpi4 install. So yesterday created a new image and restored last snapshot.
So what I’m getting from this thread is 3 things:
Read the docs
For customizing use addons
Educate others
The documentation is quite overwhelming…(Note! NOT a banter!). It is so extensive, that it is hard to get “to the point”. After my initial setup is done, and I finally know what makes HA tick, and how to get it to tick, I’ll try to contribute with a “HA for dummies” kinda tutorial/documentation.
@Mariusthvdb
Where do you template the sensors? Is that in a seperate yaml which you include? Do you have your config on github somewhere so I can see how you set it up?
ha, even that can be answered depending on your setup.
Depending on the Card, Lovelace can accept state dependent presentation. Meaning you then set the icon/color, what have you, in that specific card for the used entity.
But, since Lovelace doesn’t accept Jinja templating (except for the Markdown card), I tend to write/use my own (backend) template sensors, and customized entities, and use these in the Lovelace, which is pure frontend thing. All customizing is then does in the backend, no more need to burden that on the Lovelace cards.
So, the sensor I wrote above for the person picture, would be a backend template sensor. defined under
and, depending on if and how you split up your configuration, have it in the configuration.yaml (not advised, but possible) or in a dedicated file in a dedicated folder
Can someone who’s been able to get this to work post a summary of exactly where the “if” statement needs to be written? I want to have a different picture when I’m home as uposed to when away. I’ve tried to “customize” the person entity with the if statement in the JSON data field with no luck.