Thanks. I got it to work with this:
card:
type: entities
filter:
template: >-
{{states.light | selectattr('entity_id', 'in',
area_entities(states.input_select.room_selection.state)) |
map(attribute='entity_id') | list }}
BUT I cannot get custom:bubble-card to populate for entities as this doesnāt work properly, it shows ALL lights. Any ideas? Is there a way to use template without it being overriden/ignored by include?
card:
type: grid
columns: 2
square: false
card_param: cards
filter:
template: >-
{{states.light | selectattr('entity_id', 'in',
area_entities(states.input_select.room_selection.state)) |
map(attribute='entity_id') | list }}
include:
- domain: light
state: 'on'
options:
type: custom:bubble-card
card_type: button
button_type: slider
show_attribute: false
show_last_changed: true
show_state: true
exclude: []
You can use any of these combinations:
include
include + exclude
template
Means - all āoptionsā must be a part of a template.
Search here, there are ready examples.
Yeah, I think me adding the ādomain: lightā overrides my template to select only lights with the matching area name. I cannot get the options to work in template
Got it to work! Itās beautiful. That wasnāt as simple as I thought it would be.
card:
type: grid
columns: 2
square: false
card_param: cards
filter:
template: >-
{%- for s in states.light|selectattr('entity_id', 'in',
area_entities(states.input_select.room_selection.state)) -%}
{{
{
'type': 'custom:bubble-card',
'card_type': 'button',
'entity': s.entity_id,
'button_type': 'slider',
'show_last_changed': 'true',
'show_state': 'true'
}
}},
{%- endfor %}
sort:
method: state
numeric: true
mhoogenbosch
(Martijn Hoogenbosch)
September 8, 2024, 8:18am
1498
Iāve got a card counting down our birthdays (itās kinda thing within our household). got a very simple piece of code, but would like to see the whitespaces between the entities to be less.
Code:
type: custom:auto-entities
show_empty: false
card:
title: Verjaardagen
type: entities
entities: null
filter:
include:
- entity_id: sensor.verjaardag*
- entity_id: sensor.anniversar*
sort:
method: state
ignore_case: false
reverse: false
numeric: true
I have searched this topic and the github page, but canāt seem to find it, or I donāt know what iām looking for. Does anyone know how to do this?
loocd
September 8, 2024, 9:32am
1499
All you need to do is target your card element with card_mod:
card:
title: Verjaardagen
type: entities
card_mod:
style: |
#states > * {
margin: 0 !important;
}
Youāll need to have card_mod installed for this:
2 Likes
edgardmello
(Edgard Mello)
September 13, 2024, 11:24pm
1500
Try something like this:
type: custom:auto-entities
show_empty: false
card:
type: custom:layout-card
layout_type: grid
layout:
grid-template-columns: repeat(auto-fit, minmax(185px,1fr))
card_param: cards
filter:
include:
- domain: switch
area: escritorio
options:
type: tile
color: red
show_entity_picture: false
tap_action:
action: toggle
icon_tap_action:
action: more-info
exclude:
Change the filter for your needs.
I am trying to replicate sub_button and grids within grids. Any ideas how to do that with auto-entities?
Hereās an example:
square: false
type: grid
cards:
- type: custom:bubble-card
card_type: separator
name: ROOM1
sub_button:
- name: '1'
show_name: true
icon: mdi:lightbulb
show_background: false
tap_action:
action: none
- type: custom:bubble-card
card_type: separator
name: ROOM2
- square: false
type: grid
cards:
- type: custom:bubble-card
card_type: button
entity: light.living_room_floor_lamp
- type: custom:bubble-card
card_type: button
entity: light.living_room_floor_lamp
columns: 2
columns: 1
Here is what I can do now (I have it all in 1 column, but it does populate every light assigned to each room)
type: custom:auto-entities
card:
type: grid
columns: 1
square: false
card_param: cards
filter:
template: |-
{% for option in state_attr('input_select.room_selection','options') -%}
{%- if states.light|selectattr('entity_id', 'in',area_entities(option))|list|count -%}
{{
{
'type': 'custom:bubble-card',
'card_type': 'separator',
'name': option,
'card_layout': 'normal',
}
}},{%- for s in states.light|selectattr('entity_id', 'in',
area_entities(option)) -%}
{{
{
'type': 'custom:bubble-card',
'card_type': 'button',
'entity': s.entity_id,
'button_type': 'slider',
'show_last_changed': 'true',
'show_state': 'true'
}
}},
{%- endfor %}{% endif -%}
{%- endfor %}
view_layout:
position: main
mtrista
September 23, 2024, 1:23am
1502
Could you add a way to template the name? Itās very very often that when I have a group of entities that requires using this custom card, that they all share something in the name that I want to take out.
1 Like
Just wanted to share this little thing i came up with:
Auto entities lists all my areas and creates a area-card with temp, humidity and luxā¦ still working on how to get a different icon for each area, dont wanna rename my rooms, but could be a possibilityā¦
type: custom:auto-entities
filter:
template: |
[ {% for omrade in areas()|sort %}
{{
{
'type': 'custom:streamline-card',
'template': 'klimakort',
'variables': [
{'entry': omrade}
]
}
}}
,
{% endfor %} ]
include: []
exclude: []
card:
square: false
type: grid
columns: 2
show_empty: true
card_param: cards
sort: {}
and a decluttering card (streamline-cardā¦ because that has a gui-editor lol)
streamline_templates:
klimakort:
card:
type: custom:mushroom-template-card
primary: '{{area_name(''[[entry]]'') | title }}'
secondary: >-
{% set temp = (area_entities('[[entry]]') | select('is_state_attr',
'device_class', 'temperature') | map('states') | select('is_number') |
map('float') | list or [0]) | average | round(1) %}
{% set hum = (area_entities('[[entry]]') | select('is_state_attr',
'device_class', 'humidity') | map('states') | select('is_number') |
map('float') | list or [0]) | average %}
{% set lux = (area_entities('[[entry]]') | select('is_state_attr',
'device_class', 'illuminance') | map('states') | select('is_number') |
map('float') | list or [0]) | average | round(1) %}
{{ [ ('š”ļø' ~ temp|int ~ 'Ā°C') if temp, ('š§' ~ hum | int ~ '%') if hum,
('š' ~ lux | int ~ 'lx') if lux] | select() | join(' ') }}
icon: hue:room-office
entity: '[[entry]]'
fill_container: true
tap_action:
action: navigate
navigation_path: '#popup-[[entry]]'
layout: vertical
2 Likes
mtrista
September 27, 2024, 3:13pm
1504
Doesnāt the normal area card do exactly what the custom area template card youāre making does? Even shows the icons for each area
Yes it does but imo its fugly and dosent fit the rest of my design
I just activated all ālast seenā attributes of the entities:
It should be possible to sort the entities regarding to their last seen status or not?
Can anybody help me to get the correct yaml working?
I am struggling with it
edit:
got it:
type: custom:auto-entities
card:
type: entities
filter:
include:
- entity_id: sensor.*_last_seen
sort:
method: last_changed
numeric: false
reverse: false
1 Like
ggonmar
(Ggonmar)
October 9, 2024, 2:54pm
1507
Does this mean that, if I have 20 sensors with a specific attribute I want to show on this card, I need to create 20 template sensors out of that attribute to be able to use the auto entities card?
Probably that advice was given when Entities card was not supporting āattributeā.
Alright, Iāve come back to this - I have a lot of great auto-entities cards made on my dashboard now and yet itās the original one that is messing with me the worst. Hereās what Iāve got:
type: custom:auto-entities
show_empty: true
card_param: chips
card:
type: custom:mushroom-chips-card
alignment: justify
filter:
include:
- domain: scene
area: Living Room
options:
type: entity
content_info: name
tap_action:
action: toggle
exclude: []
sort:
method: friendly_name
This is nice, except that it causes the scene to toggle on instantly. This is kind of abrupt when Iām wanting to set the scene when we have guests.
Hereās the data from the chips card if I want to have it call the action to turn on a scene:
type: custom:mushroom-chips-card
chips:
- type: entity
entity: scene.SCENENAME
icon_color: accent
tap_action:
action: perform-action
perform_action: scene.turn_on
target:
entity_id: scene.SCENENAME
data:
transition: 5
Iāve tried just copying and pasting the tap-action into the options field in Auto Entities but it does not want to pick a specific entity to target. Iām not even messing with the transition value until I can get the auto entities - chips interaction to work. The syntax I used to try to accomplish that is
tap_action:
action: perform-action
perform_action: scene.turn_on
target:
entity_id: []
What am I missing?
Not using any mushrooms. Try this way:
type: custom:auto-entities
card:
type: entities
filter:
include:
- domain: switch
options:
type: simple-entity
tap_action:
action: perform-action
perform_action: switch.toggle
target:
entity_id: this.entity_id
fusterclucker:
action: perform-action
I am simply listing the scenes with their picture, like this (decluttering card template):
- type: custom:auto-entities
card:
type: grid
columns: 8
card_param: cards
filter:
include:
- domain: scene
area: '[[area_id]]'
options:
type: custom:button-card
template: button_scene
resulting in:
or with a simple listing:
- type: custom:auto-entities
card:
type: entities
title: Nu scening
card_mod:
class: class-header-margin
show_empty: false
filter:
include:
- attributes:
dynamics: dynamic_palette
resulting in
and nothing gets initiated automatically
what happens if you just leave out the action?
Edited the original post - realized I had the bad syntax in instead of the working one on the original example
@Ildar_Gabdullin why no mushroom cards? I have been using these cards since day 1 - I like the look and the ease of configuration.
@Mariusthvdb The lack of action on each button gets me a nice list on the dashboard with no way to easily apply them from the dashboard. Using
action:
action: toggle
Works, but it applies the scene with zero fade. There is no option with the toggle to have a transition - I tried.
fusterclucker:
why no mushroom cards?
Do not like round design, do not like seeing lot of space wasted.
I already proposed you a way of defining a target, did it work in your card?