Aqara hub security automation

Hi all can anyone help

I have 3 or 4 Aqara hubs and I want to make an automation where when the last person leave the house, all the hubs turn to armed and if the front door opens (I have door sensors) then the alarm goes off.
When the first person arrives I want the hubs to deactivate .
Could anyone help me to how I do this ?

Here are 7 great Alarm How-To’s → Setting up an Alarm in the Aqara App