So my Super Villain lair is super secretly located in my converted garage… shhhh.

So we found out that Florida is a rough place to be a super villain.  It’s hot here.  So I needed a way to help keep my lair cool.  So many full moons ago my minions held a Staples store for ransom till they gave me an AC unit.
lx_140_set

 

This thing is huge.  It’s a 14000 BTU unit.  I have an exhaust vent that goes up through the ceiling and vents outside.  It is actually pretty good at cooling down my lair.  But it is another AC unit that can use up some power.  Since the Super-Wife is not a fan of paying giant power bills, I have to turn it off when I am not in the office.  This was one reason thy the remote was very handy.  But.  It’s 2016.  Hello!  Just a remote?  That’s it?  HA! Right!

I have worked on trying to automate this thing for awhile.  A while back I used the Arduino Infrared Library to read codes from the remote, and then blast them back out.  But it didn’t work… I thought maybe it was using revolving codes.  Nope.

As it turns out, HVAC units have a tendency with their remotes to not send simple codes like “On”, “Heat”, “Fan-High”, “Temp-Up”  as you might think.  TV’s and even some small wall mounts use basic NEC hex codes.  Not this monstrosity.  No no.  After working on this thing for weeks I found an article that spoke about maybe my buffer size for reading the code wasn’t large enough.  The current RecvBuff was set to 100.  I was filling up all 100 locations.

So I changed it in the IRRemoteInt.h file.  Set it WAY higher.  Turns out my remote was sending 228 pulses.

client-pulse

 

So I decided to try to decode some stuff.  Lets try changing the temp.  228 pulses and most of them are the same.  Turns out my HVAC remote sends FULL state code every time you push a button.  To test this theory.  I set my HVAC to 72 degrees.  Went into a different room with the remote, pressed temp up until I was at 74 degrees.  Back in the office, the display still says 72, remote says 74.  I press up, the HVAC screen jumps straight to 75.  Full state!!  So that’s good to know, but a pain in the ass as I would have to do some SERIOUS work to decode the blocks and find out what changes to what.  But I never really need to do anything other than turn it on and off.  So lets find something simple.

I now have the following arrays of values

unsigned int powerOn[227] = {3400,1700, 450,1250, 450,1300, 450,450, 400,450, 450,450, 450,1250, 450,450, 450,450, 400,1300, 450,1250, 450,450, 450,1250, 450,450, 450,450, 400,1300, 450,1250, 450,450, 450,1250, 450,1300, 450,450, 400,450, 450,1300, 400,450, 450,450, 450,1250, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,1250, 450,450, 450,450, 450,1250, 450,450, 450,450, 400,1300, 450,1250, 500,400, 450,450, 400,450, 450,450, 450,450, 450,400, 450,1300, 450,1250, 450,450, 450,1250, 450,450, 450,450, 400,450, 450,1300, 400,450, 450,450, 450,450, 450,1250, 450,1250, 450,1300, 400,500, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 450,400, 450,450, 450,450, 400,500, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 450,400, 450,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 500,400, 400,1300, 450,1250, 450,1300, 400,1300, 450,1250, 450,1300, 400,1300, 450,1250, 500}; // UNKNOWN 3659AD56
unsigned int powerOff[227] = {3400,1700, 450,1250, 450,1300, 400,450, 450,450, 500,400, 450,1250, 450,450, 500,400, 400,1300, 450,1250, 450,450, 450,1250, 450,450, 450,450, 500,1200, 450,1250, 450,450, 450,1250, 450,1300, 400,450, 450,450, 450,1250, 450,450, 500,400, 500,1200, 450,450, 400,450, 450,450, 450,450, 450,450, 450,400, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 450,450, 400,450, 450,450, 450,1250, 450,450, 450,450, 400,1300, 450,1250, 450,450, 450,450, 450,400, 450,450, 450,450, 400,450, 450,1300, 450,1250, 450,450, 450,1250, 450,450, 450,450, 400,450, 450,1300, 400,450, 450,450, 450,450, 400,1300, 450,1250, 450,1300, 400,450, 450,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,500, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 450,400, 450,500, 400,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,1300, 400,1300, 450,450, 450,1250, 450,1250, 450,1300, 400,1300, 450,1250, 450}; // UNKNOWN 6BF20402

243448-Don-t-Judge-Me.-I-Was-Born-To-Be-Awesome.-Not-PerfectWith those values set in my arduino code I can now turn my AC ON and OFF in my office.  Cool haha, get it?  cool?  Shut up.  Don’t judge me.

 

 

 

 

So I did that work, and that was the end of it.  I didn’t really do anything more with it.  I wanted to figure out a good way of interfacing to it.  Earlier this week I found the following article on the OpenHab community.

MQTT IR transmiter/receiver

This turned out to be just what I needed.   I didn’t even realize I needed this, but it made perfect sense.  In short, use a tiny esp8266 chip with an IR LED and MQTT.

You can get them even cheaper from China.

AliExpress.com Product – 2015 New version 1PCS ESP8266 serial WIFI model ESP-01 Authenticity Guaranteed,Internet of things $1.79 Each.

arduino_dust_sensor_ESP8266-1I had one already laying around…. but where the hell is that tiny bastard!?!?!?!

Like finding a needle in an electronic haystack.  But I found it.

 

 

Threw in the code, built a programming jig for it.  Programmed it and BOOM!!! MQTT messages turning on my AC.  Nice!!!

069But that’s not home automation genius!

I know!

I’m getting there.  Geeze!!! Some freaking people am I right?

So time to hook this up in OpenHab.  I already have an MQTT broker configure in OpenHab for my OwnTracks setup.  So we need an Item created first.  So I setup a new Items file called “HVAC.items”

Switch Office_ac "Office AC" {mqtt=">[mqtt-home:esp8266/02/sender/RAW:command:ON:ON],>[mqtt-home:esp8266/02/sender/RAW:command:OFF:OFF]"}

Next let’s add to the sitemap.

Switch item=Office_ac

f1afa6d8e96b6f69bb5c73776177af24Try to keep up, I know it’s crazy difficult with all those configs and what not..  I need a drink.

Sweet.  Now I have a simple on/off switch for my AC.

……still just a remote jackass.

Really..

 

Really…..

1234931504682 (1)

 

 

 

 

C’mon.  Can’t we be friends?

I mean, you can be pinkie pie.

FANMADE_Pinkie_Pie_and_Rarity_friends_forever

Ok cool.

So for the AUTOMATION part, (I’m not bitter), we create a new rules file.  HVAC.rules

rule "Turn On AC"
when
Time cron "0 17 15 * * ?"
then
Office_ac.sendCommand(ON)
end
rule "Turn off AC"
when
Time cron "0 30 22 * * ?"
then
Office_ac.sendCommand(OFF)
end

So now, each evening around the time I start my crazy battle with traffic home (see here), my AC in my office will turn on then turn off each evening at 10:30.

So where do I go from here?  Well, the next step is to use my previously mentioned OwnTracks setup to see precisely when I leave from work and if I pass through a location which indicates my trip home, it will turn on the AC.  This way, it doesn’t matter if I leave work early or late, my AC will know and have an hour to cool down the Lair before I get home.

 

baby-its-cold-outside-14192655214ng8k