- template: A jinja2 template evaluating to a list of entries to include.
- include: A list of filters specifying which entities to add to the card.
- exclude: A list of filters specifying which entities to remove from the card.
NavyArmyCCU Login
spam? typo?
I have tried to find an answer, but there is already so much going on here, so maybe it was already answered:
Would it be possible to extend it to allow adding more complicated stuff in the âcardâ parameter?
I am working on an integration that will show the status of my packages. The entities have some attributes that I would like to show with the entity-attributes-card (GitHub - custom-cards/entity-attributes-card: Entity Attributes, but I am assuming this applies to a lot of other cards as well).
I have tried using the template approach, but basically I am limited to 1 line per entity, which is too limiting.
This is how 1 card looks like, I would like to have it repeated for everything the auto-entities card includes and have the possibility to use some kind of placeholders for the entity
type: entities
title: Entities card
entities:
- <entity placeholder required here>
- type: 'custom:entity-attributes-card'
entity: <entity placeholder required here>
heading_name: Name
heading_state: State
filter:
include:
- <entity placeholder required here>.Sender
You can see that on the last line I would even need to concatenate with another string.
Is that something that is already possible/that would be possible to implement?
I am stuck with the "sort::count"
property.
The property is supposed to reduce a number of displayed items.
But it does not work for me - look at this list of sensors with "unknown"
state:
type: vertical-stack
cards:
- type: 'custom:auto-entities'
card:
type: entities
unique: true
show_empty: true
filter:
include:
- domain: sensor
state: unknown
sort:
method: name
reverse: false
ignore_case: true
first: 0
count: 5
numeric: false
Here is just a part of the card - it shows more than 5 items:
Why the "count"
property does not work?
Here is a strange thing - letâs move the "sort"
options to the ârootâ level:
type: vertical-stack
cards:
- type: 'custom:auto-entities'
card:
type: entities
unique: true
show_empty: true
filter:
include:
- domain: sensor
state: unknown
sort:
method: name
reverse: false
ignore_case: true
first: 0
count: 5
numeric: false
Now it works:
Is it a bug?
Registered a new issue - "count" option works only for global sort options ¡ Issue #194 ¡ thomasloven/lovelace-auto-entities ¡ GitHub
Update (19.05 21 00:29 GMT+03): seems to be fixed in 1.9.0
Under the Sort: count: Can a variable be used instead of a static number. I would like to use an input number into the count. This way I can change how many shoe in the card.
sort:
method: state
numeric: true
count: 3
Instead like this
count: â{{states(âinput_number.daystoshowâ)}}â
Doesnât seem to work
Use "template"
feature for this.
Not sure how to do that for the count.
Hey all. Any idea why this filter is including items with the status âReplaceâ, but not those with the status âyellowâ or âoffâ? Iâve double and triple checked in the dev tools state to make sure I was using exactly the right string as what I defined, but it just seems to like some and not others.
- type: custom:auto-entities
show_empty: false
card:
type: entities
title: Devices Reporting Problems
show_header_toggle: false
filter:
include:
- entity_id: "*nest*"
state: "unavailable"
state: "Warning"
state: "grey"
state: "yellow"
state: "off"
state: "dead"
state: "disconnected"
state: "warning"
state: "critical"
state: "failing"
state: "access error"
state: "Replace"
Only the last "state"
works.
Try kind of this:
filter:
include:
- entity_id: "*nest*"
or:
state: "unavailable"
state: "Warning"
state: "grey"
...
Thank you! That got me on the right track! It turns out that the correct syntax ends up being:
- type: custom:auto-entities
show_empty: false
card:
type: entities
title: Devices Reporting Problems
show_header_toggle: false
filter:
include:
- entity_id: "*nest*"
or:
- state: "unavailable"
- state: "Warning"
- state: "grey"
- state: "yellow"
- state: "off"
- state: "dead"
- state: "disconnected"
- state: "warning"
- state: "critical"
- state: "failing"
- state: "access error"
- state: "Replace"
show_empty: false
@thomasloven The following works.
type: custom:auto-entities
card:
type: entities
filter:
include:
- type: custom:fold-entity-row
head: binary_sensor.system_ready
entities:
- input_boolean.allow_automation_execution
- sensor.hx711_custom
- sensor.mba_humidity
- sensor.mba_temperature
- entity_id: sensor.pen*
exclude: []
sort:
method: none
But is it possible to use wildcards inside the folded row by changing:
- sensor.mba_humidity
- sensor.mba_temperature
to
- sensor.mba_*
Need help with a template.
Here is an auto-entities
list of "device_tracker"
entities with "card_mod"
:
- type: custom:auto-entities
card:
type: entities
title: fixed color
filter:
template: |
{% for DEVICE in states.device_tracker -%}
{%- if is_state_attr(DEVICE.entity_id,"source_type","router") -%}
{{
{
'entity': DEVICE.entity_id,
'card_mod':
{
'style':
':host {
--paper-item-icon-color: red;
}'
}
}
}},
{%- endif -%}
{%- endfor %}
sort:
count: 7
Now letâs try to create a conditional color, something like this:
:host {
--paper-item-icon-color:
{% if ... %}
brown;
{% elif ... %}
red;
{% else %}
green;
{% endif %}
}
This "if ... else ..."
code cannot be used inside a "{{ ... }}"
template.
So letâs define the color outside the "{{ ... }}"
template.
First, letâs use some fixed color defined by using "set"
.
- type: custom:auto-entities
card:
type: entities
title: conditional color
filter:
template: |
{% for DEVICE in states.device_tracker -%}
{%- set COLOR = 'red' -%}
{%- if is_state_attr(DEVICE.entity_id,"source_type","router") -%}
{{
{
'entity': DEVICE.entity_id,
'card_mod':
{
'style':
':host {
--paper-item-icon-color: COLOR;
}'
}
}
}},
{%- endif -%}
{%- endfor %}
sort:
count: 7
Does not work. Letâs check in in the âTemplatesâ window:
{'entity': 'device_tracker.00_17_5a_23_94_49', 'card_mod': {'style': ':host {\n --paper-item-icon-color: COLOR;\n }'}},
......
Seems that the "COLOR"
variable is not recognized as a variable - it is recognized as a string âCOLORâ - probably because of using '
.
The question - how to pass this "COLOR"
value inside the template as a variable?
This code works - for the "name"
property (here I do not need to use the '
):
{% for DEVICE in states.device_tracker -%}
{%- set COLOR = 'red' -%}
{%- if is_state_attr(DEVICE.entity_id,"source_type","router") -%}
{{
{
'entity': DEVICE.entity_id,
'name': COLOR
}
}},
{%- endif -%}
{%- endfor %}
Also tried this, gives an error:
{% for DEVICE in states.device_tracker -%}
{%- set COLOR = 'red' -%}
{%- if is_state_attr(DEVICE.entity_id,"source_type","router") -%}
{{
{
'entity': DEVICE.entity_id,
'card_mod':
{
'style':
':host {
--paper-item-icon-color: '}} {{COLOR}} {{';
}'
}
}
}},
{%- endif -%}
{%- endfor %}
Updated: SOLVED!!!
'card_mod':
{
'style':
':host {
--paper-item-icon-color:' + COLOR + ';
}'
}
since you are not using a color template, and simply always return âredâ, why not use
'card_mod':
{
'style':
':host {
--paper-item-icon-color: red;
}'
}
?
btw, I believe I used this before in another place, doesnt that work anymore:
style: |
:host {
--paper-item-icon-color:
{% set id = config.entity.split('.')[1] %}
{% set repo = 'input_boolean.' + id %}
{{'gold' if is_state(repo,'on') else 'green'}}
;
}
As I wrote above, I wanted to use a conditional color:
:host {
--paper-item-icon-color:
{% if ... %}
brown;
{% elif ... %}
red;
{% else %}
green;
{% endif %}
}
But I cannot write smth like (template in template):
...
{{
...
:host {
--paper-item-icon-color:
{% if ... %}
brown;
{% elif ... %}
red;
{% else %}
green;
{% endif %}
}
...
}}
..
So I need to define the "COLOR"
outside the "{{ ... }}"
code.
And I started with a simple case:
...
{%- set COLOR = 'red' -%}
...
{{
... use COLOR
}}
...
The final goal is:
..
{%- if ... -%}
{%- set COLOR = 'brown' -%}
{%- elif ... -%}
{%- set COLOR = 'red' -%}
{%- else -%}
{%- set COLOR = 'green' -%}
{%- endif -%}
...
{{
... use COLOR
}}
...
think I remember now. the card-mod I posted above did work just fine, but only on refresh of the view. I think.
using custom-ui makes it instantaneous âŚ
sensor.github_*:
templates:
icon_color: >
var id = entity.entity_id.split('.')[1];
var repo = 'input_boolean.' + id;
if (entities[repo] && entities[repo].state == 'on') return 'gold';
return 'green';
Good point of using something like Custom UI to define things like icon, iconâs color in ONE place solves a lot of problem - I do not need to code a style everywhere.
Have not started yet to learn Custom UI - will ask for your advice regarding it a bit later when will be ready, thank you very much for help))
I have a rather challenging question. Is it possible (maybe with a template) to filter out entities based on name BUT only show the first match?
For example: when I pair a Zigbee device, like a button or light, it has multiple entities with extra sensors. They all share the first part of the name, for example 0x0017880108f72158
. But they all has something behind it, like 0x0017880108f72158_action
and 0x0017880108f72158_battery
.
What I would like to do is to catch the first entity/name that matches the friendly name that has that part in the name. It doesnât matter which one matches, as long as it just takes ONE and ignores the rest.
Now here is the challenging part: the name 0x0017880108f72158
is different each time. So I want to use:
filter:
include:
- name: 0x*
But then filter so it only shows the first one that matches a name, that the others also have. For now I use the sort
option count
, but then I only get one if there are multiple devices (so that have a completely different name starting with 0x*
.
Is something like this possible? Basically: match 0x*
but only one per match, if that makes any sense.
Hello!
I have a question. I want to achieve somewhat simple setup. I want to have fold entities auto populated with auto entity like here:
But with toggles for the sections.
I played with static fold entity and was able to get whatâs in the screenshot but I donât know how to use auto-entity to get entities for the fold row.
I know I could have the toggle for the section if I would for example create light group with all entities for area but I was thinking if there is a way to do it without this step.
Nonetheless, fantastic work as always. I just love to get back to some of the cards and see how far theyâve come since last time I played with them
Can someone please tell me why I get a no service has been selected with this code?
- type: custom:auto-entities
show_empty: false
card:
type: entities
title: Sensors
filter:
include:
- entity_id: "sensor.dals_*"
state: "on" # Remember that "on" and "off" are magic in yaml, and must always be quoted
options:
tap_action:
action: call-service
service_template: "{{ state_attr('this.entity_id', 'script') }}" ```
Because, just like it says, no service has been selected. You have an action
and a service_template
. You still need to add a service
veriable in the tap_action: Scripts - Home Assistant