and many more options using card_mod. Not always as easy and straightforward I must admit, but card_mod is heavily updated and maintained (custom-ui is abandoned and not supported unfortunately. We just happen to be lucky some customizations still work…)
Hi all, I hope this is the right place for this question.
I’m trying to achieve something similar on a background for a view, where the bg image changes depending on a room’s global state (all light off / any light on).
Anyone knows if this is possible?
Worked instantly like a charm! Left those beautiful videos on my home and used my own pics for every room (each in one view), based on the state of the room. What a wonderful weekend, Huge thanks!
I have this part in Lovelace, only problem is its a tracking device.
When I’m at home there state will be home. When im away it will show different states.
How can add something that when its not home then show this image… (The part not_home)
Being that I’m trying very hard to learn this… Is this what I want to show a picture instead of my name? Currently it shows John - Home or John - Away… I’d like to use pictures instead.
AND not really sure where to put the above is this is the code I need.
no, its not, this mod is about styling the various parts of the badge.
if you want to use picture thats totally possible of course, in various ways. Here’s what I do:
homeassistant:
customize:
person.marijn: &picture
templates:
entity_picture: >
var id = entity.entity_id.split('.')[1].split('_')[0];
var sensor = 'sensor.' + id + '_picture';
if (entities[sensor]) return entities[sensor].state;
return '/local/family/' + id + '_not_home.png';
and use the anchors on all other person entities
and that uses custom-ui (to be able to use templates)
the sensor.*_picture is somewhat complex in my setup,
template:
- sensor:
- unique_id: marijn_picture
state: >-
{% set id = 'marijn' %}
{% set state = states('device_tracker.' ~ id ~ '_app') %}
{% set activity = states('sensor.' ~ id ~ '_app_activity') %}
{% set zones = states.zone|map(attribute='name')|list %}
{% if state in zones %} /local/family/{{id}}_zoning.png
{% elif activity in ['Automotive','Cycling','Walking']
and state != 'home'%} /local/family/{{id}}_not_home.png
{% else %} /local/family/{{id}}_{{state|slugify}}.png
{% endif %}
but you get the idea.
a simpler variant would be:
entity_picture: >
var id = entity.entity_id.split('.')[1];
return '/local/family/' + id + '_' + state + '.png';
but it don’t work…
I check in developer-tools/template: {{ states.media_player.android_tv.attributes.entity_picture }}
“UndefinedError: ‘homeassistant.util.read_only_dict.ReadOnlyDict object’ has no attribute ‘entity_picture’”
and if you got the wrong attribute, you should check the tab next to that, dev tools/states and see in the attributes column which attributes Are available