Hi,
I have multiple sensor like sensor.xxxx_heating that give values between 0…100
Ho do I loop through all of them in a template and output on if any value is above 0 and off otherwise?
Thanks!
Hi,
I have multiple sensor like sensor.xxxx_heating that give values between 0…100
Ho do I loop through all of them in a template and output on if any value is above 0 and off otherwise?
Thanks!
Copy-paste this into the Template Editor and confirm it reports what you want.
{{ 'on' if states.sensor
| selectattr('object_id', 'search', '_heating$')
| rejectattr('state', 'in', ['unavailable', 'unknown'])
| map(attribute='state')
| map('float', 0)
| select('>', 0)
| list | count > 0 else 'off' }}
Thanks! That’s perfect