Sonoff Basic switch as thermostat

Hello, :slight_smile:
I have home thermostat which i set up with sonof R3 basic wifi and one reley, because i have radiators valves with temeprature senzors. So, the only way to have some kind off smart on/off thermostat is this way. When sonoff switch is on heating is off, ande when sonoff switch is off, heating is on. Sounds stupid but it works and there is no other way… So my question is ; I have made generic thermostat and pair it whit xiaomi sensor and sonof switch, but problem is state of switch…When I set desired temperature of 25 sonoff switch set to on and heating is off .
How to change it? Can someone help