that card doesnt sort, because the auto-entities doesn’t do anything there, this probably shows the same:
type: horizontal-stack
cards:
- type: picture-entity
entity: sensor.afvalwijzer_gft
image: /local/afvalwijzer/GFT.png
show_name: false
- type: picture-entity
entity: sensor.afvalwijzer_papier
image: /local/afvalwijzer/Papier.png
show_name: false
- type: picture-entity
entity: sensor.afvalwijzer_pmd
image: /local/afvalwijzer/PMD.png
show_name: false
- type: picture-entity
entity: sensor.afvalwijzer_restafval
image: /local/afvalwijzer/Restafval.png
show_name: false
since that is a fixed horizontal-stack, the sort option has no effect.
It is a much seen mistake, people adding only a list of entities, in stead of using the magic of auto-entities, based on a filter
I am using this as base selector:
- type: custom:auto-entities
card:
type: entities
filter:
exclude:
- entity_id: sensor.afvalwijzer*next*
- entity_id: sensor.afvalwijzer_*orgen
- entity_id: sensor.afvalwijzer_v*
include:
- entity_id: sensor.afvalwijzer_*
options:
and, under the bottom options there declare which card I want to populate with the entities, in my case type: custom:template-entity-row
if you’d want to populate a horizontal-stack
or ‘grid’ like below, with type:picture-entity
as follows.
(mind you, it is a bit complex to auto display those images, as we really need to set an explicit image source on the type: picture-entity
as it wont auto-show the available entity-picture unfortunately. Please see this as an exercise because of that)
type: custom:auto-entities
card:
type: grid
title: Auto populate cards
card_param: cards
filter:
include:
- entity_id: sensor.afvalwijzer*
options:
type: custom:hui-element
card_type: button
show_state: true
show_name: true
in the above auto-entities, you can set other options, excludes etc etc now based on the state of the entities
if you dont want it to show entities with state ‘green’, simply instruct the auto-entities include options:
you can get crafty (as said, its more complex…) and use the template filter:
type: custom:auto-entities
card:
type: horizontal-stack
title: Auto populate cards
card_param: cards
filter:
template: >
[{% for s in integration_entities('afvalwijzer') %}
{% if state_attr(s,'entity_picture') is not none %}
{{
{
'type': 'picture-entity',
'entity': s,
'image': state_attr(s,'entity_picture')
}
}},
{% endif %}
{%- endfor %}]
or. you can move the complete styling to eg custom: button-card
and return to the easier includes/excludes:
type: custom:auto-entities
card:
type: grid
columns: 4
card_param: cards
filter:
include:
- integration: afvalwijzer
options:
type: custom:button-card
show_state: true
template: button_picture
exclude:
- entity_id: sensor.afvalwijzer*next*
- entity_id: sensor.afvalwijzer_*orgen
- entity_id: sensor.afvalwijzer_v*
sort:
method: state
options galore