Advanced smart switching

I have a new challenge. For a swimming pool in the garden I have a heating device and a filter pump. The condition is that the heating device can only turn on when the filter pump (water flow) is switched on. I would like to solve this with smart devices. The easiest way is to insert a smart plug between both devices and write a flow. But I would like to go for a safer solution. The heating device should not be powered until the water pump is switched on. How many of you have a solution and a schedule to make this. Of course, I cannot place a smart plug behind a smart plug because the latter does not listen when it is de-energized. I then thought of a smart solution with a potential-free relay between the filter pump and the smart plug. But I have no idea if this can work. So I hope you guys have suggestions.

And I forget to mention that the filter pump must be able to be switched separately from the heating. After all, you do not want to heat continuously, but the filter pump does its job a number of times a day.

i would do it with a shelly 2PM, it has two seperate channels that can be switched and monitored for power, and if you add the plus add on you can even monitor the temperature of the water :innocent:,. i use one for switching my heatpump boiler so it goes on on the hottest part of the day so that is more efficient.