Can mode be set by the state of a contact sensor?

I'd like to define "away" mode based on the status of a third party alarm system. I know how to turn a contact sensor on/off to indicate the alarm status, but can I then use that to define the mode? For instance, if the alarm status contact is "closed" I want to set mode to "away". In the documentation I only see buttons and switches can be used to set modes.


You can do this using Rule Machine.

Thanks! I often have trouble figuring out how to do simple things because I look in the more complex sections. I was looking at the Mode Manager and Mode Lighting Apps to do this and couldn't find a way.