The best way is probably to
- Connect the contact switch between the input and ground (NO pull-up or pull-down)
- Configure the input as a normally open or closed alarm input
- Add the corresponding Digital Input Child device to the Dashboard as a contact sensor or door status or something like that
I had to change the code a bit for this to work with the dashboard so you need to update your code.