Look at this message topic. Instead of using modes for arming/disarming, I set up (with help) a rule to arm and disarm based on whether the presence sensors are present or absent, eliminating mode manager entirely from the process. So far, it is being very reliable.