OK, that was easy.
Rogério Neiva

Looks like the relay in the photo is rated for 5VDC, you might want to check and see if the ESP8266 is able to drive it (datasheet says at least 80%, so it may or may not work). If not, then you can swap the relay for a 3VDC rated one.

For the 4.5V signal, the ESP might be tolerant of input higher than 3.3V, but to be on the safe side, it would be best to bring it down using a voltage divider. On the programming side, you just need to use digitalRead in your main loop to detect the pin state (HIGH/LOW), and from there you can implement the logic you want. You can also check out this guide for further details.

Good luck!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.