almost got to the point where I can uninstall my own custom-ui plugin… but this is a diffult challenge.
I’ve set a customize template on the person entity pictures to show a grayscale version when the state is not_home
homeassistant:
customize_domain:
person:
templates:
entity_picture: >
var id = entity.entity_id.split('.')[1];
return state === 'not_home'
? '/local/family/' + id + '_not_home.png' : '/local/family/' + id + '.jpg';
this makes the person entities show like that in every card config we use it in, especially useful for the Map card (either as panel, or signal card)
I am already using this in the regular entities cards:
style:
hui-generic-entity-row:
$: |
state-badge {
filter:
{{'grayscale(100%)' if not is_state(config.entity,'home') else 'none'}};
}
or in glance:
# not_home_picture_glance:
style: |
state-badge {
filter:
{{'grayscale(100%)' if not is_state(config.entity,'home') else 'none'}};
}
and that is just perfect.
But I cant make it happen via card_mod on a map-card like that, or in the more-info of a person entity, showing that map.
My last hope would be to set it generically in card-mod-theme , but need some help. would this be doable?
the only other option I see is too completely copy the person entity to a template sensor, and add an entity_picture template, and use those in the maps… hardly elegant, no css grayscale but hardcoded, though 100% core
Template entity on Person entity with grayscale picture
- unique_id: marijn_locatie
<<: &locatie
state: >
{% set id = this.attributes.get('id') %}
{{states('device_tracker.'~id)|replace('_',' ')|title}}
picture: >
{% set id = this.attributes.get('id') %}
{% if states('person.'~id) == 'not_home' %}
/local/family/{{id}}_not_home.png
{% else %} /local/family/{{id}}.jpg
{% endif %}
attributes:
# id: marijn
# <<: &locatie_attributen
location: >
{% set id = this.attributes.get('id') %}
{% set sensor = 'sensor.'~id~'_geocoded_location' %}
{{state_attr(sensor,'Name')}} {{state_attr(sensor,'Postal Code')}}
{{state_attr(sensor,'Locality')}}
country_code: >
{% set id = this.attributes.get('id') %}
{{state_attr('sensor.'~id~'_geocoded_location','ISO Country Code')|lower}}
country: >
{% set id = this.attributes.get('id') %}
{{state_attr('sensor.'~id~'_geocoded_location','Country')}}
latitude: >
{% set id = this.attributes.get('id') %}
{% set track = 'device_tracker.'~id %}
{{state_attr(track,'latitude')}}
longitude: >
{% set id = this.attributes.get('id') %}
{% set track = 'device_tracker.'~id %}
{{state_attr(track,'longitude')}}