Free cooling algorithm for a shed

I have an out house shed that I use to store stuff. In summer it can get very hot, so to prevent damage to my stuff I have a portable a/c that cuts in when it’s very hot. The shed also has a Velux motorised roof window which I can open to get free cooling in the evening when the inside is still hot and the outside is cooler. But obviously the a/c should not run if the window is open. And vice versa. And the window should close if it’s hotter outside than in.

So I am wondering if anyone has suggestions for a cool algorithm to run the a/c only when absolutely necessary, or open the roof window when that would be able do the job.

I have sensors / bindings that give me the inside and outside air temperatures, the time of day, times of sunrise and sunset, and weather forecast. And I suppose that all of those variable could be inputs to the algorithm.

Did you not already have a crack at this yourself?

Note that I just slapped the below together, not much regard for OH rules syntax, declaring variables from item states, etc., but that’s a good learning exercise if you are not already familiar.

You’ll also need to figure out how to determine if it is raining, or if there is rain in the immediate forecast, based on whatever weather binding you use.

if shedTemp > hotShedThreshold {  // it's hot enough that we need to do something to cool the shed
  if boolRaining {  // don't want the window open when raining
    shedAC.sendCommand("ON")  // or whatever turns on your A/C
    roofWindow.sendCommand(100) // or whatever closes your roof window
  } else {   // it's not raining, now need to decide based on temp whether to use window or A/C
    if outsideTemp > desiredShedMaxTemp - 2 {  // it's too hot outside to provide meaningful cooling, run A/C
      shedAC.sendCommand("ON")
      roofWindow.sendCommand(100)
    } else if outsideTemp < shedTemp - 2 {     // in this branch, outside is cool enough to cool the shed;  and outside is cooler than shed, so we can use the window - but likely need some delta temperature, otherwise  to actually get meaningful cooling, i.e. if outside is 0.1 degF cooler than outside, we won't get much help
      shedAC.sendCommand("OFF")
      roofWindow.sendCommand(0)
    } else {  // otherwise outside is *not* cool enough to cool the shed, so use A/C
      shedAC.sendCommand("ON")
      roofWindow.sendCommand(100)
    }
  }
} else {
   // it's not hot enough in the shed to do anything; close window and turn off A/C
  roofWindow.sendCommand(100)
  shedAC.sendCommand("OFF")
}

The 2 degF (or degC) bands for deciding if outside is cool enough to meaningfully cool the shed can be tuned to your needs.

I would think you could run this as a rule triggered by change in any number of items … temperatures, expected precipitation, etc.

1 Like

Yes, I did. It was also based on the delta T, but not as sophisticated as your solution, so I was not happy with it at all. I think your solution is far better.

Apropos the rain sensing, the Velux roof windows have an in built sensor, so even if you command them open from OH, the sensor overrides the command and keeps them closed.

Sounds nice, but be prepared for that sensor to fail at some point or another. And if you rely on it, you won’t cool the shed down on hot rainy days (likely a corner case). But if that sensor fails, your windows will open when they shouldn’t.

There should be a weafher binding that provides you an “expected precipitation” number for today.

Yes I have that one. Thank you. (DarkSky binding).