You would need a custom device handler for what you’re looking to do.
The other option is to use a Keypad Lock like one of these and use it to control your Relay. Keep the keypad and relay in sync using in this app: [RELEASE] Lock and Door Synchronizer, synchronize your locks with other locks, deadbolts, doors, switches/relays