Pipe Thermostat and Sonoff Switch scene

I have a pipe thermostat which is essentially an on/off switch when a certain temp is reached on the pipe.I am trying to integrate this into my controls for my hot water cylinder.

If i wire a Basic R2 after the pipe stat,it will work to turn on the switch,because the R2 will have power(because the pipe stat circuit is on). But then the problem is once the pipe stat reaches a temp of say 60 degrees,it will then break the circuit and the R2 will not have any power and therefore cannot trigger the boiler to turn off.

Maybe i am thinking about this the wrong way but any advice/discussion is welcome !