If you re-open the popup, does the custom_field work then? So if you press the button and the icon should turn into lightbulb, then close popup, then open again. If it’s changed, then this is due to browser_mod. It doesn’t update the icon when in a popup.
Hi
I am trying to set this up to show my Steams games when they are on sale, which I have working, however I would like to see the normal price and the sale price, but I cannot seem to get it working.
I have gone through this thread and tried to format the code but I am obviously not getting it.
type: custom:auto-entities
show_empty: false
card:
title: Steam Wishlist On Sale
type: entities
filter:
include:
- entity_id: binary_sensor.steam_wishlist_*
attributes:
- sale_price: null
options:
type: custom:multiple-entity-row
toggle: true
secondary_info: normal_price
primary:
entity: this.entity_id
attribute: sale_price
name: SP
exclude:
- state: 'False'
but my display is
I would appreciate any advice
thank you
There is no such an option in multiple-entity-row
.
No, it isn’t update. I try many times open/close. I try turn off the light from the list…no update.
It does not execute functions like this:
icon: |
[[[
if ('this.entity_id' == 'switch.sonoff_100109c76c_1')
return "mdi:home-floor-1";
else if ('this.entity_id' == 'switch.sonoff_1000f46826_1')
return "mdi:toilet";
return "mdi:toggle-switch";
]]]
Love this card, but is it possible to place a divider between the entities?
type: custom:auto-entities
card:
type: entities
filter:
template: |-
{% for s in states.switch -%}
{{
{
'entity': s.entity_id,
'secondary_info': 'last-changed'
}
}},{%- if not loop.last -%}{{
{
'type': 'section'
}
}},
{%- endif -%}
{%- endfor %}
Thanks, this works, until you use sort
on a attribute. It place all dividers at the bottom of the card. How do you exclude a dvivider?
You cannot exclude a divider - unless you specify a sort inside the template.
To solve my own question, fixed it wuthin the template code like @Ildar_Gabdullin said, thanks!
Here’s the code original code;
- type: custom:auto-entities
card:
type: entities
filter:
include:
- entity_id: "sensor.nl_trash_*"
options:
type: custom:multiple-entity-row
secondary_info:
attribute: remaining
sort:
method: attribute
attribute: remaining_int
numeric: true
And using template
with a divider;
- type: custom:auto-entities
card:
type: entities
filter:
template: |-
{% set trash = [
states.sensor.nl_trash_gft,
states.sensor.nl_trash_paper,
states.sensor.nl_trash_pmd,
states.sensor.nl_trash_residual] | sort(attribute='attributes.remaining_int') %}
{%- for t in trash -%}
{{
{
'type': 'custom:multiple-entity-row',
'entity': t.entity_id,
'secondary_info': t.attributes.remaining
}
}},{%- if not loop.last -%}{{
{
'type': 'divider'
}
}},
{%- endif -%}
{%- endfor %}
Looks like it can’t handle “this.entity_id”.
Is it possible to use auto entities card to sort out devices created by a specific integration?
In Home Assistant, under Integrations, I can view all devices controlled by a specific integration (“Filtering by integration”).
I would like to do this in using a auto entities-card but I don’t know what filter to use? Is it even possible?
I have an (iOS) device integrated by the official HA Companion app. It provides a battery state
sensor storing the Low Power Mode
in an attribute.
I want auto-entities to show all entities with state Low Power Mode: true
. Unfortunately, auto-entities seems to not being able to handle the “not so precise” naming of this attribute.
E. g. this is working for the default attribute within a normal entities card:
- type: attribute
entity: sensor.phone_battery_state
attribute: 'Low Power Mode'
But with auto-entities nothing is displayed. Doesn’t matter how I write the Low Power Mode
. Bug or am I using it wrong?
type: custom:auto-entities
card:
type: entities
title: Power Saving Mode
state_color: true
show_header_toggle: false
entities: []
filter:
include:
- domain: sensor
attributes:
device_class: battery
'Low Power Mode': true
options:
secondary_info: last-updated
exclude: null
show_empty: false
unique: true
sort:
method: last_changed
reverse: true
This is what dev tools gives me, so YES, the naming of that attribute is just horrible.
Low Power Mode: true
device_class: battery
icon: mdi:battery-40
friendly_name: Phone Battery State
Any ideas?
(How) Can auto-entities handle “not well formatted” attributes?
type: custom:auto-entities
card:
type: entities
title: Integration
unique: true
show_empty: true
filter:
template: '{{integration_entities("kodi") }}'
sort:
method: name
I do not see this attribute in this sensor:
As for “Low Power Mode” attribute.
In my experience, if some attribute is displayed as “Xxx Yyy Zzz”, that means that it’s actual name is “xxx_yyy_zzz”.
But this particular “Mobile App” integration is smth strange…
Check these templates:
That means that you may address this attribute only by using the "Xxx Yyy Zzz"
name.
Try using this template (just replace “false” with “true”):
filter:
template: >-
{% for sensor in integration_entities("mobile_app") -%}
{%- if is_state_attr(sensor,"Low Power Mode",false) -%}
{{sensor}},
{%- endif -%}
{%- endfor %}
I tried using “selectattr” filter - does not work:
{{states | selectattr('attributes["Low Power Mode"]', 'eq', false) |
map(attribute='entity_id') | list }}
{{states | selectattr('attributes.low_power_mode', 'eq', false) |
map(attribute='entity_id') | list }}
I asked a question about using the “selectattr” filter, you may follow that thread if you like.
trying to fighter compress the yaml, it would be nice if I could replace this filter:
filter:
include:
- entity_id: '*.[[id]]_*'
exclude:
- entity_id: 'switch.[[id]]'
- entity_id: 'sensor.[[id]]_actueel'
- entity_id: 'sensor.[[id]]_totaal'
- entity_id: '*daily'
- entity_id: '*daystart'
- entity_id: '*power'
- entity_id: '*energy'
- entity_id: '*door*'
- entity_id: '*battery*'
with a regex search for the wild card strings GitHub - thomasloven/lovelace-auto-entities: 🔹Automatically populate the entities-list of lovelace cards
filter:
include:
- entity_id: '*.[[id]]_*'
exclude:
- entity_id: 'switch.[[id]]'
- entity_id: 'sensor.[[id]]_actueel'
- entity_id: 'sensor.[[id]]_totaal'
- entity_id: '/^(daily|daystart|power|energy|door|battery$/'
I tried this, but upon refreshing my system went down ;-)…
please could anyone help me out finding the correct syntax?
update
wait, this seems to work nicely:
exclude:
- entity_id: 'switch.[[id]]'
# - entity_id: 'sensor.[[id]]_actueel'
# - entity_id: 'sensor.[[id]]_totaal'
# - entity_id: '*daily'
# - entity_id: '*daystart'
# - entity_id: '*power'
# - entity_id: '*energy'
# - entity_id: '*door*'
# - entity_id: '*battery*'
- entity_id: '/(actueel|totaal|daily|day|power|energy|door|battery|position|afstand)/'
only doesnt filter out things like showing ‘cv stookhok’ in search ‘stookhok’…
adding - entity_id: '*.cv_[[id]]*'
somehow fixes ist, even on cv_stookhok entities . huh?
You’re right the device_class: battery
was a custom setting, nothing the integration seems to provide as default.
Your template worked But:
- basically I try to avoid using templates whereever possible
- the state shown is the state of the entity, not the one of the attribute.
This is desired output (the entity name does not matter):
…achieved by entities card default attribute:
- type: attribute
entity: sensor.phone_battery_state
attribute: Low Power Mode
name: Energiesmarmodus
This is what I get in auto-entities using the template:
Another workaround needed?
Maybe auto-entities can “just” work around those “crazy” attributes? So that
attributes:
'Strange Attribute Naming': true
would be accepted AND the attribute’s state is shown.
- type: custom:auto-entities
card:
type: entities
title: Power Saving Mode
state_color: true
show_header_toggle: false
entities: []
filter:
template: >-
{% for sensor in integration_entities("mobile_app") -%}
{%- if is_state_attr(sensor,"Low Power Mode",false) -%}
{{
{
'type': 'attribute',
'entity': sensor,
'attribute': 'Low Power Mode',
'name': 'xyz'
}
}},
{%- endif -%}
{%- endfor %}
show_empty: false
unique: true
sort:
method: last_changed
reverse: true
Or this:
{
'type': 'attribute',
'entity': sensor,
'attribute': 'Low Power Mode',
'name': state_attr(sensor,'friendly_name').split(' Battery')[0]
}
We use templates in Configuration to create template sensors, why not using templates in Frontend?)))
I do not think this is supported…
Every attribute which I have seen is a kind of “xxx_yyy_zzz” - and is presented in UI as “Xxx Yyy Zzz” - let’s call these attributes NORMAL. These attributes from Mobile App are STRANGE (I would call them in Russian by another word - and the whole Mobile App integration is unstable and unreliable, IMHO).
Thank you VERY MUCH! The output is pretty much exactly what I was looking for. Think I need to start using templates in the UI to get even more out of whole HA.
I’m not brave enough to raise an issue for the mobile_app integration but I double what you said - that’s not a ‘normal’ naming convention and it’s from the official app… anyway, auto-entities is working for now
got to love the new integration_entities template options, and a very nice template for auto-entities indeed!
what’s your issue with it? I must confess after having switched over to the mobile app completely, and drop all other trackers, I havent seen an issue in location anymore.
Login is smooth as can be, local and external, and now we even have local notifications
Do you mean “Why do you dislike Mobile App integration”?
It is an off-topic here )))
Because sensors like “battery level” are updating ONLY when I open the Companion App. I got iPad Air 2, iPhone 5S, iPhone 6S+ - all of them have “Background app refresh = ON” option in iOS settings but this does not help. And another issue is that Companion App is too buggy to be used. And one more issue is that iPhone 5S, 6S+ sometimes even cannot open a dashboard, just displaying a white screen. May be the latest iPad & iPhone work smooth.