Optimization of self consumption of photovoltaic energy

Hey,

I’m just wanting to share a few ideas/solutions to cut on your energy bill if you happen to have a photovoltaic system installed.

Use PV Energy for Rollershutters

This first snippet does the following when triggered:

  • The current (average) state of the rollershutters is evaluated
  • If mostly down, the rollershutters will go up and vice versa
  • If there is no more power than 150W (Base load of the house) all rollershutters are driven at once as grid power will be used in any case
  • Otherwise the power going to the grid is taken as a base and then divided by (generously rounded up) 200W for each rollershutter
  • The determined count of concurrent rollershutters will be driven, the next delayed by tRS, 25 seconds
// JGZentral = Group:Number:AVG JGZentral "State Rollershutters" <rollershutter>
// J_Zentral = Rollershutter J_Zentral "All Rollershutters"
// J_Flur, J_Kuche... = Rollershutter J_Kuche "Kitchen"                       (JGZentral)                       { knx="3/0/2, 3/1/2, 3/2/2+3/3/2" }
// PWR_Generation = Number item, Power generation from PV
// PWR_FeedIn = Number item, Electricity going to the grid
import org.eclipse.smarthome.model.script.ScriptServiceUtil

var delay=0
var target = DOWN
var Number tNum = 0
var Number nParallel = 1
var Number i = 1
val Number tRS = 25

if (JGZentral.state < 0.5) target = DOWN
else target = UP

if (target == DOWN) tNum = 100
else tNum = 0

// Decide to drive all at once
if (PWR_Generation.state > 150) {
  nParallel = Math::floor((PWR_FeedIn.state as Number).doubleValue / 200)
  if (nParallel < 1) nParallel = 1
  logInfo("Eco-Rollo", "nParallel: "+nParallel)

  for (String Jal : newArrayList('J_Flur', 'J_Kuche', 'J_Ess_E', 'J_Ess_S', 'J_LH_U', 'J_Woh_S', 'J_Woh_W', 'J_LH_O')) {
    val Jal = ScriptServiceUtil.getItemRegistry.getItem(Jal)
    if (Jal.state != tNum) {
      createTimer(now.plusSeconds(delay)) [|
        Jal.sendCommand(target)
      ]

      if (i == nParallel) {
        delay = delay + tRS
        Thread::sleep(100)
        i = 0
      }

      i += 1
    }
  }
} else {
  J_Zentral.sendCommand(target)
}

I really hope this is understandable :wink:
If not, please feel free to ask.