Pt2: Automating a/c w/o knowing state nor toggle success

Pt2: Automating a/c w/o knowing state nor toggle success

2021-12-23 blog 1

This is a follow-up to the initial post on attempting to automate control of a manual air conditioner, using only climate sensors, a switchbot button, and node-red.

First, some caveats: the node-red VM has access to bluetooth hardware which can talk to the switchbot, the sensors handle sending in climate updates to node-red, where we live is fairly temperate so the a/c is only mildly used for cooling but never for heating, and the a/c is sufficiently powerful to cool our house.

So the proposition has evolved somewhat, and yet the challenge has narrowed. Almost every part of the problem is now solved – except for managing to accurately infer when the a/c is on. As at 2021-12-23 19:00 that portion of code looks like:

//1. Lounge temp drop significant
if ((lounge[3].val.temp - lounge[0].val.temp) >= 0.4) {
msg.payload.inferredair = 'on';
msg.payload.logicdesc += 'L3-L>=0.4. ';
}
//2. Lounge steady while verandah warm and climbing
if ( ((lounge[0].val.temp - lounge[2].val.temp) <= 0.1) && (verandah[0].val.temp >= 26.5) && (verandah[0].val.temp > verandah[2].val.temp)) {
msg.payload.inferredair = 'on';
msg.payload.logicdesc += 'Ld2<=0.1&V>=26.5&V>Vd2. ';
}
//3. Night and lounge<25 and lounge rh < 50 and lounge Avg(rh)<49

if ((verandah[0].val.lux < 1.0) && (lounge[0].val.temp < 25) && (lounge[0].val.rh < 50) && (msg.payload.Lrh5Avg < 49)) {

msg.payload.inferredair = 'on';

msg.payload.logicdesc += 'Vlx<1&L<25Lrh<50&Avg(Lrh)<49. ';

}

//4. Verandah >=26.5 and lounge<=24.5 and in/out 3+ hotter and lounge rise<=0.3

if ((verandah[0].val.temp >= 26.5) && (lounge[0].val.temp <= 24.5) && (verandah[0].val.temp - lounge[0].val.temp >= 3.0) && (lounge[0].val.temp - lounge[3].val.temp < 0.3)) {

msg.payload.inferredair = 'on';

msg.payload.logicdesc += 'V>=26.5&L<=24.5&V-L>=3.0&Ld3<0.3. ';

}

//5. rh5 (Avg <= 47.5+((Vrh-Lrh)/20)) and Max - Min <= 2.5
if ((msg.payload.Lrh5Avg <= (47.5 + ((verandah[0].val.rh - lounge[0].val.rh)/20))) && msg.payload.Lrh5Max - msg.payload.Lrh5Min <= 2.5) {
msg.payload.inferredair = 'on';
msg.payload.logicdesc += 'Lrh(Avg<=(47.5+((Vrh-Lrh)/20)))&Max-Min<=2.5. ';
}

//6. lounge vs verandah rh diff >= 30
// if (verandah[0].val.rh - lounge[0].val.rh >= 30) {
// msg.payload.inferredair = 'on';
// msg.payload.logicdesc += 'RH:Vrh-Lrh>=30. ';
// }

It’s still sometimes hit and miss, however I’d rate its accuracy now at over 90%. Most of the failures just result in a second cycle where the a/c is on or off rather than the opposite, before it adjusts. It’s been helped somewhat by discovering that the switchbot python code always tends to fail by timeout, which is simply overcome by perseverance.

Thoughts for next challenges here are: recording inferred a/c use durations/times of day, applying time of day power rates to those recordings to infer cost, and optionally a sliding scale of a/c activation rules by time of day to minimise a/c use during dearest periods.

 

One Response

  1. ben says:

    Testing

Leave a Reply

Your email address will not be published.