Update example
swa72 opened this issue · 1 comments
swa72 commented
I suggest to update the example from
{% set ignore_sec = 60 %}
{% set ignore_ts = (now().timestamp() - ignore_sec)|as_datetime %}
{{ states.sensor
|rejectattr('entity_id','in',state_attr('group.ignored_unavailable_entities','entity_id'))
|rejectattr('entity_id','search','_alarm_volume|_next_alarm|_alarms')
|rejectattr('entity_id','search','_memory_percent|_cpu_percent')
|rejectattr('entity_id','search','_timers|_device|_do_not_disturb')
|rejectattr('entity_id','search','browser_')
|rejectattr('last_changed','ge',ignore_ts)
|selectattr('state','in',['unavailable','unknown','none'])|map(attribute='entity_id')|list }}
to
{% if state_attr('group.ignored_unavailable_entities','entity_id') != none %}
{% set ignore_seconds = 60 %}
{% set ignore_ts = (now().timestamp() - ignore_seconds)|as_datetime %}
{% set entities = states|rejectattr('domain','in',['group','button'])|selectattr('state','in',['unavailable','unknown','none'])|list %}
{% set buttons = states.button|selectattr('state','eq','unavailable')|list %}
{{ (entities + buttons)
|rejectattr('entity_id','in',state_attr('group.ignored_unavailable_entities','entity_id'))
|rejectattr('entity_id', 'search', '(sensor.browser_|media_player.browser_|light.browser_|iphone6|hp_laserjet_200)')
|rejectattr('last_changed','ge',ignore_ts)
|map(attribute='entity_id')|list }}
{% endif %}
where |rejectattr('entity_id', 'search', '(sensor.browser_|media_player.browser_|light.browser_|iphone6|hp_laserjet_200)')
is the fancy new regeyp
jazzyisj commented
Yep I can do that. The above could even be consolidated into this I think.
|rejectattr('entity_id', 'search', '(browser_|iphone6|hp_laserjet_200)')