Is it an attribute?
What possible values does it have? Are they [0ā¦9, 10ā¦99, 100ā¦999], [0ā¦9], [10ā¦99] or ā¦?
Also, what do you want to display - this attribute or a state?
Hi yes an attribute.
Itās variable, ie flood level sensor specific and is measure in metres. It seems to vary from about 0.7 to 2.5. I only want to show flood sensors that are above the maximum normal figure that is applicable to that entity.
Maximum normal: 0.85m which is an attribute of sensor.any_Flood_level and is fixed for each sensor but different for each sensor.
Sensor.any_Flood_level: 0.75
And sensor does not showin my auto list.
Sensor.any_Flood_level: 1.1
The sensor shows in my auto list. It can just shown an icon, or the state, not bothered, but did assume it would show a state if it could be done
As far as I understood:
- There are some sensors.
- Every sensor has an attribute
my_attr
. - There is an Entities card with these sensors.
- Some sensor must be displayed in the card if its state <= its attribute
my_attr
(or >=, whatever).
If I got your idea right - then try to adapt this code for your case:
filter:
template: >
{% set GROUP = 'group.my_sensors' -%}
{%- set MY_SENSORS = expand(GROUP) -%}
{% for my_sensor in MY_SENSORS | sort(attribute="attributes.my_attr") -%}
{%- set STATE_VALUE = states(my_sensor.entity_id) -%}
{%- set ATTR_VALUE = state_attr(my_sensor.entity_id,"my_attr") -%}
{%- if STATE_VALUE|float(default=0) <= ATTR_VALUE|float(default=0) -%}
{{my_sensor.entity_id}},
{%- endif -%}
{%- endfor %}
The group.my_sensors
must contain all your sensors.
This code was verified for another case, then I changed it for your case and then was not able to verify it again.
Note that sort(..)
may give wrong results like ā1,10, 111, 2, 3, 31, 4ā.
But if values are like ā0.4, 0.45, 0.7, 1.1, 2.3ā - I think that sorting will be OK.
Hello,
itās possible to attribute severity color of custom:bar-card according to an attribute sensor ?
Sorry, but how is it related to auto-entities?
Severity color is supposed to be defined for different ranges āfromā¦ toā¦ā in bar-card.
Yep i didnāt use Severity but style :
I try this but itās not working
direction: up
type: custom:auto-entities
style: |
ha-card {
box-shadow: none !important;
}
card:
type: custom:bar-card
title: Filaments
show_header_toggle: false
direction: up
height: 709px
stack: horizontal
icon: mdi:printer-3d-nozzle
attribute: state_percent
unit_of_measurement: '%'
positions:
name: inside
icon: inside
style: |-
bar-card-title {
text-shadow: none;
}
ha-icon {
color: white;
}
bar-card-card {
text-shadow: none;
color: white;
}
bar-card-currentbar {
border-radius: 10px;
}
sort:
method: domain
filter:
include:
- entity_id: sensor.filament_*
options:
type: custom:bar-card
name: test
style: |-
bar-card-currentbar {
--bar-color: #FF0000 !important;
}
bar-card-value{
color: black;
}
exclude:
- entity_id: sensor.filament_select
view_layout:
grid-area: filament
EDIT : when i use color attribute itās work
But if you use state_attr it doesnāt work
It is not loaded correctly
EDIT 2 : I have found solution :
template: |
{% for state in states.sensor -%}
{%- if state.entity_id | regex_match('sensor.filament_',ignorecase=False) -%}
{%- set NAME = state_attr(state.entity_id,"friendly_name") -%}
{%- set COLOR = state_attr(state.entity_id,"color") -%}
{{
{ 'entity': state.entity_id,
'name': NAME,
'color': COLOR
} }},
{%- endif -%}
{%- endfor %}
Hello all,
Iām strugling with list of tasmota devices.
it is possible to create hyperlink from list with ip?
tap_action:
action: url
url_path: this.entity_id
Happy Bew Year to you! Iāll give it a go tomorrow. Thanks for your help
only now starting with dark mode, I stumble upon this issue of not being able to set options for it using the auto-entities card with Map. Filed (edit: and closed, see below) an issue in the repo options not functional on Map card Ā· Issue #241 Ā· thomasloven/lovelace-auto-entities Ā· GitHub but thought it might be good to post/ask here too:
- type: custom:auto-entities
card:
type: map
show_empty: false
filter:
include:
- domain: person
options:
hours_to_show: 48
dark_mode: true
not:
state: home
card works fine, with the exception of the options, which are simply not applied.
please have a look? thanks!
EDIT
o dear, how stupid of me. this is all there is to it:
- type: custom:auto-entities
card:
type: map
hours_to_show: 48
dark_mode: true
nvm me.
Yes, these are card-wide options.
new challengeā¦
replace:
filter:
include:
- entity_id: sensor.*_actueel
state: '>30'
with a state following an input_number.power_threshold
filter:
include:
- entity_id: sensor.*_actueel
state: '> input_number.power_threshold' # or states('input_number.power_threshold')
would be awesome ofc (like we can do with numeric state triggers, but I believe we need to use the template option, which is still a bit more complexā¦
anyone with a quick fix, that doesnt iterate over all states|sensor ?
hi i try to make a card with a tap action. The tap action need a id that is in the attribute of the sensor.
{{state_attr("this.entity_id", "id")}}
how can i do this?
This code dont work - it works if i insert 1 instead of ā{{state_attr(āthis.entity_idā, āidā)}}ā, but the id is different for every one of the sensores.
card:
show_header_toggle: false
title: Fryser
type: entities
filter:
include:
- entity_id: sensor.*template_grocy_stk_*
options:
tap_action:
action: call-service
service: grocy.consume_product_from_stock
service_data:
product_id: '{{state_attr("this.entity_id", "id")}}'
amount: 1
transaction_type: CONSUME
exclude:
- state: unavailable
sort:
method: state
numeric: true
reverse: true
type: custom:auto-entities
I do not think that product_id supports templates. Also, this.entity_id is not supposed to be used in quotes.
ok do you have any idea how i can do this with auto entities?
Use ātemplateā option of the card.
i have tryed this and a lot more
action: call-service
service: grocy.consume_product_from_stock
service_data:
product_id:
template: '{{state_attr("this.entity_id", "id")}}'
amount: 1
transaction_type: CONSUME
but this dont work. how would you do it?
Does the āproduct_idā option has a ātemplateā option?
I guess - NO.
Use only options accordingly to Docs.
Earlier I advised to use a ātemplateā option of āauto-entitiesā card. This option allows to specify lists by using jinjia.
maybe this is an option, but i dont know about jinjia. could you please help?
Is there a way to template options? Or anyone has any other idea?
Instead of changing my entity name, I only want to change the name, which is displayed.
So instead of āabc Rssi Deviceā the rows should only display āabcā.
I thought about
options:
type: custom:multiple-entity-row
secondary_info: last-changed
show_state: false
name: |
{{ states('this.entity_id') }}
entities:
- entity: this.entity_id
name: false
and then have some jinja2 instead of the states() above. This here was only for test purposes, if I can template, but this seems to be not the case?
Possible with auto-entities::template option.