12V reversing polarity when 240V present circuit

Hi Team
I have a thermostat in a greenhouse that switches ON and provides 240V when a set temp is reached (I use it to switch on cooling fans). I want to also use the 240V to power (via transformer) to power a 12V DC linear actuator to open the vents. When the 240V ceases (after temp falls), I need the 12V to polarity to be reversed. I think I can do this with DPDT relay, but wanted to see if anyone has done this before and has any ideas. Of course, I will attempt this control using my Arduino but will attempt this first etc
best regards
Craig

craigp123:
I think I can do this with DPDT relay,

That would be a good start.

Obviously you have some limit switches.

craigp123:
Of course, I will attempt this control using my Arduino

Why?