I'm trying to monitor a battery that is unrelated to my ESP32. The battery powers my gate and the ESP32 is powered by POE. The battery is a 12v battery. I am using a voltage divider and the ADC to periodically check the voltage and report it. Attached is my circuit (Pin 1 is ground on the ESP32). Is it ok to connect the grounds of the ESP32 and the battery together? I know I need to be reading the voltage in reference to ground but was worried the two different grounds will cause an issue.
Edit to add POE device: