Arm only closed devices

Hey all,

Finally trying to roll my own “security system” for doors/windows. I want to be able to arm or disarm all doors/windows with a switch in HA and Alexa. I also want to only arm a device if it’s already closed. The sensors are all z-wave connected to Vera and tied into HASS. The show up as binary_sensors (for open/closed) and a switch (for armed/disarmed). I already have the alerting piece working, it only sends alerts if the device is armed:

- id: basement_door_opened
  alias: Basement Door Opened
    - platform: state
      entity_id: binary_sensor.door_basement_52
      to: 'on'
    condition: state
    entity_id: switch.door_basement_52
    state: 'on'
    - service: notify.dantext
        message: 'Basement door opened!'

The question is, how can I create a script, that arms ONLY closed (binary sensor state off) by turning their switch to on? I feel like this should be something simple but I’m having a major brain fart.