Create variable for use in automations

I am new to HA but I have managed to create simple rules. Now I would like to create something a bit more complex. I have three PIR movement sensors in house. I would like to create some kind of variable that will indicate that there is no one at home for example when none of the sensors was triggered since for example 12 hours. I would like to be able to use that variable in my automations for example as trigger. How could I do that?

If you’re only going to be using motion to determine if the house is occupied you can just create a binary sensor Group, leave the All Entities toggle off.

Then that entity can be used in triggers or conditions:

trigger:
  - platform: state
    entity_id: binary_sensor.all_motion_example
    to: 'off'
    for:
      hours: 12
condition:
  - condition: state
    entity_id: binary_sensor.all_motion_example
    state: 'off'
    for:
      hours: 12

Be aware that requiring an extended duration can lead to such a trigger or condition being unreliable if you restart Home Assistant or lose power.

If you are planning on using (or already use) other methods of presence detection you will likely want to combine the methods using a Template Sensor.

Thank you. Now I think about something more complicated. I think that movement sensor can give false alarms so I would like to trigger my action even when any of them was switched on but for example only once or when sum of on time is less than 30s during this 12h period.