What is your countries voltage?
To greatly increase simplicity, all components should to be for the same voltage (besides the DC of course).
All relays (actually all electronic devices) work with two wires: phase/neutral (AC power) or +- (DC power). I’m going to go with AC here since that’s what’s typical for 110 / 230V.
A contactor or relay normally has 4 contacts: 2 for the load (in / out) and 2 for the control contacts: phase / neutral.
So working back from your compressor: its phase wire (from the wall plug) needs to connect to the “in” contact of the contactor, its neutral goes to the “out” contact of the contactor.
The two contactor control inputs: one goes to neutral (110/230V).
The other depends on your device:
- Sonoff: it seems it can handle 90-250V. So just connect its output to the control input of the contactor.
-Generic ESP/Arduino/whatever: this needs an extra relay. Let me know if this applies.
I must say, since you seem to not have experience in this field, ask a friend or someone who does. It’s not only about how to wire it up but also the wiring needs to be done properly. 30A is a LOT of current, badly wired cables will give you more smoke effects then you wish…
Disclaimer: I’m not a certified electrician and all info posted here is for the risk of any reader, I take no responsibility.