https://www.raspberrylovers.com/2019/03/raspberry-pi-open-close-sensor.html