That was an answerā¦ You cannot define a count unless you filter it manually.
Manually with a template? So the card does not even internally count the amount of entities?
Dunno. If it does - an average user cannot access this info. Does the Entities card publish anywhere a number of rows included? No.
Yes.
I was hoping that it would be possible to either access the internal count number or maybe count something like āfor s in seriesā or something, i.e. get the number of series that are being plotted. Something like that.
I have a printer that has multiple color inks. They are used to print āprofessionalā pictures.
I am successfully displaying the various ink color levels, sorted properly, lowest on top using the Auto-Entities card. I am delighted as I no longer have to guess which ink I have to order.
Two features I would like to add, I just cannot seem to figure out how.
-
Is there a way to set a level (say 20%) where the icon display changes color?
-
Is there a way to reduce the displayed entity string (using regex?) as the actual color does not show in mobile, it is too long.
I was trying to figure out how option
is used but could not figure it.
This is what I have now.
type: custom:auto-entities
card:
type: entities
title: Epson Color ink status
entities:
- entity: sensor.epson_xp_15000_series
filter:
include:
- entity_id: /.*epson_xp_15000_series_.*$/
sort:
method: state
reverse: false
numeric: true
show_empty: true
Left is how it looks on desktop, while right is on the phone.
Again, thank you for an excellent card!
Kind of this:
- entity_id: ...
options:
card_mod:
style: |
:host {
{% if states(config.entity) ..... %}
place here your styles
{% endif %}
}
This may only be achieved by using a ātemplateā option. Check for examples here.
Thank you! Where can I start learning about this ātemplateā option and the code {%}
you included?
Only by using search in this thread (I posted many examples with templates here too).
Iām trying to āgroomā the name of the sensor, to better make it fit my card. But I canāt get it working.
My sensor looks like this:
The card looks like this currently:
I would very much like to get rid of Private and Temperatue and the two paranthesis and 0:, so I made the card like this:
type: custom:auto-entities
filter:
include:
- entity_id: sensor.private_cpu_temperature
- entity_id: sensor.private_temperature_drive*
filter:
template: |-
{% for state in states.sensor -%}
{
'entity': state.entity_id,
'name': state.attributes.friendly_name | regex_replace( find='Private |Temperature \(|\)|0:', replace='' )
}
{%- endfor %}
card:
type: custom:apexcharts-card
header:
show: true
title: NAS
show_states: true
colorize_states: true
graph_span: 7d
apex_config:
legend:
show: false
all_series_config:
stroke_width: 1
type: line
curve: smooth
group_by:
duration: 6h
func: avg
If I try to use the template in deveoper tools this line
{{state_attr("sensor.private_temperature_drive_0_1","friendly_name") | regex_replace( find='Private Temperature \(|\)|0:', replace='' ) }}
gives me the right result.
So what am I doing wrong ?
You cannot specify filters like this.
Since you decided to use ātemplateā - enumerate required entities there only.
Select required entities by using smth like āselectattr(ā¦)ā.
Hello,
Is it possible to show an attribute of a filtered entity ?
I want to display the firmware version of all my Shelly devices, i can get every āfirmware updateā entities in my list but it show me āup to dateā instead of the version of the firmware.
Thanks !
Hi @Ildar_Gabdullin
Ahh, of course.
So this gave me an ok result:
type: custom:auto-entities
filter:
template: |-
{% for state in states.sensor -%}
{%- if (state.entity_id | regex_match("^sensor.private_temperature_drive_0*|^sensor.private_cpu_temperature", ignorecase=False)) -%}
{{
{
'entity': state.entity_id,
'name': state.attributes.friendly_name | regex_replace( find='Private |Temperature \(|\)|0:|Temperature', replace='' )
}
}},
{%- endif -%}
{%- endfor %}
card:
type: custom:apexcharts-card
header:
show: true
title: NAS
show_states: true
colorize_states: true
graph_span: 2d
apex_config:
legend:
show: false
all_series_config:
stroke_width: 1
type: line
curve: smooth
group_by:
duration: 1h
func: avg
I didnāt āchooseā to use templates, it was the only solution I found.
Iām very happy to hear other solutions, I think this is a bit āheavyā.
And I donāt understand your last suggestion simply due to lack of knowledge, could you elaborate please?
It appears if use the template method of filtering, I canāt apply options to the generated glance or chip. (see my example trying to apply the tap_action)
Iām trying to figure out what Iām doing wrong here applying the options a filter type of template.
Iāve tried this with mushroom āchipsā and no luck there either.
Iām trying to show recently turned off devices, and then just have a single tap to turn them back on if they were turned off by mistake and removed from a similar card that has only lights that are currently on.
Iāve tried everything I can think of and I need some help.
type: custom:auto-entities
view_layout:
grid-area: footer
show_empty: false
card:
type: glance
filter:
template: |
{% for light in states.light %}
{% if light.state == "off" and
as_timestamp(now()) - as_timestamp(light.last_changed) < 60
%}
{{ light.entity_id}},
{% endif %}
{% endfor %}
options:
tap_action:
action: toggle
sort:
method: last_updated
reverse: true
ignore_case: true
Edit: I should note this options section works for me when I use a include filter instead of a template filter.
Not possible ?
Similar question here on template filter and having options to be passed to the card.
I want to show all playing sonos players which are not in a group, or master of a group. Those playing in a group, but being no master should not show up.
This is what I got so far with @123 help:
type: custom:auto-entities
show_empty: false
card:
type: entities
filter:
template: |
{% set ns = namespace(players = []) %}
{% for player in states.media_player
| selectattr('state', 'eq', 'playing')
| selectattr('attributes.group_members', 'defined')
if player.attributes.group_members[0] == player.entity_id %}
{% set ns.players = ns.players + [player.entity_id] %}
{% endfor %}
{{ ns.players }}
This works like a charm.
Now I want this to work with mini-media-player which expects the entity to be passed as entity
and not as entities
. Just replacing type: entities
with type: custom:mini-media-player
is not working.
Passing the option entitiy: this.entity_id
is not possible as the template part seems not to accept an options
section, as @zimmer62 has pointed out above.
Any hint appreciated how to the auto-entity card to play with the mini-media-player card.
Untested:
template: |
{% for player in states.media_player
| selectattr('state', 'eq', 'playing')
| selectattr('attributes.group_members', 'defined')
if player.attributes.group_members[0] == player.entity_id %}
{{
{
'type': 'your_card',
'entity:' player.entity_id
}
}},
{% endfor %}
Check your code:
You cannot use the āfilterā option inside another āfilterā option.
This is genius. It was nearly there. I was able to figure that out.
This worked for me:
type: custom:auto-entities
show_empty: false
card:
type: entities
filter:
template: |
[
{% for player in states.media_player
| selectattr('state', 'eq', 'playing')
| selectattr('attributes.group_members', 'defined')
if player.attributes.group_members[0] == player.entity_id %}
{{
{
'type': 'custom:mini-media-player',
'entity' : player.entity_id,
'artwork' : 'full-cover',
'hide': {
'power': true,
'icon': true
},
'speaker_group': {
'platform': 'sonos',
'show_group_count': true,
'entities': [
{
'entity_id': 'media_player.ralf',
'name': 'Ralf'
},
{
'entity_id': 'media_player.bad',
'name': 'Bad'
},
{
"entity_id": "media_player.kuche",
"name": "KĆ¼che"
},
{
"entity_id": "media_player.wohnzimmer",
"name": "Wohnzimmer"
},
{
"entity_id": "media_player.eltern",
"name": "Eltern"
},
{
"entity_id": "media_player.annika",
"name": "Annika"
},
{
"entity_id": "media_player.gaste",
"name": "GƤste"
}
]
}
}
}},
{% endfor %}
]
Please help. This is kinda working in Developer tools > Template, but not in auto-entities card:
type: custom:auto-entities
card:
type: entities
filter:
template: |
{% for zone in
[
{
'friendly_name': '000001',
'valve_position': states('sensor.04_000001_heat_demand'),
'climate': states.climate.ramses_cc_01_154356_00
},
{
'friendly_name': '000002',
'valve_position': states('sensor.04_000002_heat_demand'),
'climate': states.climate.ramses_cc_01_154556_00
}
] | sort(attribute='valve_position', reverse=true)
%}{{ zone.climate }},{% endfor %}
So Iām sorting by one attribute, but I want to show another entity as the correct one in the end.
and no cardās type specified.