I'm new to electrical stuff, so thanks in advance for all help. I'm trying to control a window air conditioning unit with a micro controller (ESP8266), and I want to know if the AC is powered on. I can get a switched 5v line and ground on the AC, but I don't know what I need to put between the AC and the MCU. I'm using signal relays to "push" buttons on the AC and I am thinking I can just reverse the relay so the switched line triggers the relay and it closes a digital pin on the MCU - See below.
If the relay is the right answer, is it safe to simply wire in a relay to 5v power and ground on the AC, or will that short out something? The pins are marked 5v and G on the AC control panel.