Conditional control of Wifi switch (Sonoff)

Hi, I apologize in advance for a possible stupid question.
Is there a way to achieve in emoncms conditional switching wifi switch?
I have a local emonpi server that collects all the information about my small photovoltaic power plant. The problem is that at the time of the highest production of the power plant after charging the batteries, the consumption is very low, my intention is to switch on electric water heating at a time of high production and low consumption. For this purpose I have a Wifi switch Sonoff with fw EmonESP. The connection to the DemandShaper module works flawlessly. The problem is that I can’t get the switching setting based on the instantaneous data from the PVE.
The question is, can I somehow possible to achieve the switching of the Wifi switch based on the instantaneous data from the PVE.
Example: The battery is charged and the PVE supplies = Wifi switch ON

Thank you in advance for the comments, if something similar is being addressed here then I apologize but I am a real newcomer and I did not find anything that would help me.

Is that of a high enough rating to switch the water heater? Water heaters are often quite high Wattage.

PVE? (To me that is a Proxmox Virtual Environment).

I don’t use demand shaper so can’t help on that front.