We just configured a new Yale lock for our door. I now want to link locking the door to enabling our home alarm system. We have opening sensors on all doors and windows and the idea is that once the door is locked, triggering any of the opening sensors would trigger the alarm. This part seems really straightforward. However we would also like to do a "good night" scene/automation that basically locks the door, turns all lights off etc. As this also locks the door the home alarm automation would be enabled, which is not what we want. For this case we only want to lock the door and somehow set some state that causes the alarm automations to not go off.
Is this something that can be done? Like, enabling "good night" would set a "sleeping" state that's persisting until the lock is unlocked. The alarm automations would have a check for "door locked AND sleeping is not set". Unlocking would clear the "sleeping" state. Is there some kind of state helper or similar I could look into?