Use excess power generated by SolarEdge Inverter to switch Shelly Plug S

As it took me a while to figures this out (being a newcomer to openHAB), I thought that I share my (very simple) solution with others, that allows me to make use of any unused renewable electricity.

The below 2 rules will switch on a Shelly Plug S to make use of any “extra power” generated by the SolarEdge inverter. If there is no unused electricity generated (clouds appearing / consumption goes up) the second rule will switch the Shelly Plug S off again.

This will maximise the local consumption of electricity, e.g. by switching on any heating device connected to it.

rule "Heating_on"

when
  Item solaredge_generic_373357ff_live_export changed
then
 if (solaredge_generic_373357ff_live_export.state >  0.5|kW) {
shelly_shellyplugs_79a136_relay_output.sendCommand(ON)
}
end

rule "Heating_off"
when
 Item solaredge_generic_373357ff_live_import changed
then
  if(solaredge_generic_373357ff_live_import.state > 0.1|kW) {
  shelly_shellyplugs_79a136_relay_output.sendCommand(OFF)
}
end

Hope this will be useful to other newcomers as well.

1 Like

I’m hoping your actual second rule has a < instead of a >?
And you should just combine this into a single rule:

rule "Heating on or off"

when
    Item solaredge_generic_373357ff_live_export changed
then
    if (solaredge_generic_373357ff_live_export.state >  0.5|kW) {
        shelly_shellyplugs_79a136_relay_output.sendCommand(ON)
    } else if(solaredge_generic_373357ff_live_import.state < 0.1|kW) {
        shelly_shellyplugs_79a136_relay_output.sendCommand(OFF)
    }
end
1 Like

Thanks for the hints, highly appreciated. :slight_smile:

When winter will come to an end, I will have to extend & combine this rule with a third binding (Lacrosse Jeelink), so that I can consider the room temperature.

How about using persistence with averageSince to prevent turning the heating on/off every few second when the extra power is fluctuating around 0.5 kWh?