Desert_AIP
Senior Member
emck said:Thanks so much for all the great replies. I tried the code below and when the flag occupied is on the Unocupied flag goes off and verse visa. But the flag doesn’t increment when a motion NOT READY am I missing something?
The problem may be the motions are going NOT READY then back to SECURE so quickly that the flag is incrementing then decrementing in the same code pass or the very next pass so you don't actually see the change occurring.
As mentioned above ocupancy sensors are a better sensor here.
My occupancy sensors are latching, so once they trip they stay NOT READY for a selectable period of time, in most cases 1.5 min.
Think of it as a kind of electronic switch debouncer.
As for the status of the alarm, I would use that as a trigger and a conditional so that the motion sensors check the alarm status before they change the flag.
If you only use the alram status as a trigger, it will only occur when there is the transition from armed to disarmed and vice versa.