How to detect a gate's gearmotor open/closed state using 24 V AC/DC accessories power-supply output with a microcontroller

Hey,
I have made a blog post how to detect if the gate is open/closed based on the gearsmotor’s accessories power-supply output (e.g. outside lamp).

https://nonameplum.github.io/posts/Detecting%20a%20gate’s%20gearmotor%20open/closed%20state%20without%20reed%20switch%20with%20ESP32/8266%20&%20ESPHome/