From this thread (which is old so am posting here) I wrote the following:
{% set select_models = [
'Hue dimmer switch',
'Hue motion sensor',
'Hue motion outdoor sensor',
'Heating thermostat remote control',
'Soil sensor'
] %}
{{ states.sensor
| selectattr('attributes.device_class', 'eq', 'battery')
| map(attribute='entity_id')
| select('is_device_attr', 'manufacturer', 'Philips')
| list
| join('\n')
}}
Is there any way I can relace:
| select('is_device_attr', 'manufacturer', 'Philips')`
With something like:
| select('is_device_attr', 'manufacturer', 'in' select_models)`
or even:
| select('is_device_attr', 'manufacturer', 'search', '(Hue|thermostat|Soil')`
(I know those lines won’t work, but is the easiest way for me to describe what I am looking for).
For context, I am trying to get a count of devices with low AA,AAA batteries as they can have a lower % than other batteries before needing to be replaced. So my endgame is something like this:
{% set select_models = [
'Hue dimmer switch',
'Hue motion sensor',
'Hue motion outdoor sensor',
'Heating thermostat remote control',
'Soil sensor'
] %}
{% set entities = states.sensor
| selectattr('attributes.device_class', 'eq', 'battery')
| map(attribute='entity_id')
| select('is_device_attr', 'manufacturer', 'Philips')
| list
%}
{{ expand(entities)
| map(attribute='state')
| map('int', -1)
| select('le', states('input_number.aa_battery_low')|round(20))
| list
| count
}}