Custom template to check multiple binary sensors

Hey guys,

I would like to create a custom entry which would turn “ON” only if multiple binary sensors are in a specific state “Not Detected”

Is it possible ?

You can make a template sensor that does this. Or make a binary sensor group. I believe you can invert the state of the binary sensor group.

Well, I tried to create a group of binary sensor but it turns ON only if one or all binary is detected

I want the reverse, none of them are ON to Activate

Check “all entities”, then look for 'off' instead of 'on'. It will only be on when all are on.

If you just want none on, then make a template binary_sensor using

{% set entities = ['binary_sensor.a', 'binary_sensor.b', ... ] %}
{{ entities | select('is_state','off') | list | count == entities | count }}

Ok let me try that! :grinning:

You’re a genius!
Worked like a charm :smiley:

{% set entities = ['binary_sensor.presence_sensor_fp2_salon_presence_sensor', 'binary_sensor.presence_sensor_fp2_sdb_presence_sensor_1', 'binary_sensor.presence_sensor_fp2_chambre_presence_sensor', 'binary_sensor.detecteur_mouvements_dressing_motion']%}
{{ entities | select('is_state','off') | list | count == entities | count }}

Thanks a lot

1 Like