what happens if you use:
- type: custom:hui-element
card_type: custom:auto-entities
instead. Sometimes when I notice unexplained behavior using the cards directly a stack, I use the hui-element and the issue disappears
what happens if you use:
- type: custom:hui-element
card_type: custom:auto-entities
instead. Sometimes when I notice unexplained behavior using the cards directly a stack, I use the hui-element and the issue disappears
Did not help, unfortunately. Same behaviour, the 3rd list not displayed.
all I can say is I can confirm what you are seeing. Moving that card to the top makes no difference, it is not displayed when empty.
Did also check if it shows in custom:stack-in-card, but that also has same behavior.
Guess you need to write an issue in the auto-entities repo
You are right.
Also, I think that the 2nd problem (Map + auto-entities + vertical-stack) is about the same.
btw, please check https://github.com/thomasloven/lovelace-auto-entities/issues/159, because I too had some issues with auto-entities and Map, when no entities are to be displayed.
I want a list of all entities without a unique_id. Can auto-entities somehow do that?
With a great pleasure I need to inform that this bug seems to be closed!
The empty list is displayed as it should (title only).
Hi,
I was going through a similar process with batteries, i.e. needing sorting but also wanting to have a dynamic filter based on a template. I did some looking and this is what I’ve come up with.
It might be helpful for you. I’m also sure there might be some better ways to do parts of it but this works for now.
The configuration is here…
type: 'custom:stack-in-card'
title: Battery Levels
card_mod:
style: |
h1 {
padding-bottom: 0px
}
cards:
- type: entities
card_mod:
style:
.: |
#states {
padding-top: 0px;
padding-bottom: 0px;
}
'#states fold-entity-row':
$:
'#items':
'hui-input-number-entity-row,hui-toggle-entity-row':
$:
hui-generic-entity-row$: |
state-badge {
display: none;
}
state-badge + div {
margin-left: 8px !important;
}
entities:
- type: 'custom:fold-entity-row'
head:
type: section
label: Thresholds
padding: 0
entities:
- entity: input_number.battery_low
name: Low Battery (Higher Threshold)
- entity: input_number.battery_high
name: Full Battery (Lower Threshold)
- type: 'custom:fold-entity-row'
head:
type: section
label: Options
padding: 0
entities:
- entity: input_boolean.battery_hide_full
name: Hide Full Batteries
- entity: input_boolean.battery_hide_above_low
name: Only Show Low Batteries
- entity: input_boolean.battery_colourise
name: Colourise States
- entity: input_boolean.battery_alerts
name: Low Battery Alerts
- type: 'custom:auto-entities'
card:
type: entities
card_mod:
style: |
#states {
padding-top: 0px;
}
entities:
- type: section
label: States
filter:
template: >
{% set ret = namespace(entities={}, final=[]) %} {% for entity in states
if 'battery' in entity.entity_id and entity.domain in ['sensor',
'binary_sensor'] %}
{% set incl = True %}
{% if is_state('input_boolean.battery_hide_full', 'on') %}
{% if states(entity.entity_id) | int(254) >= (states('input_number.battery_high') | int) %}
{% set incl = False %}
{% endif %}
{% endif %}
{% if is_state('input_boolean.battery_hide_above_low', 'on') and states(entity.entity_id) | int(254) >= (states('input_number.battery_low') | int) %}
{% set incl = False %}
{% endif %}
{% if incl %}
{% set ret.entities = dict(ret.entities, **{entity.entity_id: entity.state | int(254)}) %}
{% endif %}
{% endfor %} {% for key, value in ret.entities | dictsort(false,
'value') %}
{% set final = {'entity': key, 'name': (state_attr(key, 'friendly_name') | regex_replace(find='(battery|level)', replace='', ignorecase=True)).strip()} %}
{% if is_state('input_boolean.battery_colourise', 'on') %}
{% set style = ':host {color: ' %}
{% set colour = 'green' %}
{% if value < states('input_number.battery_high') | int %}
{% set colour = 'orange' %}
{% endif %}
{% if value < states('input_number.battery_low') | int %}
{% set colour = 'red' %}
{% endif %}
{% set css = {'style': style ~ colour ~ '; --paper-item-icon-color: ' ~ colour ~ ';}'} %}
{% set final = dict(final, **{'card_mod': css}) %}
{% endif %}
{% set ret.final = ret.final + [final] %}
{% endfor %} {{ ret.final }}
Hi
I have some entities with attributes “date: yyyy:mm;dd”
can i sort them?
sorry if the question has been raised already but was alot of pages to go through.
Thank you very much for sharing your work!
I got a similar list with a simpler functionality:
type: 'custom:stack-in-card'
mode: vertical
keep:
background: false
box_shadow: false
margin: true
outer_padding: false
border_radius: false
cards:
- type: 'custom:auto-entities'
card:
type: entities
title: Batteries
style: |
ha-card .card-content {
padding-bottom: 0px !important;
}
entities:
- type: button
icon: 'mdi:blank'
name: ' '
action_name: Full list
tap_action:
action: navigate
navigation_path: /lovelace/battery
unique: entity
show_empty: true
filter:
template: >
{% set WARNING_LEVEL = states('input_number.battery_level_check')|float
-%} {%- set batteries = expand('group.batteries') -%} {%- for battery in
batteries -%}
{%- set LEVEL = states(battery.entity_id)|float -%}
{%- if LEVEL <= WARNING_LEVEL -%}
{{
{ 'entity': battery.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 -%}
{%- endfor -%}
sort:
method: state
reverse: false
ignore_case: false
attribute: null
first: 0
count: 1000
numeric: true
- type: entities
style: |
ha-card .card-content {
padding-top: 0px !important;
}
entities:
- type: section
- type: 'custom:fold-entity-row'
head:
type: 'custom:decluttering-card'
template: decl_settings_entity_row
variables:
- VALUE_NAME: Settings
padding: 0
open: false
clickable: true
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;
}
The “Full list” looks like this (some fold-entity-rows are expanded), and this is not based on auto-entities-card
:
wow! that left card is amazing! could you please share that too? are those multiple entity row cards in an auto-entities setting? Really love to see what you did there.
No unfortunately.
For each row I have a decluttering card:
type: entities
title: Мобильные устройства
state_color: true
style:
.card-content:
decluttering-card:
$:
fold-entity-row:
$: |
decluttering-card {
max-width: calc(100% - 24px) !important;
}
ha-icon {
width: 24px !important;
}
.: |
ha-card .card-content {
padding-right: 10px !important;
}
entities:
- type: 'custom:decluttering-card'
template: decl_life360_battery_info_row_with_graph
variables:
- __SENSOR_BATTERY_CHARGING: binary_sensor.battery_charging_life360_ildar_iphone_5s
- __SENSOR_BATTERY: sensor.battery_life360_ildar_iphone_5s
- __SENSOR_LIFE360_UPDATE_ALERT: binary_sensor.life360_update_alert_ildar
- __DEVICE_TRACKER_LIFE360: device_tracker.life360_ildar_iphone_5s
- type: 'custom:decluttering-card'
template: decl_life360_battery_info_row_with_graph
variables:
- __SENSOR_BATTERY_CHARGING: binary_sensor.battery_charging_life360_iphone_ira
- __SENSOR_BATTERY: sensor.battery_life360_iphone_ira
- __SENSOR_LIFE360_UPDATE_ALERT: binary_sensor.life360_update_alert_irina
- __DEVICE_TRACKER_LIFE360: device_tracker.life360_iphone_ira
- type: section
- type: 'custom:decluttering-card'
template: decl_life360_battery_info_row_with_graph
variables:
- __SENSOR_BATTERY_CHARGING: binary_sensor.battery_charging_life360_mama
- __SENSOR_BATTERY: sensor.battery_life360_mama
- __SENSOR_LIFE360_UPDATE_ALERT: binary_sensor.life360_update_alert_mama
- __DEVICE_TRACKER_LIFE360: device_tracker.life360_mama
##### and so on for each battery
The “style” includes:
"fold-entity-row"
itself.A decluttering template contains two decluttering templates:
decl_life360_battery_info_row_with_graph:
default:
- __INPUT_BATTERY_LEVEL_CRITICAL: input_number.battery_level_critical
- __INPUT_BATTERY_LEVEL_WARNING: input_number.battery_level_warning
card:
type: 'custom:fold-entity-row'
head:
type: 'custom:decluttering-card'
template: decl_life360_battery_info_row
variables:
- SENSOR_BATTERY: '[[__SENSOR_BATTERY]]'
- SENSOR_BATTERY_CHARGING: '[[__SENSOR_BATTERY_CHARGING]]'
- DEVICE_TRACKER_LIFE360: '[[__DEVICE_TRACKER_LIFE360]]'
- SENSOR_LIFE360_UPDATE_ALERT: '[[__SENSOR_LIFE360_UPDATE_ALERT]]'
- INPUT_BATTERY_LEVEL_CRITICAL: '[[__INPUT_BATTERY_LEVEL_CRITICAL]]'
- INPUT_BATTERY_LEVEL_WARNING: '[[__INPUT_BATTERY_LEVEL_WARNING]]'
padding: 0
open: false
clickable: false
entities:
- type: 'custom:decluttering-card'
template: decl_conditional_graph_tmpl
variables:
- tmpl_SENSOR: '[[__SENSOR_BATTERY]]'
- tmpl_VALUE_NAME: Заряд
- tmpl_mini__VALUE_TITLE: Заряд
- tmpl_INPUT_NEW_STYLE: input_boolean.graph_mini_graph_style
- tmpl_INPUT_HOURS_TO_SHOW: input_select.graph_hours_to_show_battery
- tmpl_mini__VALUE_UPDATE_INTERVAL: 0
- tmpl_stock__VALUE_REFRESH_INTERVAL: 0
- tmpl_mini__VALUE_POINTS_PER_HOUR: 60
- tmpl_mini__VALUE_GRAPH_TYPE: line
- tmpl_mini__INPUT_SHOW_POINTS: input_boolean.graph_show_points_battery
- tmpl_mini__INPUT_SHOW_EXTREMA: input_boolean.graph_show_extrema_battery
- tmpl_mini__VALUE_SHOW_NAME: false
- tmpl_mini__VALUE_SHOW_STATE: false
- tmpl_mini__VALUE_SHOW_FILL: true
- tmpl_mini__VALUE_LINE_COLOR: orange
- tmpl_mini__VALUE_STATE_ADAPTIVE_COLOR: false
- tmpl_mini__VALUE_HEIGHT: 100
- tmpl_mini__VALUE_LOWER_BOUND: ~0
- tmpl_INPUT_REALTIME: input_boolean.service_true_value
- tmpl_mini__INPUT_SHOW_GRAPH_BACK: input_boolean.graph_show_night_battery
- tmpl_mini__SENSOR_BACK: binary_sensor.night
- tmpl_mini__INPUT_SHOW_GRAPH_BACK_2: input_boolean.service_true_value
- tmpl_mini__SENSOR_BACK_2: '[[__SENSOR_LIFE360_UPDATE_ALERT]]'
- type: divider
style:
height: 10px
width: 100%
background: none
The 1st template is:
decl_life360_battery_info_row:
card:
type: 'custom:config-template-card'
entities:
- '[[SENSOR_BATTERY_CHARGING]]'
- '[[SENSOR_BATTERY]]'
- '[[DEVICE_TRACKER_LIFE360]]'
- '[[SENSOR_LIFE360_UPDATE_ALERT]]'
- '[[INPUT_BATTERY_LEVEL_CRITICAL]]'
- '[[INPUT_BATTERY_LEVEL_WARNING]]'
row:
type: 'custom:multiple-entity-row'
entity: '[[SENSOR_BATTERY_CHARGING]]'
entities:
- entity: '[[DEVICE_TRACKER_LIFE360]]'
name: false
unit: false
- entity: '[[SENSOR_LIFE360_UPDATE_ALERT]]'
name: false
unit: false
icon: true
state_color: true
styles:
width: 18px
text-align: center
- entity: '[[DEVICE_TRACKER_LIFE360]]'
name: false
unit: false
icon: true
styles:
width: 18px
text-align: center
- entity: '[[SENSOR_BATTERY]]'
name: false
unit: false
icon: true
styles:
width: 18px
text-align: center
'--paper-item-icon-color': >-
${ parseFloat(states['[[SENSOR_BATTERY]]'].state) <=
states['[[INPUT_BATTERY_LEVEL_CRITICAL]]'].state ? "red" :
(parseFloat(states['[[SENSOR_BATTERY]]'].state) <=
states['[[INPUT_BATTERY_LEVEL_WARNING]]'].state ?
"rgb(250,218,67)" : (states['[[SENSOR_BATTERY]]'].state ===
'unknown' ? "brown" : "green"))}
- entity: '[[SENSOR_BATTERY]]'
name: заряд
unit: ''
styles:
width: 39px
text-align: center
unit: ''
icon: ''
toggle: false
show_state: false
state_header: ''
state_color: true
secondary_info:
entity: '[[DEVICE_TRACKER_LIFE360]]'
name: false
attribute: last_seen
format: relative
The 2nd template contains a code for mini-graph-card and it is too big and too offtopic here… I can share it in an appropriate thread.
ok, thanks, and the decl_life360_battery_info_row_with_graph
template?
btw, isnt the whole Idea of the decluttering card you only need to enter the Name in the card config, and then have the decluttering card do all the work?
replace:
variables:
- __SENSOR_BATTERY_CHARGING: binary_sensor.battery_charging_life360_mama
- __SENSOR_BATTERY: sensor.battery_life360_mama
- __SENSOR_LIFE360_UPDATE_ALERT: binary_sensor.life360_update_alert_mama
- __DEVICE_TRACKER_LIFE360: device_tracker.life360_mama
with
id: mama
and move the whole section to the decluttering card to use
variables:
- __SENSOR_BATTERY_CHARGING: binary_sensor.battery_charging_life360_[[id]]
- __SENSOR_BATTERY: sensor.battery_life360_[[id]]
- __SENSOR_LIFE360_UPDATE_ALERT: binary_sensor.life360_update_alert_[[id]]
- __DEVICE_TRACKER_LIFE360: device_tracker.life360_[[id]]
compare this decluttering template:
card:
type: entities
title: '[[title]] Mobile app'
show_header_toggle: false
entities:
- 'device_tracker.[[id]]'
- 'sensor.[[id]]_battery_level'
- type: custom:fold-entity-row
head:
type: section
label: Details
entities:
- type: custom:auto-entities
card:
type: entities
style: |
ha-card {
box-shadow: none;
margin: 0px -16px 0px -36px;
}
filter:
include:
- entity_id: 'sensor.[[id]]_*'
and card config using that:
- type: custom:decluttering-card
template: mobile_app
variables:
- id: mijn_mobiel
- title: Mijn mobiel
You are absolutely right, It will decrease a volume of the code.
But I decided to use templates which do not depend on sensors’ names.
I am sorry for an offtopic here…
no, its not off topic! its about using auto-entities to create magic cards like yours! have to consume that config (I’ve only tried the template-card when it came out and stopped because it bogged my system at that time, never looked back because I’ve not needed it since.) Think you would fare well with the reduced decluttering card in this particular config.
thanks!
o, and please dm me the config for the graph 2nd template
Really, the 2nd picture do not have auto-entities at all))).
That is why I call it off topic.
OK )). I was thinking about publishing the template on the forum but decided not to do it since I am not sure about “efficiency” of this code…
I’m using the auto-entities. 3 rows high & 3 wide of glance cards for my sensors. However, each row is super close together. I was wondering if anyone has ideas for how I can space/pad them out a bit?
- type: 'custom:auto-entities'
card:
type: glance
columns: 3
filter:
include:
- entity_id: binary_sensor.*contact
options:
show_last_changed: true
sort:
method: last_updated
numeric: true
count: 9
reverse: true
Try using card-mod:
type: horizontal-stack
cards:
- type: 'custom:auto-entities'
card:
type: glance
title: with card-mod
columns: 3
card_mod:
style:
.entities:
.entity:
$: |
state-badge {
margin-top: 0px;
margin-bottom: 0px;
}
.name {
margin-top: 12px !important;
}
div:not(.name) {
margin-bottom: 12px !important;
}
filter:
include:
- entity_id: '*ping_device_tracker'
options:
show_last_changed: true
sort:
method: last_updated
numeric: true
count: 9
reverse: true
- type: 'custom:auto-entities'
card:
type: glance
title: without card-mod
columns: 3
filter:
include:
- entity_id: '*ping_device_tracker'
options:
show_last_changed: true
sort:
method: last_updated
numeric: true
count: 9
reverse: true
Thank you so much @Ildar_Gabdullin! I have tried many different methods via Google & forum search (trying not to post) and this is the only method that has actually worked. If I could press thank you again I would
Hey guys. Just for starters, I really love the auto-entities-Card. However since one of the updates (not sure which one) one of my auto-entities-cards broke. I’m trying to get everything to look the way it did before. And I’m getting really close, but this little thing I cannot get my head around. And I hope someone can help.
I have a view in panel mode. In the view I have an auto entities card that shows all devices I track on my network as button cards with their IP addresses.
Before the breaking change it showed 7 columns with devies, but after it only shows 4, no matter how much space I have or what I set in my card config.
This is my config:
type: 'custom:auto-entities'
card:
type: 'custom:layout-card'
layout: horizontal
column_num: 7
view_layout: horizontal
filter:
include:
- domain: device_tracker
options:
type: 'custom:button-card'
size: 65%
show_entity_picture: true
style: |
ha-card {
background: none;
box-shadow: none;
}
styles:
grid:
- grid-template-areas: '"i" "n" "ip"'
card:
- height: 130px
- width: 130px
name:
- font-size: 13px
custom_fields:
ip:
- align-self: center
- justify-self: center
- font-size: 12px
custom_fields:
ip: |
[[[
return `<span><span style="color: var(--text-color-sensor);">IP: ${states['this.entity_id'].attributes.ip}</span></span>`
]]]
exclude:
- entity_id: device_tracker.telefoon_duncan
- entity_id: device_tracker.telefoon_sabrine
sort:
method: friendly_name
numeric: true
This shows like:
I have tried changing the column_num: 7
(which used to work) to columns: 7
and also setting min_columns: 7
or max_cols: 7
but nothing seems to change the number of columns. It always picks the default (4 cols without sidebar, 3 cols with sidebar). So I probably need to set the max_cols: 7
in some other place, but can’t find where.
However when I change the card type from custom:layout-card
to glance, it does work…
Would really appreciate some help, as I just can’t seem to figure out why it doesn’t work anymore…