My plan:

  • Log electricity consumption.
  • Place an IR sensor so I can know when the apartment is habited.
  • Record temperature
  • Control the air conditioning

The first three are easy. I just built a Node... I call "Node"  to an ESP8266 + PS + anything_else connected by MQTT to my Home Automation Core  (see my other project). The node has a 220V-5V PS, a Mini IR Sensor, and a current transformer to the ADC input of the ESP.  Also I add an 20A Relay which I could use to control the A/C... well to cut the energy.  But that was my last option, because is dirty, I'll have guests complaining of  A/C malfunction, and I still have a secret hope: My A/C had a sticker that said: "Smart ready". After some investigation I learn that you need to buy some device (AEH-W4A1), wich will connect your A/C to the Wifi, and from there directly to some server in China. And with a (buggy) APP you can control the A/C. Not very handy to control from anything else. Besides the board was expensive (when you have the opportunity of doing some hacking any other option above 0USD will be expensive), and not available, at this time, in Argentina. 

So after more diggind  a found some guys who Wiresharked the comunication between the board and the servers, so I learn that you can send some TCP packets to the port 8888 and control the A/C. Nice, but you still needed the board, which I don't. So more digging and I found out that the board is not much more than a TCP<->RS485 bridge.. so the same packets sended by RS485 directly to the A/C should work. Finally good news!

I took and ESP a MAX485 and not much more. Yes, this MAX is 5V not 3V3, but I had a lot (this is why the resistor). A MAX3485 will be a much better option. The A/C Smart Ready Port was 4 pins: +5V, GND, A+, B+ So I could power the chips, from there. 

Well... I'm not proud of it, but in my defense: I  did it in no time

Notice the poor man step down with two diodes. 

Until this point I didn't have access to the apartment (luckly the bussiness was running fine). So when I had the first free day in the calendar, I grab everything, and went there.  

The Mini IR sensor with it's 3D printed case. 

The first node (Current, Temperature and IR sensing) worked out of the box. But the A/C was a little tricky. Mostly was about timing: after transmiting I switched the MAX485 to reception too quickly. Finally 1ms delay was just fine. After solved that, I could send a status message and get a response. I didn't have much time left, so I leave some sort of MQTT<->RS485 bridge, and I left the apartment. From home I'll figure out the encoding.  And so I did.. well not everything, but what I needed: I found how to get the status (mode, running, set temperature, etc.) and how to turn off and change the temperature set point. 

Was a matter of create some nodes in Node-RED to:

  • If someone set the temperature below 23ºC  (~73ºF) the Node-RED will set back to 23. 
  • if during the daytime, there are more than 3 hours of no activity on the IR sensor, the A/C is turned off. 
  • On both cases a log message is recorded and pushed to my phone

Not sure yet how much money I'm saving, but feels very well when a get the messages. And lets by honest it never was because the money ;)

Set point log graph: Ups, I'm sorry, 23ºC is the minimum

If you are wondering: most of the people leave the apartment with the A/C on. Sometimes all day long. And everyone tries to put it below 23 at least once. It's sad but only few people cares about others and the environment. 

Next steps

Now I thinking how to improve it in the future:

  • A sensor in the lock to be sure that the apartment is empty. 
  • Sensors in the windows to turn off the A/C if a window is open. 

Notes

My A/C brand is Fedders, but this should work...

Read more »