put the filter under exclude not include since your goal is to EXCLUDE unavailable entities. Itās explained in the ReadMe in Github pretty well. Did you bother to check there? Like this example there:
Thank you, I tried the examples in the first place only in a stupid way I tried to filter out the unavailable state in Polish instead of English and it didnāt work.
Now that HA provides a button to trigger the OTA update for Shelly devices I thought is was time to add a card to my maintenance dashboard that shows me what device have an update pending.
type: custom:auto-entities
card:
type: entities
title: Shelly OTA Updates
filter:
template: |
{% for sensor in states.binary_sensor -%}
{% if 'firmware_update' in sensor.entity_id and sensor.state == 'on' %}
{{ sensor.entity_id | regex_replace('^binary_sensor.([a-z0-9_]+)_firmware_update$','button.\\1_ota_update') }},
{% endif %}
{%- endfor %}
To get this to work make sure you are on HA 2021.12, use the official Shelly integration and have the firmware sensor of your Shelly devices enabled.
Hi hope someone can help me with this.
I would like a card for birthdays. So far so good.
The problem is, I need 2 filters because of different attributes I want to show in the card and for one filter 1 need 2 states: > 0 and < 20.
But I donāt get that to work.
Hi All,
Iāve been using this card for a while now and created quite a comprehensive list of warnings. Iāve a new challenge and I canāt think how to solve it.
Iāve created enhanced sensors for local river level sensors, adding their maximum ānormalā level (and locations for showing on a map).
Iāve set a filter group for sensors containing the word āfloodā but of course I get all the flood sensors regardless of their level. I want them to only appear when their state value exceeds this attribute value, Iām having a mental block and canāt sus how to express this in a filter.
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
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.
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 %}
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 ?