Controlling Daikin air conditioner from Vera

Hi guys,

Been using my Veralite for a while and loving it. But I’ve been trying to control my aircon. Of course, it had to be a Daikin with a difficult IR code, so my GC-100 wouldn’t do it. So eventually I got a Raspberry Pi to do it using this guy’s guide (http://opensourceuniversalremote.com/). I learned a couple commands in raw mode with irrecord in Lirc, and managed to set up his web ui.

How do I make that a device in Vera though? I assume I will need to create XML files with the html link to each command, but I have no idea where to start. I looked at the GC-100 plugin files to try and get started, but it seemed a bit over my head.

I also want to create a Plex device, since Plex has an HTTP API. So I basically need to know how to put a bunch of web commands into a plugin, give the plugin an IP to talk to, and then have those commands available to use in SQremote or OpenRemote.

Thanks to other posts on the forum, I have figured out HTTP POST commands in Lua.

If I stick this in Test Lua window:

local http = require(“socket.http”)
http.TIMEOUT = 5
result, status = http.request(“http://192.168.1.44:3000/remotes/daikin/off”, “run=run”)

the command works. Can someone explain how to put a few of these commands into a device?

Have a look at this message and the Daikin codes:

http://forum.micasaverde.com/index.php/topic,12857.msg115510.html#msg115510

In the implementation file you should be able to change the tags to tags. Your url calling code should be placed as a function between the run tags (where the ProntoCodes used to be). Ideally you would have one function and just pass it the relevant UR in each action to that function. Rather than just duplicating the same function with a different URL in each action. Have a read of this:

http://wiki.micasaverde.com/index.php/Luup_Declarations

and have a look at a few other implementation files to see how it fits together.

After a few restarts this URL will allow you to invoke your actions via your device:

http://VERA_IP/port_3480/data_request?id=lu_invoke

Note your device won’t show any buttons or the like in the user interface. That’s a whole other story that I won’t go into.

Just as a reminder - most digital cameras will display IR flashes on their LCD screens - so you can aim your IR emitter at your camera and look at the LCD screen to see if your code is working.

You are awesome, thanks. I actually used your guide on the other post to create a file for my Satellite decoder last week.

Will try this and hopefully come right. Would have been much easier if my GC100 could handle the long Daikin codes.

Thanks for your help, I got it all working. I have attached my files.

If you’d like to help educate me further…

  1. I was thinking of making this an HVAC device, could that be done. Because currently it shows up in Vera under AV gear. I thought of changing device type in the Implementation file, but then I assume it wouldn’t check the S_HVAC file, and if I changed it to do that, it would expect TempUp and TempDown buttons.
  2. Also, could you give an example of how to use a function so as not to repeat the url’s? I would like to use the same strategy to set up Plex as a device that can be controlled from Vera.

Thanks again. Next is my curtains.

First of all - go through all the files and replace “a-lurker” with “rtaxerxes” - it’s your device and your code @!!!

I haven’t played around with HVAC but I would suggest (that is I have never tried it & I’m guessing) in the description file you would change:

From: <deviceType>urn:schemas-micasaverde-com:device:IrDevice:1</deviceType> To: <deviceType>urn:upnp-org:serviceId:HVAC_UserOperatingMode:1</deviceType>

The description file will only check the “S_HVAC file”, if you ask it to use its services, under the tag.

Refer to: http://wiki.micasaverde.com/index.php/Luup_Plugins_ByHand

On the function side of things you would declare a function under a tag in the implementation file:

Again see: http://wiki.micasaverde.com/index.php/Luup_Plugins_ByHand

and you would call that function in your and pass the function the URL for the action rather than directly as you do now.

You can test out your function using:

UI5–>Apps–>Develop Apps–>Test Luup code (Lua)

Always terminate your test code with:

return true

So that when it returns false because your code is “US” (Un Serviceable/Ultra Stuffed) you will know.

Thanks for your time. I’ll have a look and try it out.

I programmed in Pascal about 20 years ago, so I understand the basics, but that was before OOP. Darn syntax…