I’m really hoping someone came help me with some code in Vera to send IR signals to my Keene Kira IR Module. If I can do one of these the I should be able to do them all…
I have my Kira Module set up in ‘Stand Alone’ mode and what I’m trying to do is send the following IR Code to that module above.
Commands are as I understand it (from the API doc above) sent as ASCII text to the IP address of a module on the IR port, all commands will then be respond to with an ‘ACK’ to say if they are received OK…
What I know.
The Standalone Kira IR Module IP is : 192.168.1.19
The Port to be used is : 65432
The IR code is : K 280D 097A 0253 0272 0241 04C9 0240 0273 0241 0272 0240 04CA 0241 0273 0241 0271 0242 04C9 0241 0272 0240 0273 0240 0273 0240 0273 2000
To help I found this online - http://melloware.biz/products/intelliremote/Intelliremote%20User%20Manual.pdf
Which suggests the following.
UdpIp(“192.168.1.101”, 65432, “K 280D 097A 0253 0272 0241 04C9 0240 0273 0241 0272 0240 04CA 0241 0273 0241 0271 0242 04C9 0241 0272 0240 0273 0240 0273 0240 0273 2000”)
How would I do this with Luup, just to test and then later maybe try to create a module so that this code (plus many others) could be linked to a button.
Huge thanks in advance.
Reading various resources on the net, this iy first (ever) attempt at a piece of code to do get Vera to send an ASCII IR Code to my Kira IR receiver.
local s = socket.udp()
s:sendto("K 2416 0A6A 0378 01BC 01BC 01BC 01BC 01BC 0378 01BC 0378 0378 01BC 01BC 01BC 01BC 01BC 01BC 01BC 01BC 01BC 0378 0378 0378 01BC 01BC 01BC 01BC 0378 01BC 01BC 01BC 01BC 0378 0378 0378 01BC 01BC 01BC 01BC 0378 01BC 01BC 01BC 2000", 192.168.1.19, 65432
s:close()
end
That’s actually very close. I think you need to tweak it something like the following (not tested):
socket = require("socket")
local s = socket.udp()
s:sendto("K 2416 0A6A 0378 01BC 01BC 01BC 01BC 01BC 0378 01BC 0378 0378 01BC 01BC 01BC 01BC 01BC 01BC 01BC 01BC 01BC 0378 0378 0378 01BC 01BC 01BC 01BC 0378 01BC 01BC 01BC 01BC 0378 0378 0378 01BC 01BC 01BC 01BC 0378 01BC 01BC 01BC 2000", "192.168.1.19", 65432)
s:close()
Once you get this part working just let me know. With only a few steps it should be easy to transform this into an IR Transmitter Plugin for the device. Then it will work with SQBlaster, et-al, with appropriate IR Devices in Vera.
Guessed you are a star, it works !
That code is for the UK’s Sky HD (satelite TV) box and it represents the code required to invoke the Select button.
With the Kira module, Keene provides a java app that allows me to captures the IR code signal from any standard remote.
What do you think we need to do next?
OK, a bit more learning and playing. I can now send a 3 digit channel code (101) via the KIRA IR module.
[code]socket = require(“socket”)
local s = socket.udp()
s:sendto(“K 2417 0A4E 0369 01BE 01BA 01BC 01BC 01BC 0365 01BE 0365 036C 01BA 01BC 01BC 01BC 01BA 01BE 01BA 01BC 01BA 036E 0363 036E 01B7 01BC 01BC 01BC 0365 01BE 01BA 01BE 01BA 01BC 01BA 01BE 01BA 01BE 01BA 01BC 01BA 01BE 01BA 01BC 01BA 036E 2000”, “192.168.1.19”, 65432)
luup.sleep (1000)
s:sendto(“K 2418 0A4C 036B 01BE 01BA 01BC 01BC 01BC 0367 01BC 0365 036C 01BA 01BE 01BA 01BC 01BA 01BE 01BA 01BC 01BC 0369 0365 036C 01BA 01BC 01BC 01BC 0367 01BC 01BC 01BC 01BA 01BC 01BC 01BC 01BC 01BC 01BA 01BC 01BC 01BC 01BA 01BE 01BA 01BC 01BA 01BE 2000”, “192.168.1.19”, 65432)
luup.sleep (1000)
s:sendto(“K 2417 0A4E 0369 01BE 01BA 01BC 01BC 01BC 0365 01BE 0365 036C 01BA 01BC 01BC 01BC 01BA 01BE 01BA 01BC 01BA 036E 0363 036E 01B7 01BC 01BC 01BC 0365 01BE 01BA 01BE 01BA 01BC 01BA 01BE 01BA 01BE 01BA 01BC 01BA 01BE 01BA 01BC 01BA 036E 2000”, “192.168.1.19”, 65432)
s:close()[/code]
Do I need all the IR codes captured in a particular way so tHat they can be called from a device button rather than scripted every time?
Guessed - You mentioned this as a ‘plugin’ what does that mean exactly?
So I’ll start outlining how to transform what you’re doing now into two fundamental pieces:
[ul][li]a) an IR Transmitter plugin, containing the core of your UDP Socket code[/li]
[li]b) one or more IR Device plugins, containing the IR Codes for that specific piece of AV kit.[/li][/ul]
For any one physical IR Blaster, like your KIRA, there will be one IR Transmitter within your Vera setup, and there will be one-or-more IR Devices representing/mirroring each of the physical pieces of AV Kit you have (DVR, Amplifier, DVD Player, etc)… It’s these IR Devices that end up being associated with the IR Transmitter, which contains the shared-code needed to bridge the “Raw IR Codes” over to the KIRA and out to your AV gear.
We’ll do this over a few posts, interactively as you develop out each bit, to make it easy to learn. That should also help anyone else that wants to do the same at a later point also.
If you want some starter code to read, look at the following files for an example IR Transmitter plugin:
http://code.mios.com/trac/mios_sqblaster/browser/trunk
specifically the files [tt]D_SQBlaster1.xml, I_SQBlaster1.xml[/tt]… you can ignore the rest for now (and you can always ignore the Controller files, as they’re a lot more complex and not needed here)
For an example IR Device, you can use the following files, for a DirecTV DVR:
http://code.mios.com/trac/mios_directv-media-control/browser/trunk
Don’t worry too much about the details yet, since there will be a bunch of changes to transform these into what you need, but they’ll give you a sense of the components involved.
Thanks again Guessed
Although, I must admit what you’ve linked me too looks a very daunting experience !? 
The D_DirectTVDVR and the D_SQBlaster look very similar in structure up to line 9 but then things change? And it’s the same for the I_xxxxx files but only up to Line 7…
In the D_DirectTVDVR it references other xmls files whis do not seem to be in the root directory you shared…
However I can see that in the I_DirectTVDVR file there is an which looks like the place where I would put the IR codes for the Sky+ HD STB Remotes E.g?
<action>
<serviceId>urn:micasaverde-com:serviceId:NumericEntry1</serviceId>
<name>0</name>
<run>
socket = require("socket")
local s = socket.udp()
s:sendto("K 2417 0A4E 0369 01BE 01BA 01BC 01BC 01BC 0365 01BE 0365 036C 01BA 01BC 01BC 01BC 01BA 01BE 01BA 01BC 01BA 036E 0363 036E 01B7 01BC 01BC 01BC 0365 01BE 01BA 01BE 01BA 01BC 01BA 01BE 01BA 01BE 01BA 01BC 01BA 01BE 01BA 01BC 01BA 036E 2000", "192.168.1.19", 65432)
</run>
</action>
I’ll have a go at working these as best I can, assuming he above is correct?
Cheers
Don’t worry with the details for the moment, it was more so you could see “complete” (ish) examples of both IR Transmitter and IR Device type files… and their overall characteristics, sections of the files (etc).
I’ll try to slowly introduce you to the “pieces” of those files over a series of posts so it’s more incremental learning.
It’ll start by transforming the SQBlaster IR Transmitter plugin files over to being used for KIRA. In the case of KIRA, we’ll be gutting/removing a lot of logic of the SQBlaster since the KIRA is simple. What it will pickup though is stuff like IP Address configuration/parameters (etc) so that won’t need to be hard-coded anymore.
At the end, we’ll split out “how to send the code” (UDP et-al) logic (the UDP Transmission style) from the “what to send” component (the IR Data).
That’s the difference between IR Transmitters and IR Devices. IR Transmitters focus on “how to send”, whilst IR Devices focus on “what to send”
@parkerc,
I’ve attached a really stripped down version of a starter plugin for the KIRA. It consists of two files (for now):
[tt]D_KIRA1.xml[/tt] - A Device description file, indicating that this is an IR Transmitter, and that it exposes one [i]Service[/i] for that function.
[tt]I_KIRA1.xml[/tt] - An implementation file, with a rough-out of the methods needed...
These are a smaller skeleton of files to implement as compared to what I hyperlinked earlier, hopefully making it easier to see what’s going on.
In the [tt]D_KIRA1.xml[/tt] file, we’re delcaring that this is an IRTransmitter device type, and that we’re implementing the Service:
[tt] urn:micasaverde-com:serviceId:IrTransmitter1[/tt]
This service has a single action, called [tt]SendProntoCode[/tt], and you’ll see the implementation declared in a block like:
<actionList>
<action>
<serviceId>urn:micasaverde-com:serviceId:IrTransmitter1</serviceId>
<name>SendProntoCode</name>
<run>
sendProntoCode(lul_settings.ProntoCode)
</run>
</action>
</actionList>
The actual function [tt]sendProntoCode[/tt] needs to be implemented, and there’s a stub of it in the [tt]I_KIRA1.xml[/tt] file (attached) that you need to fill out with your previously worked out UDP callout code.
Everytime that Vera wants to send an IR Code over to a IR Device, it’s this “[tt]SendProntoCode[/tt]” action that gets called. There’s a parameter to this action, defined by [tt]lul_settings.ProntoCode[/tt], that contains the actual “string” of pronto code that needs to be sent over. This allows the Plugin code to be re-used across a series of IR Devices, since the IR Code is passed in on each call.
Thanks Guessed,
Please keep in mind that I’m very very new to all this 
If I have understood you correctly I need to do the following (removing IP and Port details) in the I_kira1.xml underneath the ‘SendProntoCode’ one? Although that does not feel right, hence I thought it best to check.
<actionList>
<action>
<serviceId>urn:micasaverde-com:serviceId:IrTransmitter1</serviceId>
<name>SendProntoCode</name>
<run>
sendProntoCode(lul_settings.ProntoCode)
</run>
</action>
<actionList>
<action>
<serviceId>urn:micasaverde-com:serviceId:IrTransmitter1</serviceId>
<name>0</name>
<run>
socket = require("socket")
local s = socket.udp()
s:sendto("K 2417 0A4E 0369 01BE 01BA 01BC 01BC 01BC 0365 01BE 0365 036C 01BA 01BC 01BC 01BC 01BA 01BE 01BA 01BC 01BA 036E 0363 036E 01B7 01BC 01BC 01BC 0365 01BE 01BA 01BE 01BA 01BC 01BA 01BE 01BA 01BE 01BA 01BC 01BA 01BE 01BA 01BC 01BA 036E 2000")
If I am asking too much, would you mind putting in a couple of Sky Tv IR codes in the xml so I can see exactly how they should be, i can then fill in the rest. ( In the posts above you have codes for ‘Select’, 1 and 0.
Huge thanks - this is exciting stuff !! 
Actually, there’s a bit of code in the [tt]I_KIRA1.xml[/tt] file that needs to be completed first, it’s blocked by the TODO: string:
[tt] local function sendProntoCode(prontoCode, channel)
local startTime, execTime
--
-- Perform a UDP Socket send to the IR Blaster.
--
startTime = socket.gettime()
--
-- TODO: Add logic here to send the IR command, over UDP, to the IP Address defined
-- by the variable "ipAddress", using the IR command defined in the variable
-- "prontoCode".
--
<<put code here to send the IR Command>>
execTime = math.floor((socket.gettime() - startTime) * 1000)
debug("KIRA request delivered in " .. execTime .. "ms")
end
[/tt]
This file will only have the “how to send” part, not the “what to send”.
That latter stuff, which will look like a set of “[tt]K 2417 0A4E 0369 …[/tt]” strings, being mapped to IR actions like will actually go into the other file which we haven’t started yet… we will, don’t worry.
Hi Guessed
I’m so sorry but you are going to have to forgive my ignorance, I’m really stuggling as this is so alien to me.
As we will be specifying the to IP and port, is the TODO section Is the code to go there ?
socket = require("socket")
local s = socket.udp()
s:send()
Am I way off? Or looking online, is it maybe something even simpler ?
udp:connect(host, port);
udp:send()
You’re thinking in the right direction…
This part, is already done at the top of the entire plugin, so the “[tt]socket[/tt]” variable is already setup for you, and isn’t needed again:
socket = require("socket")
When you come into this code, you also have access to a variable called [tt]ipAddress[/tt], which is populated by the [tt][/tt] block.
You also have access to a parameter called [tt]prontoCode[/tt] which is passed into the function. Putting these pieces together, the TODO block would look something like:
local s = socket.udp()
s:sendto(prontoCode, ipAddress, 65432)
s:close()
If you make those edits, and re-attach the files to a forum post here, I’ll double check it and then you’ll be done with building the IR Transmitter plugin.
Then we can move onto the easier part, building the IR Device. Then we’ll join them together in Vera, and you’ll see how it all works together.
@ Guessed
OK, I’ve added in a value for the IP at the top and also placed the code into the TODO section.
Things are still a bit foggy, but the mist might be clearing (a bit) 
(fingers crossed)
Cool.
In order for them to be re-usable, certain pieces of information are kept outside of the code, and are instead placed into Configuration Parameters or “Service Variables”.
Things like IP Addresses fall into this bucket, since these are going to change from one person’s device to another.
To avoid hard-coding this in the code, we do a few things in this code, notably:
a) We declare a variable at the top to contain the IP Address
That’s this line
local ipAddress
b) We put in some startup code that captures the IP Address from the devide Config.
… and we print it out, and if it’s not set, we show the user an error. That’s this set of lines
[code] ipAddress = luup.devices[lul_device].ip
log(string.format(“Running Ethernet Attached I_KIRA1.xml %s on ip=%s”, lul_device, (ipAddress or “Not Configured”)))
if (ipAddress == nil or ipAddress == "") then
return false, "IP Address is required in Device Advance settings", "KIRA"
end
[/code]
Once we get around to installing the plugin, you’ll see that on the Device’s “Advanced” tab, there’s a field you can use to configure the IP Address ([tt]192.168.1.19[/tt], in your case), and that the plugin will present a user-error if this isn’t filled in.
Anyhow, I’ve revised the file a little to remove the hard-coded IP… it’s attached.
Thanks
What do I need to do next ?
… now you build out the IR Codes for anything you’re interested in. I’ve attached stub versions of this, with the “0”, “1” and “Select” keys having their IR Codes already entered (based upon data you’d provided before).
I modeled these off of the DirecTV Plugin, since it’ll contain many of the same functions that your SkyHD Box does. If you don’t have codes for them all just yet, you can leave them blank.
The codes go in between the [tt]…[/tt] tags in the file, similar to this one for the Select key you’d already captured…
[tt]
urn:micasaverde-com:serviceId:MenuNavigation1
Select
K 2416 0A6A 0378 01BC 01BC 01BC 01BC 01BC 0378 01BC 0378 0378 01BC 01BC 01BC 01BC 01BC 01BC 01BC 01BC 01BC 0378 0378 0378 01BC 01BC 01BC 01BC 0378 01BC 01BC 01BC 01BC 0378 0378 0378 01BC 01BC 01BC 01BC 0378 01BC 01BC 01BC 2000
[/tt]
You don’t need all of them, just enough to do some core functions. You can always upload newer versions at a later date.
BTW: Each of these “ACTIONS” defined in a plugin will automatically appear in the Scene Editor. When you build a new scene, you can select the “Advanced” option, and then the device, and it’ll list all these ACTIONS. This will allow you to script the <1> <0> <1> sequence you’d specified before using no code… including any delays you might need between the digits.
Similarly, the previous code-files will expose an ACTION calls “SendProntoCode” in the Advanced tab of the Scene editor. This will allow you to send Raw codes.
If you want to experiment with uploading these, you can use the instructions at:
http://wiki.micasaverde.com/index.php/Install_LUUP_Plugins
They’re for UI4, but it’s very similar under UI5. I haven’t tested these files yet, so there may be problems that we’ll want to correct…
Thanks again
Right, I’ll have a play.
Quick Question - Can/Will these codes be available as buttons within the ‘Device’ we’re creating? So it can act as a virtual remote control?
Also it’s a shame SQRemote can’t make use of these Kira IR IP modules, as I noticed within their software they have the Sky Satalite codes built in 
My question is a little off topic but relative to Kira capabilities: are you able to manage volume properly ? You know, I mean repeated IR commands.