Cool Box Temperature

Hi

I am looking at automating a plug in cool box. I have a temperature sensor in the box and a smart socket. The plan is that between the hours of 7am and 10pm, I want to check the temperature every 30 minutes and either turn the switch off (when temperature is low) or on (when temperature is high). I can set an upper temperature limit but the trouble is that I don't have a fixed lower limit as the box will cool based on the ambient temperature. So in winter it might get down to 2C but in summer that might 5C.

I am not sure how to do this. I thought I might use a variable. The first time it reads the temperature, this is recorded in the variable. Then every time it reads the temperature, it compares it with the variable. If it is the same (will need a small +/- range) then assume that is the lowest temperature the box will get to and hence switch the socket off.

Am I on the right track? If so, how would you write the rule?

Thanks

I know there is nothing more annoying than someone saying "are you sure you want to do that?" but I am not sure you want to do that lol. I mean there is a max temperature you can accept, like you say. But imho there is also a target low temperature. If you've not reached it - because it's summer and the coolbox can't reach it - wouldn't you need to keep it running anyway just in order to keep it as near the desirable temperature as possible?

No problem with being asked "are you sure you want to do that?" - get asked it a lot at home!

Essentially I left the previous cool box running between 7am and 10pm on a timer and after 18 months continuous use, the motor burnt out. Also trying to minimize my electricity usage. We generally use the box to pre-cool drinks (okay - mainly beer!).

You are right I would need a target minimum temperature. I tested it with an empty box and it got down to 4C but that was not a particularly warm day. So I don't know what to set that to. If I make it too low, the box will just keep running. That's why I thought about trying to work out if can measure the minimum it can achieve on that day, I can use that as a base from which to control the box.

Or maybe I am over thinking this! :exploding_head:

No you're not overthinking. I wanted to do something like this for my home fridge for a different reason. We have a temperature and luminance sensor in the fridge. If the light is detected for more than 5 minutes it notifies us "has the door been left open?". If it stays too warm for longer, it asks us the same. The problem with the warmth is it can take time for the temperature to get back down to the running level, even if the door was properly closed after use. But if I allow 20 minute delay before notification and the door was wide open, it could be really really warm before we find out. So I wanted to detect if the temperature was going up or down in that time. I got foiled in my attempts when I realised the Sensative strip I was using wasn't going to tell me often enough (without killing the non-chargeable batteries) so I just left it at the 20 min delay. But yeah you do appear to have a good reason for doing what you're planning. I think your logic is along the right lines with the variable for comparison with previous reading.

The only difference with what you're proposing is I wouldn't only write to the variable the first time, but each time, after doing the comparison

Might also consider how many cycles you want to run to determine you’ve hit minimum possible. Thinking if you hit 5C and it stayed that way for 3 cycles that may be your minimum possible for those conditions so turn it off until it goes above 5.5C (or what ever your tolerance is).

So it looks like I have got it working. Probably not the most elegant code and the cool box is struggling to get the temperature down due to the warm weather, but I am going to run with this and see how it goes.