Turn on group only if >2 sensors detect motion

Is there any neat way of making a binary sensor that includes multiple motion sensors and only turns on if two or more sensors detect motion?

No, but you could use an input boolean and an automation to get the logic you want. You could then use a template binary sensor that uses the state of the boolean if that’s what you want.

Based on some code posted by @123 last night this for a different purpose, this will create a binary sensor that is on when any 2 motion sensors listed are ‘on’

Add this to your binary_sensor section in configuration.yaml

- platform: template
  sensors:
    motion_two_simultaneous:
      device_class: motion
      value_template: >
        {% set sensors = [states.binary_sensor.toilet_motion,
                          states.binary_sensor.bathroom_motion,
                          states.binary_sensor.hallway_motion,
                          states.binary_sensor.landing_motion,
                          states.binary_sensor.kitchen_motion,
                          states.binary_sensor.ensuite_motion] %}
        {{ sensors | selectattr('state','eq','on') | list | count == 2 }}

Actually, just re-read you post, this will do 2 or more:

- platform: template
  sensors:
    motion_two_simultaneous:
      device_class: motion
      value_template: >
        {% set sensors = [states.binary_sensor.toilet_motion,
                          states.binary_sensor.bathroom_motion,
                          states.binary_sensor.hallway_motion,
                          states.binary_sensor.landing_motion,
                          states.binary_sensor.kitchen_motion,
                          states.binary_sensor.ensuite_motion] %}
        {{ sensors | selectattr('state','eq','on') | list | count >= 2 }}
1 Like