Rules with widget on off

What about reading the documentation for the keypad widget

You need two items holding the pin, one for arm and one for disarm and configure them in the widgets.
Within your rules, check is the entered pin matches your expected input. If it does not, reset the pin item.