Routine depending on a variable power factor?

Hello everyone.

I’m looking for an optimal routine that allows me to activate selected sockets or switches when my PV balcony power plant reaches a certain yield.
If the yield falls below the desired value, the routine should pause, e.g. switch off and switch on again when the yield value increases.

So far I’ve tried to solve this with 2 or even 3 routines. But that didn’t work reliably. The desired yield value is determined by the “Home Energy Meter: Aeotec HEM5”.
This value is variable and takes into account both the solar power yield value and other electrical devices, such as the refrigerator.

Does anyone have an idea how this can be solved.

It would help to know what you’ve tried so far.

Hi Bruce

Thank you very much for your response to my request.

The HEM Gen5 (1 phase in my case) works reliably with Mariano’s driver and responds very quickly and with update times of a few seconds. If the yield is higher than the consumption, the energy meter shows negative values.

To switch on a smart plug, for example to charge two e-bike batteries, I need about 360 watts of surplus. The routine for the socket that activates the chargers now switches on when the HEM detects -400 watts. To reduce tolerances such as those caused by small clouds or haze, I choose a slightly higher value, in the example 40 watts.

Another routine switches the same socket off when the power surplus determined by the HEM is less than -360 watts. And so that it is not switched off too early or too often even with larger fluctuations, the routine delays by 1 minute, for example. When the refrigerator compressor starts up in the kitchen, the surplus drops immediately by 90 watts and, depending on the room temperature, for 15 - 20 minutes. The desired socket should remain switched off until the surplus is sufficiently high again, in this case again -400 watts.

At the end of the charging process, the energy requirement drops and ideally the socket (with its own meter) to which the chargers are connected would communicate with the HEM Gen5.

I wouldn’t even dare to dream of that.

What about your two Routine setup isn’t working? Can you post screenshots of your existing Routines?