Thanks Marius and Ildar_Gabdullin
Will indeed give it a try, eager to learn, just love the possibilities.
But wont be able to try till Sunday, will let you know how I progress.
Regards,
Frank
Thanks Marius and Ildar_Gabdullin
Will indeed give it a try, eager to learn, just love the possibilities.
But wont be able to try till Sunday, will let you know how I progress.
Regards,
Frank
Hi Marius,
Little later than Sunday, but here is my solution following your guidance.
type: 'custom:auto-entities'
card:
type: entities
filter:
include:
- entity_id: sensor.temp*_batterijniveau*
state: < 101
options:
type: 'custom:template-entity-row'
state: |
{{states(config.entity)}}{{' %'}}
name: |
{{config.entity.split('_')[-1]|capitalize}}
secondary: >
{{ as_timestamp(states[config.entity].last_changed)|
timestamp_custom('%d %b %X') }}
sort:
method: state
reverse: false
numeric: true
As you can see I left out the split part batterijniveau_ I had another underscore following in 2 of my sensors namely Lcd_ So I came up with the split to use only the underscore and the [-1] part, show only the last split and it works. as a bonus I added the secondary info, although this was a little bit different in format as you can see than the regular config.entity.atrributes…
An here the result:
Ofcourse the cutoff value has to be set about 20% or so, for this example it was set to 101% show all…
Regards and thanks.
Frank
Hi,
Did someone now if you can set a fix height to the auto-entities card?
I have is a glance card that is sometimes empty (that’s good),
I have the “show_empty:” on true,
But when the card is empty, the height of the card is not the same height else when there are entities in it.
stuck really, editing an older card of mine, which wont show the geo_location entities anymore…
filter:
template: |
{% set km = states('input_number.quakes_near')|float %}
{% set location = states('input_select.quakes_near') %}
{% for s in states.geo_location|selectattr('attributes.source','eq','usgs_earthquakes_feed') %}
{% if distance(s.entity_id,location) < km %}
{{- s.entity_id -}}
{% endif %}
{% endfor %}
gives me the error:
Either entities or geo_location_sources must be specified
the geo_location entity is live, and the the template is correct:
so where is the error here…
odd thing is, it does show sometimes…:
please have a close look with me,
thanks!
Cannot reproduce it with geo_location, but it works with device_tracker.life360*.
yeah, Petro helped me out, it should be done with a namespace template:
template: >
{%- set ns = namespace(quakes_near=[]) %}
{% set km = states('input_number.quakes_near')|float %}
{% set location = states('input_select.quakes_near') %}
{% for s in states.geo_location|selectattr('attributes.source','eq','usgs_earthquakes_feed')
if distance(s.entity_id,location) < km %}
{% set ns.quakes_near = ns.quakes_near + s.entity_id %}
{% endfor %}
{{ns.quakes_near}}
though I believed the other template to also create a true list because the empty list showed as [] in the editor, it probably doesn’t… this should be correct., only thing is I can not really test it, because there’s no quakes near at the moment
I am trying to populate the entities with filter: template:
but I would like to change the display name of each entity based on their entity_id. It seems like something using options:
as in this solution. It just seems like options:
won’t work with filter: template:
. I am open to any approach to solve this problem.
Basically I am trying to display all the settings I have configured by room, or by behavior (motion light activation, circadian/adaptive lighting, etc.) but I have to display the input_boolean/input_select/input_switch with a different name for each of these configuration methods. When showing settings by room, I need to display the behavior as the display name of the settings entity. When showing settings by behavior, I need to display the room as the display name of the settings entity.
I created this template which gathers the data I need into lists, but I’m not sure what the best way to turn this into the display I am aiming for.
{% if states('input_select.settings_behavior') == "Motion Activation" %}
{% set behavior_entity_type = 'input_boolean' %}
{% set behavior_regex = '\'input_boolean\.((?!motion_lights)[^\'])+\',?' %}
{% elif states('input_select.settings_behavior') == "Natural Lighting" %}
{% set behavior_entity_type = 'switch' %}
{% set behavior_regex = '\'switch\.((?!adaptive_lighting_(?!adapt|sleep))[^\'])+\',?' %}
{% endif %}
{% set entity_list = (states[behavior_entity_type] | map(attribute='entity_id') | list | regex_replace(behavior_regex)) %}
{% set area_list = (entity_list | regex_replace('input_boolean.motion_lights_')) %}
{{ [entity_list, area_list] | regex_replace('"\[','[') | regex_replace('\]"',']') }}
I also tried using config-template-card
to create do the switching, but I’m having trouble getting this working.
- type: entities
entities:
- input_select.settings_behavior
- type: custom:config-template-card
entities:
- input_select.settings_behavior
variables:
behavior_prefix: |
if (states[ 'input_select.settings_behavior' ].state === "Motion Activation") {
return 'input_boolean.motion_lights_';
} else if (states[ 'input_select.settings_behavior' ] === "Natural Lighting") {
return 'switch.adaptive_lighting_';
}
behavior_regex: |
if (states[ 'input_select.settings_behavior' ].state === "Motion Activation") {
return 'input_boolean.motion_lights*';
} else if (states[ 'input_select.settings_behavior' ] === "Natural Lighting") {
return '/switch\.adaptive_lighting_(?!adapt|sleep)/';
}
card:
type: custom:auto-entities
card:
type: custom:auto-entities
card:
type: entities
title: 'Areas'
filter:
include:
- entity_id: ${behavior_regex}
options:
type: 'custom:template-entity-row'
name: |
{{ config.entity.split(${behavior_prefix})[-1] | regex_replace('_', ' ') | capitalize }}
The only other way I can think to do it is with a very big custom:state-switch
card containing a bunch of auto-entities cards. Which seems like a headache to come back to if I need to add more settings.
First of all, a huge thank you to @thomasloven for this fabulous card.
I confess to not having read all the posts, so please bear with me if my question has already been answered.
I would love to be able to sort by the most recent entry. Is that already possible?
Do you mean "last-changed"
?
No, I mean last added to HA.
I do not know any exposed property expressing a “creation time” for entity.
If it is not present - then it is not possible to sort by it.
So, first find out about this property.
Could someone help me I can NOT figure out how to make the background transparent on this card. With my code as is the background is transparent when in the editor. soon as I save it does not show as transparent.
type: 'custom:auto-entities'
show_empty: false
style: |
ha-card {
background-color: transparent;
}
card:
type: entities
title: Currently On / Running
show_header_toggle: false
style: |
ha-card {
background-color: transparent;
}
filter:
include:
- domain: light
- domain: switch
exclude:
- state: 'off'
- state: unavailable
- entity_id: light.desk_wall_right_light
- entity_id: light.desk_wall_left_light
- entity_id: light.wood_stove_l_e_ds
- entity_id: light.fam_tv_l_e_ds
- entity_id: light.family_room_wall_l_e_ds
- entity_id: switch.g3syn_home_mode
- entity_id: light.his_bed_l_e_ds
- entity_id: light.his_room_access_point
- entity_id: light.my_lights
- entity_id: light.google_wifi_ap_a
- entity_id: light.google_wifi_ap_b
- entity_id: light.family_room_bulb_1
- entity_id: light.family_room_bulb_2
- entity_id: light.family_room_bulb_3
- entity_id: light.family_room_bulb_4
- entity_id: light.fire_side_bulb_1
- entity_id: light.fire_side_bulb_2
- entity_id: light.fire_side_bulb_3
- entity_id: light.boiler_room_bulb_1
- entity_id: light.boiler_room_bulb_2
- entity_id: light.basment_bulbs
- entity_id: light.fire_side_bulbs
- entity_id: light.family_room_bulbs
But does it still work after you save and return to the dashboard? Soon as I do it reverts to the default theme even with red. This is really messing with me as even when i go back to “edit” it will blink red and go back to the dark mode default. I have MANY cards on my setup and this one is the ONLY 1 that wont go transparent.
I do not see any flickering.
I tested this case with a card which is not placed inside some other card.
Could you provide a whole code for your card?
Also, I am using a default Lovelace theme.
OMG, you were 100% right! I moved it to a stand-alone card and BOOM it worked! HTF I did not try that months ago I don’t know… Thank you so much go’s to show some times you just need a kick in the but. haha
Is there a way to also automatically list all attributes from an entity? An auto-attributes
card, if you so like?
Hey, is there a way to always show the newest “entry”, i.e. just showing one entry? Using layout cards it is supposed to always show the media control card of the device it is currently playing on, but due to the Spotify Integration, there are always two - The normal spotify one, and then the one from the device it is actually playing on.
Any help?
spam? typo?