ahh common!, let him suffer and read alittle , before you reveal it
We all need to learn & read docs ofc ))).
But some people - being great experts in some other areas - may not get things fast in programming, sad but true. This needs efforts.
Much appreciate!!!
This was the final hint!
Summary
entities:
- this.entity_id
Thanks again for all your help and patience!! Next time Iâll read the docs much more in detail before posting!
THANK YOU!!
Amazing community!
Will auto-tiles
be newly developed for lovelace sections(experimental)?
Yes you better, cause whatâs possible in one card, most likely wonât work in another, so itâs important to read the âoptions/featuresâ of the specific card ( in itâs github repos)
Youâll eventually find out which features/options you can combine, if not else, by trail and error
I have started making a new dashboard for my Home Assistant. It will have a view for each area in the house, a summary view and some views for special cases - so much like that produced by Dwainâs Dashboard or Mushroom dashboard, but as I wish it.
Firstly I made a series of summary binary_sensors, one for each area, using the ideas in this thread These sensors have counts of lights, lights_on, lights_off etc for various domains and a list of ids of the entities. So for the area named Annex we have binary_sensor.annex_summary, which looks like this:
I want to use this sensor to generate a grid of tile cards using the list of entities in the attribute lights_id, but I canât get it right.
Firstly I tried an entities card, like this
type: custom:state-switch
entity: template
template: |-
{{
state_attr('binary_sensor.annex_summary', 'lights_count') | int > 0
}}
states:
'true':
type: vertical-stack
cards:
- type: markdown
content: '### Annex lights'
- type: custom:auto-entities
show_empty: true
unique: true
filter:
template: '{{ state_attr(''binary_sensor.annex_summary'',''lights_id'') }}'
card:
type: entities
state_color: true
show_header_toggle: false
entities: null
which works fine and produces an entities card, like so:
However I want to produce a grid of tile cards (or mushroom cards), but my inability to think and speak yaml and jinja prevents that. I have tried several different possibilities gleaned from the posts of others, but canât crack it. Any and all help would be greatly appreciated.
The two approaches I have tried are:
- type: custom:auto-entities
show_empty: true
card:
type: grid
square: false
columns: 2
card_param: cards
filter:
template: |-
{%- for element in
expand(state_attr('binary_sensor.annex_summary','lights_id'))|
map(attribute='name')|list -%}
{{
{
'type': 'tile',
'entity': [element.entity_id,]
'name': state_attr(element.entity_id, 'friendly_name'),
'tap_action': '',
{'action':'more-info'}
}
}},
{%- endfor -%}
sort:
method: friendly_name
and this one
- type: custom:auto-entities
show_empty: true
unique: true
card:
type: grid
square: false
columns: 2
card_param: cards
filter:
template: |-
{% for element in
state_attr('binary_sensor.annex_summary','lights_id') -%}
{{
{
'type': 'tile',
'entity': element.entity_id,
'name': state_attr(element.entity_id, 'friendly_name'),
'tap_action': '',
{'action':'more-info'}
}
}},
{%- endfor %}
sort:
method: friendly_name
Both result in nothing being shown. Substituting a markdown card that prints the loop counter in place of the tile card definition also produces nothing, so there is something wrong with the formatting of the loop, but I donât know what.
Were you able to get the simple entity type to work? Anyone else out there that can help me? I tried â- type: simple-entityâ but itâs not working for me.
Well, after two days of struggle I have it. But donât ask me to reproduce it other than by copy & paste. There was nothing wrong with the loop, or the attribute containing the list of entity names. It was to do with presence or absence of dashes in the for loop.
type: custom:state-switch
entity: template
template: |-
{{
state_attr('binary_sensor.annex_summary', 'lights_count') | int > 0
}}
states:
'true':
type: vertical-stack
cards:
- type: markdown
content: '### Annex lights'
- type: markdown
content: |-
**Lights_id Members:**
{{ state_attr('binary_sensor.annex_summary','lights_id') }}
- type: custom:auto-entities
show_empty: true
card:
type: grid
square: false
columns: 2
card_param: cards
filter:
template: |
{%- for element in
state_attr('binary_sensor.annex_summary','lights_id') -%}
{{
{
'type' : 'tile',
'entity': element
}
}},
{%- endfor %}
sort:
method: friendly_name
- type: custom:auto-entities
show_empty: true
unique: true
card:
type: grid
columns: 2
square: false
card_param: cards
filter:
template: |
{%- for element in
state_attr('binary_sensor.annex_summary','lights_id') -%}
{{
{
'type' : 'tile',
'entity': element
}
}},
{%- endfor %}
sort:
method: friendly_name
The result is as I wanted.
Oh man, Iâve been trying to figure out how to do this for ages for my google play speakers! They donât have a group_member attribute so I was trying to figure out another way to determine if theyâre part of a group. I was thinking of just specifying the group player but whereâs the fun in that lol
I,m starting with YAML, sorry for the rocky question, I´m trying to control the auto-entities filter for my battery warning card with one input_number helper, and canât find my code error, the card is entirely ignoring the template filter that I set following (for sure badly) the card documentationâŚ
type: custom:auto-entities
card:
show_header_toggle: false
title: Battery Warning
type: entities
state_color: true
filter:
template: |
{% for state in states.sensor %}
{% if sensor.state <= "{{ states('input_number.battery_level') | int(0) }}" %}
{{ sensor.entity_id}},
{% endif %}
{% endfor %}
include:
- attributes:
device_class: battery
exclude:
- name: /[Ll]ow/
- name: /[Ss]tate/
sort:
method: state
numeric: true
Cannot use templates in templates.
Besides, states are strings & need to be converted to numbers.
Try
{% if sensor.state| int(0) <= states('input_number.battery_level') | int(0) %}
And you will have issues anyway since your template is multiline yaml and you are using â{%%}â instead of â{%â%}â in proper places.
And you need to generate a list - but you will get a string of ids separated by â,â.
Suggest to test the whole template in âDev tools â templatesâ.
Big shoutout for your awesome plugin! Itâs been a game-changer for my Home Assistant setup. Quick question - any tips on setting up a card to filter and display attribute values instead of just entity states? Thanks in advance!
Read the documentation, for the auto-entities-card ( Even the examples ) âIncludeâ, and what the included cards/entities shows, is depended upon the âcard-typeâ and maybe you need card-mod. , template-entity-row, or mushroom-template is flexible as card-option for the included entities
I have added a bit to my auto-entities card that shows the electricity consumption of a smart plug, so itâll show up if power is going through the smart plug. The default tap action for this is just showing more info, but when it shows up in the card I want to be able to tap it and have it power off the smart plug. So I added a tap_action to call service switch.turn_off and set the entity_id to the plug. However now whenever this plug is getting power the item shows up twice on the card, tapping the top one gets me more info and tapping the bottom one turns off the plug. Why is it showing up twice? I canât tell what Iâve done wrong.
square: false
type: grid
cards:
- type: custom:auto-entities
show_empty: false
card:
type: entities
entities:
- sensor.kid_room_plug_electric_consumption_a
filter:
include:
- entity_id: sensor.kid_room_plug_electric_consumption_a
state: '> 0.01'
option:
tap_action:
action: call-service
service: switch.turn_off
service_data:
entity_id: switch.kid_room_plug
exclude:
- state: < 0.02
columns: 1
title: Active Lights
The one that always shows, is the first , as you specific put it under the ârootâ entities
The second, is the one which shows up when âstate > 0.01â
Meaning every entities you specify in first will always be there
The ones you specify under filter_include, turns up upon the specified âfilter / requirementsâ
PS: Your exclude will/should âremoveâ the second entity, when the state is less than 0.02 which is kind of âconflictingâ as your include is state > 0.01 ( which is less than 0.02 )
If You only want it to show up when using power, remove the exclude
If you want âmore inforâ on the card that shows up, add " hold_action / action: more_info
Thank you very much! This did get it to work.
And I agree the logic of it all seemed really wonky, but clearly itâs because I was doing one thing wrong that I didnât realize, then to fix it did something else slightly wrong which seemed to make it work.
But with your tips I got all 25 of my entries into one statement now and I can go back and fix my overlapping logic.
Hello all! I am having a strange problem with my auto-entities cards not populating upon initially opening a view on my dashboardâŚFor example my âLightsâ view is set up to show a mushroom card of all lights currently on in the house. When I first open the app and go to this view the screen will be blank. However, if I go to another view (say a bedroom) and then back to the Lights view the cards will populate like normal. This is happening with any auto entities cards I use. Here is an example of my Lights view code:
title: Lights
icon: mdi:lightbulb
path: lights
type: custom:vertical-layout
subview: false
cards:
- type: custom:mushroom-title-card
title: Lights On
# Lights On #
- type: grid
square: false
columns: 1
cards:
- type: custom:auto-entities
card:
type: grid
square: false
columns: 2
card_param: cards
filter:
include:
- domain: light
state: 'on'
options:
type: custom:decluttering-card
template: light_card_horizontal
variables:
- entity: this.entity_id
sort:
method: area
Thanks for any tips you can provide!
Hey, thank you for the nice card. Is it possible to define a state color for my humidity sensors? But it doesnât work with this code
card:
type: entities
card_mod:
style: |
:host {
color:
{% if states(config.entity) | float <= 55 %}
default
{% elif states(config.entity) | float >= 65 %}
red
{% endif %}
;
}
cards:
type: entities
filter:
include:
- entity_id: '*humidity'
exclude: []
sort:
method: state
numeric: true
reverse: true
You should ask such question Or Search for same in the Big Card-Mod Thread !
Beside show your whole code, because this is definitely not the right way to do it ( regardless of card-mod, which btw should be moved below in the include
Before playing with auto-entities , try to reproduce same with a stock entityâs card.
And there is no such a value - âdefaultâ.