No, its indented ok now, and sorts on state alright. Only thing wanted is the last-changed ordering
Hello, I could need some help with this.
I try to toggle between to cards to either show battery level for all battery entities, and a card that only shows those with level below 25 %.
The auto-entities cards work fine as they are, as long as they not part of the state-switch card. But as sone as I make them a part of a state-switch card it returns an error says: No card type configured
.
This is the card that gives the error:
- type: vertical-stack
cards:
- type: entities
entities:
- entity: input_boolean.low_battery
title: Battery level
show_header_toggle: false
- type: 'custom:state-switch'
entity: input_boolean.low_battery
states:
"on":
- type: 'custom:auto-entities'
card:
type: entities
filter:
include:
- entity_id: "*battery*"
state: "< 25"
sort:
method: state
"off":
- type: 'custom:auto-entities'
card:
type: entities
filter:
include:
- entity_id: "*battery*"
sort:
method: state
This is the code i’m trying using a grid
- type: custom:auto-entities
show_empty: false
card:
type: grid
columns: 2
square: false
card_param: cards
filter:
include:
- entity_id: sensor.livingroom_co2
options:
type: custom:mini-graph-card
hour24: true
hours_to_show: 24
font_size: 72
show:
extrema: false
fill: true
labels: false
This is the error i get
I made the same mistake.
You need to exclude >25.
Example below that I use:
type: 'custom:auto-entities'
sort:
method: state
numeric: true
card:
type: 'custom:bar-card'
severity:
- color: '#bf4040'
from: 0
to: 30
- color: '#bf9540'
from: 30.1
to: 70
- color: '#40bf40'
from: 70.1
to: 100
show_header_toggle: false
title: Batteries to Replace/Charge Now
filter:
include:
- entity_id: '*battery_level*'
exclude:
- state: '>30.1'
- name: '*State*'
- name: '*Health*'
another:
type: 'custom:auto-entities'
sort:
method: state
numeric: true
card:
type: 'custom:bar-card'
severity:
- color: '#bf4040'
from: 0
to: 30
- color: '#bf9540'
from: 30.1
to: 70
- color: '#40bf40'
from: 70.1
to: 100
show_header_toggle: false
title: Batteries to Watch
unique: true
filter:
include:
- entity_id: '*battery_level*'
exclude:
- state: '>70'
- state: <30.1
- state: unavailable
- name: '*State*'
- name: '*Health*'
and another:
type: 'custom:auto-entities'
sort:
method: state
numeric: true
card:
type: 'custom:bar-card'
severity:
- color: '#bf4040'
from: 0
to: 30
- color: '#bf9540'
from: 30.1
to: 70
- color: '#40bf40'
from: 70.1
to: 100
show_header_toggle: false
title: Batteries in Good Shape
filter:
include:
- entity_id: '*battery*'
exclude:
- state: <70.1
- state: unavailable
- name: '*State*'
- name: '*Health*'
- state: unknown
Sorry, but it did not make much difference using exclude “>25” instead of using include “<25”.
From my point of view, it looks like the problem comes when I use the combination of the “auto-entities” and the “state-switch” cards.
Using auto-entities together with the standard “condition” card works ok. I will use that one instead.
Hello sylviepipi,
mini-graph-card needs entities. auto-entities (with card_param: cards) creates an entitiy.
Here is a workaround:
...
filter:
include:
- entity_id: "*device_temp"
options:
type: custom:mini-graph-card
entity:
entities:
- this.entity_id
...
Thanks Minzel for the example, works like a charm
new day, new challenge…
have this auto-entities card:
- type: custom:auto-entities
card:
type: map
title: Maps Family abroad
show_empty: false
filter:
include:
- entity_id: person.*_address
attributes:
country_code: not nl
options:
aspect_ratio: 969
dark_mode: false
default_zoom: 14
which looks for the attribute country_code, on my adapted person entities. If that isnt ‘nl’ they should show up on a map.
thing is that when we all are in nl, and the card should be empty, and not show, it returns these errors in inspector (Safari):
dark_mode
is listed in my config, so that could be passing the show_empty
, but when on earth would the hours_to_show
be listed there…
so, several issues in 1
please have a look if you can find something wrong here.
for the sake of testing, I changed it to:
- type: custom:auto-entities
card:
type: map
title: Maps Family abroad
show_empty: false
filter:
include:
- entity_id: person.*_address
not:
attributes:
country_code: be
options:
aspect_ratio: 969
dark_mode: false
default_zoom: 14
and, since all are in nl, this shows a map with all family members. Changing the be
to nl
here, brings back the error, now in Chrome, and consistently shows an error on the entities for Map:
and even this returns the error:
- type: custom:auto-entities
card:
type: map
title: Maps Family abroad
show_empty: false
filter:
include:
- entity_id: person.*_address
attributes:
country_code: be
while using nl in the last config, shows nicely.
- type: custom:auto-entities
card:
type: custom:fold-entity-row
head:
type: section
label: test
card_param: entities
filter:
include:
- entity_id: "input_boolean.light_*_on_alarm"
options:
name: this.entity_id
instead of ‘this.entity_id’ can i get back the value of an attribute of this ?
I am trying to monitor my devices and I need the card where will be only offline devices. I crated ping binary_sensor for each of my devices.
But the issue is that I still see all my devices. Even if I add domain: binary_sensor, I still see all my binary_sensors, not just the devices I want to monitor.
type: 'custom:auto-entities'
show_empty: false
card:
type: glance
title: Offline devices
entities:
- entity: binary_sensor.eap_dg
- entity: binary_sensor.eap_sg
- entity: binary_sensor.vticnica_diy
- entity: binary_sensor.water_valve
- entity: binary_sensor.hob
- entity: binary_sensor.hood
- entity: binary_sensor.oven
- entity: binary_sensor.klima
- entity: binary_sensor.pred_kletjo
- entity: binary_sensor.rgb_dnevna
- entity: binary_sensor.ring
- entity: binary_sensor.roomba
- entity: binary_sensor.toplotna
- entity: binary_sensor.broadlink
- entity: binary_sensor.magichome
- entity: binary_sensor.chromecast
- entity: binary_sensor.ifan02
- entity: binary_sensor.podstresje
- entity: binary_sensor.senzorji_strop
- entity: binary_sensor.wled
filter:
include:
- domain: binary_sensor
state: "off"
According to this:
you may specify a “name” for each sensor.
Let it be something like "presence_%device_name%"
Then in the “auto-entities” in the "include"section specify this:
filter:
include:
- entity_id: binary_sensor.presence_*
state: off
This works, thanks. But now I have also on the card next to the name also “presence_”, so all my items have names like “presence_Hob”.
I tried to add friendly_name: Hob into the configuration, but it does not work. I also tried with id: presence_hob with the hope that this will be taken as entity_id, but again no success
In my setup:
- Specify
'name'
with some “standard” word like “presence_”, “available” etc. - Specify
'friendly_name'
using “Customization”. - In ‘auto-entities’ use something like “include: entity_id: presence_*” (as I mentioned above). As a result, all entities are listed properly (only devices & with OFF state) with their friendly names.
Can you share your ‘auto-entity’ card code? May be I will be able to help.
There is also one possibility to differ “right entity” from “wrong entities”.
For tracking devices I am using ASUSWRT - now I have 20…30 ‘device_tracker’ entities, and in ‘auto-entities’ can specify this:
include:
- domain: device_tracker
attributes:
source_type: router
since all these entities have this attribute.
For me, ASUSWRT integration is not as fast & reliable as Ping, but it works…
And this integration allows to show NEW added devices (note that with “Ping” you need to declare every device in “configuration.yaml”), but it works only with ASUS routers…
Hi, i am a beginner on this.
What I want is this.
I have some sensors (for the garbage) with data as state.
I want to show them is de actual date is equal or 1 day before.
I try this with:
(example is for date is equal, for day before I want to use “now() + 1”)
filter:
include:
- state: = now()
Is this possible? or is it totally wrong?
I also attempt this:
filter:
template: null
include:
- state: '= {{now().date()}}'
and
filter:
template: null
include:
- state: '= {{ as_timestamp (now().date()) | timestamp_custom('%d-%m-%Y') }}'
But now results
Could you try this?
template: |
{% for state in states.sensor -%}
{%- if state.entity_id | regex_match('sensor.afvalinfo_',ignorecase=False) -%}
{%- set DAY = strptime(states(state.entity_id) | timestamp_local,'%Y-%m-%d').day -%}
{%- if DAY == now().day or
DAY == now().day -1 -%}
{{ state.entity_id}},
{%- endif -%}
{%- endif -%}
{%- endfor %}
or even this with 'friendly_name'
& 'secondary_info'
:
template: |
{% for state in states.sensor -%}
{%- if state.entity_id | regex_match('sensor.afvalinfo_',ignorecase=False) -%}
{%- set DAY = strptime(states(state.entity_id) | timestamp_local,'%Y-%m-%d').day -%}
{%- if DAY == now().day or
DAY == now().day - 1 -%}
{{ {'entity': state.entity_id, 'name': state_attr(state.entity_id,'friendly_name'), 'secondary_info': 'last-changed' } }},
{%- endif -%}
{%- endif -%}
{%- endfor %}
I will try that. Thx.
Maybe a stupid question, but this is written in jinja2 language?
And do you now some good sites to learn this? or examples?
Thx. a lot
Example with "template"
filter - a list of devices with battery level <= WARNING_LEVEL.
- Icon’s color is managed by card-mod, the
"style"
property is passed to"template"
. - Value of WARNING_LEVEL is managed by slider &
"input_select"
. - A hyperlink to a view with a whole devices’ list is provided.
- Card-mod is also used for removing padding, word wrapping for the slider.
Note: translation from Russian to English is inside comments.
type: 'custom:stack-in-card'
mode: vertical
keep:
background: false
box_shadow: false
margin: false
outer_padding: false
border_radius: false
cards:
- type: 'custom:auto-entities'
card:
type: entities
title: Контроль заряда батарей ### Battery level check
entities:
- type: section
label: Список устройств ### Devices
unique: false
show_empty: true
filter:
template: >
{% set WARNING_LEVEL = states('input_number.battery_level_check') |
float -%}
{%- for state in states.sensor -%}
{%- if state.entity_id | regex_match('sensor.battery_',ignorecase=False) -%}
{%- set LEVEL = states(state.entity_id) | float -%}
{%- if LEVEL <= WARNING_LEVEL -%}
{{
{ 'entity': state.entity_id,
'secondary_info': 'last-changed',
'style': ':host { {%- if states(config.entity) == "unknown" -%}
--paper-item-icon-color: brown;
{%- elif states(config.entity) | float <= states("input_number.battery_level_critical") | float -%}
--paper-item-icon-color: red;
{%- elif states(config.entity) | float <= states("input_number.battery_level_warning") | float -%}
--paper-item-icon-color: rgb(250,218,67);
{%- else -%}
--paper-item-icon-color: green;
{%- endif %} }'
} }},
{%- endif -%}
{%- endif -%}
{%- endfor %}
sort:
method: state
reverse: false
ignore_case: false
attribute: null
first: 0
count: 1000
numeric: true
- type: entities
entities:
- type: button
icon: 'mdi:blank'
name: ' '
action_name: Полный список устройств ### All devices
tap_action:
action: navigate
navigation_path: /lovelace/battery
style: |
ha-card .card-content {
padding-top: 0px;
padding-bottom: 0px;
}
- type: entities
entities:
- type: section
- type: 'custom:fold-entity-row'
head:
type: 'custom:dummy-entity-row'
entity: sensor.test_zero_value
icon: 'mdi:cogs'
name: Настройки ## Settings
padding: 0
open: false
entities:
- type: divider
style:
height: 10px
width: 100%
background: none
- entity: input_number.battery_level_check
name: 'Уровень заряда менее, чем' ### Level less than
style:
hui-generic-entity-row:
$: |
.info.text-content {
text-overflow: unset !important;
white-space: unset !important;
}