How to read this diagram?

I have a cabinat lock with some pins to read if the lock is open or closed.

I have tried to use the digitalread for Pin 5 and 6. But it gives me random values between 0 and 1. Therefor I cannot know if the lock is open/closed.

Anybody know how to connect this to a analog or digital input?

Do have a link to what lock you are referring to?

Have you tried this:
pinMode (pin5, INPUT_PULLUP); // enable internal pullup resistor
Wire the pin the lockpin to connect pin5 to Gnd, or not.
Then you will see non-random values with digitalRead (pin5).

CrossRoads:
Have you tried this:
pinMode (pin5, INPUT_PULLUP); // enable internal pullup resistor
Wire the pin the lockpin to connect pin5 to Gnd, or not.
Then you will see non-random values with digitalRead (pin5).

Thanks. Just tested it with Pin 5 and connected it. It only return 1 no matter if the lock is open/locked. Should I not use pin 6 and 7 for something?

If it returns 1 no matter what, that would suggest to me that the pin is not being connected to Gnd thru the lock opening or closing. Check your wiring, it may not be what you think it is.

CrossRoads:
If it returns 1 no matter what, that would suggest to me that the pin is not being connected to Gnd thru the lock opening or closing. Check your wiring, it may not be what you think it is.

Which Pin should I connect to the GND. I just connected pin 5 to the digital read pin on my board.

Some part of the lock mechanism - it is acting as the switch, yes? I can't see the links you posted, they are being blocked on me, so I can't really tell what you're dealing with.

dkmedia:
Thanks. Just tested it with Pin 5 and connected it. It only return 1 no matter if the lock is open/locked. Should I not use pin 6 and 7 for something?

Yes. You should connect pin 7 to Arduino Ground.