Home Assistant Template

Will return true when any motion sensor is triggered. This is used in our house in conjunction with a sleep time input boolean, to prevent room assistant turning on lights in other parts of the house when we leave a watch downstairs or RA decides we are in the office next to the bedroom if we move around the bedroom at night.

{{ states.binary_sensor | selectattr('state', 'eq', 'on') | selectattr('attributes.device_class', 'eq', 'motion')| list | count > 0}}