Hey,
I’m trying to display the status in the badge card, whether “ALL” or “NONE” is in the house.
So if EVERYONE is at home, then “HOME”
When ALL are gone, then AWAY
I thought you could do that with a template sensor.
And then maybe with “unit_of_measurement”?
but somehow i don’t get any result here.
At first i create a group.all_person_group
then i create a sensor: (some of my attempts are commented out here)
- platform: template
sensors:
home_badge:
unit_of_measurement: Home
# unit_of_measurement: ${entities['group.all_person_group'].state}
# theme: >
# if (state === 'home') return 'green_badge';
# return 'grey_badge';
# unit_of_measurement: "{{ 'Zuhause' if is_state('group.all_person_group', 'home') else Abwesend }}"
# unit_of_measurement: >
# {{ 'Zuhause' if is_state('group.all_person_group', 'home') else 'Abwesend' }}
# unit_of_measurement: >
# {{ 'Zuhause' if is_state('group.all_person_group', 'home') else Abwesend }}
# unit_of_measurement: >
# {% if is_state('group.all_person_group', 'home') %}
# Zuhause
# {% else %}
# Abwesend
# {% endif %}
entity_id: group.all_person_group
friendly_name_template: >
{% if is_state('sensor.home_badge', 'home') %}
Home
{% else %}
Away
{% endif %}
value_template: >
{% if is_state('sensor.all_person_group', 'home') %}
Home
{% else %}
Away
{% endif %}
then I read that the unit_of_measurement can only be “adjusted” via customize.yaml. But I can’t do this either.
sensor.home_badge:
state_card_mode: badges
templates:
unit_of_measurement: >
{{ 'Zuhause' if is_state('sensor.home_badge', 'home') else 'Abwesend' }}
# unit_of_measurement: ${entities['sensor.home_badge'].state}
# theme: >
can this work at all?