Inspired by SmartThings and many other pre-built automation solutions, usually a certain class of devices will be automatically integrated to an default automation that will trigger when the sensor is true without user manually adding it to the automation.
For example, any gas/smoke/carbon_monoxide sensor added to the hub triggering will result in a voice announcement with the device name and location stated before the alarm being sound in 15 seconds.
It also applies to moisture and battery sensors, which will trigger notifications and voice announcement.
I’m trying to achieve the same by using the following template in the blueprint:
{{ states.binary_sensor | selectattr('attributes.device_class', '==', 'moisture') | map(attribute = 'entity_id') | list | length }}
However the caveat is it will only trigger upon the first moisture sensor, it seems this is a known limitation:
I wonder if there are any other workaround than creating template sensors counting the number of sensors being triggered?
This would also benefit the case where some other templates, for example detecting the number of switches being turned on, otherwise the trigger will only run when the first switch is turned on.
Thanks for your help.