Hey guys Iām new here, I saw someone using sections in his auto entities card and I canāt seem to find the documentation about it. Can anyone please point me to how can I add sections to my auto entities cards?
Hi. Is there a way to count how many entities there are in the result? For example if I set up som filter to warn me about low batteries etc it would be nice if I was able to print āYou have xx warningsā
Surely in some cases template-entity-row is the simplest solution, it depends.
Not to mention a fact that ālast-changedā label is NOT periodically updated for template-entity-row (only when a state changes or a page refreshed) as it is for a conventional entity row (periodically).
tbh I always use the last-changed on states in the config.entity, so they are always correctly updated. you might be right for other situations, I confess I bever watched that. Should be an important aspect in choosing the right card.
See this rather complex composite of card_mod_theme, card_mod and template-entity-row. whish I could be simplerā¦
luckily, we can just completely throw it inside an anchor and repeat for the another entity::
type: entities
title: Luchtreinigers
card_mod:
class: class-header-margin
entities:
- type: custom:template-entity-row
# https://community.home-assistant.io/t/card-mod-add-css-styles-to-any-lovelace-card/120744/2182
entity: fan.luchtreiniger_hall
<<: &fan
# color: >
# {{iif(states[config.entity].state == 'on','red','black')}}
name: >
{% if states[config.entity] is not none %}
{{state_attr(config.entity,'friendly_name').split(' ')[1]}}:
{% set id = states[config.entity].object_id %}
Air quality:
{% if states('sensor.' ~ id ~ '_air_quality') in ['unknown','unavailable'] %}
{% if states[config.entity].state == 'on' %} Initializing
{% else %} Off {# Device not ready #}
{% endif %}
{% else %} {{states('sensor.' ~ id ~ '_air_quality')}} Āµg/mĀ³
{% endif %}
{% else %} Not yet set
{% endif %}
secondary: >
{% if states[config.entity] is not none %}
{% set id = states[config.entity].object_id %}
{% if states[config.entity].state == 'on' %}
On: {{states[config.entity].attributes.percentage}} -
{% else %} Off since {{relative_time(states[config.entity].last_changed)}} -
{% endif %}
{% else %} Not yet set -
{% endif %}
Power: {{states('sensor.' + id + '_device_power')}} W
card_mod:
style:
div#wrapper: |
state-badge {
{% if is_state(config.entity,'on') %}
animation: rotation 2s linear infinite, colorize 5s linear forwards 1;
{% endif %}
}
@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes colorize {
0% {
background: steelblue;
}
100% {
background: aquamarine;
}
}
# state: >
# {{iif(is_state(config.entity,'on'),'Aan','Uit')}}
icon: >
{{is_state(config.entity,'on')|iif('mdi:fan','mdi:fan-off')}}
# icon: >
# {{'mdi:record-circle-outline' if is_state(config.entity,'on') else 'mdi:fan-off'}}
toggle: true
- type: custom:template-entity-row
entity: fan.luchtreiniger_woonkamer
<<: *fan
Thanks, I thought it was possible with som sort of template. I just didnāt know i could use the filter when i created the template. I will have to look into that since iām quite new to the coding part of HA (where you can do all the cool stuff)