Use your own generated electricity

Who can help me to achieve the following in Home Assistant?
How to make the electricity central heating work when the solar panels are on, when they are off the gas central heating continues.
My solar panels give me free electricity, which I can measure with my EASTRON SDM 630.
My plan is for the SDM630 to signal the Shelly UNI switch,which in turn switches on the room thermostat to the Electric CV or Gas CV heating