Kira IR Receiver and Transmitter Plugins

Vera runs my house but I use a Logitech Harmony 1100 to control my AV rig. The part where they interact is for control of the lighting. Previously I had an IR-controlled dimmer for the lights which was fine for the Harmony and I used an iTach so Vera could play too. Then I discovered MiLight lamps. :smiley: So now Vera is firmly in control of the lighting but Harmony doesn’t speak Z-Wave or UDP so is somewhat in the dark. ::slight_smile:

A search through the forum revealed several questions about getting Vera to receive IR but no apparent solutions. Time for a bit of engineering. ;D

The Kira standalone IR receiver, from Keene, seemed a good place to start. This device will read IR signals and transmit a coded string to a “PC” by UDP. It has a built-in web server for configuration and there is a Java application for testing. The device does exactly as claimed, but… When testing various remotes and buttons I noticed that there was significant variation in the burst times for a given code on multiple button presses and it also seemed to vary with remote-to-receiver distance. Clearly a simple look-up table was not going to work. :o

I decided I didn’t really care how many microseconds each burst took. All I really needed was to distinguish long and short bursts. After some experimentation I came up with a compact way of representing a code:

The first word is four hex characters. The first two digits are the carrier frequency in KHz and the last two are the number of burst pairs in the code. This comes directly from the Kira code string.

The second word is also four hex characters that represents a slicing value. Bursts above the slicing level are long and those below it are short. The value is determined by analyzing the code string from Kira to find the best fit.

The final part of the code is a string containing the bursts as L for long and S for short.


I cannot claim that this technique will work with any remote control. There may well be code formats that don’t lend themselves to this form of compression. Interestingly, it works with every one of my remotes and appears to be more reliable than some of the built-in decoders. 8)

OK. The result of all the playing is a plugin that will allow Vera to receive IR codes from a standalone Kira device via UDP. The plugin includes facilities for learning the codes; viewing, deleting or renaming codes; backing-up or restoring the code set (/etc/KiraRx.xml). When the plugin recognises an incoming code, the code name is made available as an event. This can be used as a trigger for scenes and PLxx plugins by testing for the KiraRx device’s IR code received event with the required code name in the Code: field. It is so easy to use there must be a catch. I’m sure someone will point this out to me. ;D

This is a beta-level plugin. It is working really reliably on my system but it may not work on yours. If you want to try it out, the files and instructions are: Here.

I have also written a plugin to transmit IR codes by name using a KIRA module. This is called KiraTx. KiraRx and KiraTx can work with the same physical KIRA module or different ones. The two plugins may be used together or own their own. The beta-level code and instructions for KiraTx are available: Here.

There is now a plugin in the App Store. KiraRT combines the functionality of KiraRx and KiraTx. See this post for details.

Edit: 18/02/2014 11:17 New version of KiraTx uploaded. Allow codes to be sent multiple times. Import of Pronto codes with dummy repeat fixed.
Edit: 18/02/2014 11:55 New version of KiraRx uploaded. Import of Pronto codes with dummy repeat fixed. I_KiraRx.xml only.
Edit: 28/03/2014 19:06 New version of KiraRx uploaded. Improved resilience to corrupted IRCodes. I_KiraRx.xml only.
Edit: 28/03/2014 19:06 New version of KiraTx uploaded. Improved resilience to corrupted IRCodes. Allow import of KIRA codes with repeat extension. I_KiraTx.xml only.
Edit: 03/02/2015 11:18 KiraRT plugin released in App Store.
Edit: 17/02/2015 10:10 KiraRT V1.1 released in App Store. Added TXO option.
Edit: 12/03/2015 00:18 KiraRT V1.2 released in App Store. Fixed for firmware 7.0.5.

Hi Rex

Great stuff, I’ll have a play …

(Where were you when I needed you last year :wink: - i made some device controls for it, so rather than just recieve, maybe your plugin can evolve to send codes too. -,10886.0.html)

I also posted the code I got from Keane to convert Pronto IR codes to KiRA codes, having that working would open up a whole world of devices…

It seemed to me that IR transmit from Vera was pretty well covered. I did follow your thread getting a Kira to work as a transmitter and I thought you had that all up and running. I used the GC100 plugin for my iTach and just made a new device file with Pronto codes for my IR-controlled dimmer. I used the iTach utility for capturing codes and converting to Pronto and it all worked fine.

The glaring hole, for me, was that there didn’t seem to be any solutions for Vera to receive IR. I didn’t worry too much about having compatibility with Pronto codes - I just made it easy to learn the codes you want to use. It wouldn’t be too hard to write a converter from Pronto to KiraRx if that was important to somebody. All the required information is present in Pronto so it would just need translating to the simplified format I have adopted. In practice, though, why not just learn the codes directly to Vera with KiraRx? You don’t even have to fiddle around finding the right distance between the receiver and remote. You just fire the remote from the same place you would when using it normally.

What is it that you need done with the code from Keane? If you just need the java converted to Lua, try the following. I tested it with a known Pronto and Kira code on Lua for Windows and it seems to do a good job.

[code]function ProntoToKira(pcode)
local pwords = {}
local kwords = {}
local px = 0
for i = 1, #pcode, 5 do
px = px + 1
pwords[px] = tonumber(string.match(string.sub(pcode,i,i+3),“%x+”),16)
local freq = math.floor(4145 / pwords[2])
local ct = math.floor(1000/freq)
local n = pwords[3]
if n == 0 then n = pwords[4] end
kwords[1] = string.format(“%02X”,freq)…string.format(“%02X”,n)
for i = 5,px do
kwords[i-3] = string.format(“%04X”,math.floor(pwords[i] * ct))
kwords[(n2)+1] = “2000”
local s = “K”
for i = 1, (n
2)+1 do
s = s…" "…kwords[i]
return s

local pronto = “0000 006C 0000 0019 0017 0018 0017 0030 002E 0018 0017 0030 002E 0030 002E 0018 0017 0018 0017 0030 0017 0018 002E 0018 0017 0018 0017 0018 0017 0018 0017 0018 0017 0018 0017 0018 0017 0018 0017 0018 0017 0018 0017 0018 0017 0018 0017 0018 0017 0018 0017 0030 002E 0EEE”
local kira = ProntoToKira(pronto)

Thanks Rex! I have been looking for this solution for years (i kid you not).

Just to confirm, is this the correct Kira module to purchase?


Yes sir. That is the correct module - if you want a UK power supply. The kit with a Worldwide power supply is [url=][/url]. This includes a wall-wart PSU that has interchangeable power plugs (and costs you another tenner).

Let me know how you get on.

I have been looking for this solution for years...
Not so many years that you're running a Vera 2 on UI4, I hope. ;) This plugin is written for UI5 and I can only test it on my Vera Lite.

I have added some IR code import functions to KiraRx. It can now import Pronto IR codes and standard Kira IR codes. You just paste the complete code string into the import box and then click either Pronto or Kira buttons. The converted KiraRx code can then be saved with an appropriate name.

I would still recommend learning the codes directly from the remote control, though. This gives the best chance of trouble-free recognition.

Hi Rex

If i get home early enough I’m going to have fun playing witht their new Pronot to Kira Code converter. :slight_smile:

Are there plans to add ‘transmit’ so I can recall the codes I’ve added and have then sent out via the KIRA transmitter? (May e I can then retire my own KiRA plugin device and IR code xmls.?)

If i get home early enough I'm going to have fun playing witht their new Pronot to Kira Code converter.
If you mean the lua code I posted then I hope you do have fun. You can either run it with [i]Lua for Windows[/i] (or another Lua environment) or you could build it into your plugin. If you run it in [i]Lua for Windows[/i], put [b]print (kira)[/b] after the last line and then you can copy/paste the Kira code string from the output window.

In case is isn’t clear, the import function in KiraRx will convert either Pronto or Kira codes to the internal format I am using in KiraRx (which I am calling KiraRx format). It does not convert Pronto to normal Kira code.

As for adding transmit functionality to KiraRx, I have no plans to do that. What is missing from existing IR sending solutions - including your own plugin?

Thanks Rex - youre right i did grab the wrong end if the stick…

Regarding "Transmit’

In my plugin (if i can call it that) I currently run 2 devices, one is the transmitter and the other is the Set Top Box I want to control. The creation of any new IR controllerabke devices requires the compilation of a new XML.

So by the potential looks of what you’ve built, it could learn a group of RAW commands quite quickly, place them in an XML and potentially have them recalled and transmitted via a scene etc. (making it an all in one device)

Sadly I’m not a programmer, (hence i admire all that are) and the work I did was very much influenced by @Guessed. He talked me through it. But I always wished my plugin could do more. I never thought about the learn and trigger concept you did, which is cool. I just wanted it to control my AV kit via Vera and I could use apps (like HomeWave) to create a virtual remote etc.

You’ve breathed new life into my KIRA and I thank you for that :slight_smile:

Well that is a thought. I could create a plugin for Kira Transmitter that used the same concept of a named library of commands so you could just call them by name from a scene. They would have to be real Kira commands - not the compressed ones I use in KiraRx - but we already have the ProntoToKira converter. :smiley:

Now I’m wishing that I had bought the Kiras as a pair! I may have to use you as an alpha tester…

Happy to help 8)

I have my KIRA set up in Stand Alone mode, so it can both send and receive IR signals, how is yours set up?

Mine is set up the same way. I just need to plug in the IR blaster and sit it so the IR bounces off the wall and back to the AV gear. I’ll have a play. ;D

I added a couple more buttons to allow you to step through your stored codes - so you can remind yourself what you called them. ;D The First button displays the name and code for the first entry in the list and the Next button displays the next one each time it is clicked. Note that, due to the way Lua tables work, the names will not be in any discernible order.

I’ve uploaded a new version of KiraRx. The most noticable change is that you now have to confirm before you delete or overwrite your favorite stored code. :wink: You also have to confirm before you restore an old backup over your latest, lovingly learned, fully tested and thoughfully named set of codes. ;D

The new version also contains hooks for the currently-in-alpha KiraTx Transmitter plugin. This looks uncannily like KiraRx and is also based on the concept of a table of stored codes that can be learned or imported. KiraRx and KiraTx work as a team so that there is no unseemly squabble over who owns the UDP port. The two plugins will cheerfully use a single standalone Kira module to give you the ability to trigger scenes or PLxx logic on receipt of named codes and to also send IR codes by name from scenes or PLxx actions. Watch this space for the beta release of KiraTx.

Vey interesting work.

Is the plugin working with the Kira IR anywhere and the kira128 ?
Considering this plugin and Vera usage, is there a reason to choose the kira128 rather than the Kira ?

Can a unique Kira be used internally as a IR relay (transmit a IR signal it receives) ? If not, I imagine that the plugin can allow to do it ? But there will be a noticeable delay between receive and transmit ?

Is the signal strength of the Kira good ? How much directive is the Kira ? Angle ?
How many devices can be controlled by the Kira when using an additional transmitter cable ? Can we use only the Keene cable or can we use cables from other brands ?
The Kira can be used used with a Powermid ? The Powermid could act as a RF relay and then send the IR signal to the Kira through a jack cable ?

Hi Lolodomo

[quote=“lolodomo, post:15, topic:175170”]Is the plugin working with the Kira IR anywhere and the kira128 ?
Considering this plugin and Vera usage, is there a reason to choose the kira128 rather than the Kira ?[/quote]

There should be no real difference in performance with the plugin, the main difference is the amount of memory that the 128 has available, that way it can store more IR codes onboard - however if you are using the Plugin (Rex’s or the one I fumbled together) the codes are stored in an XML on Vera so one board memory is not important… (there is also a KIRA128 RS232, just to confused things)

Rex - has done a Receive and a Transmitter plugin, so it keep both of them seperate, so currently the code will have to be stored first before it can be transmitted - however I think that is most likely to be the way you would use it)

it’s OK, but you can update the transmitter and also the received sensor, so there are a lot of options.
I have my Kira connected to a IR Distribution unit, so Kira is actually hidden away

Out of the box, you are looking at line of site for Kira however the additon of the Distribution unit or an IR Commander will allow you to contol lots of devices with dedcated IR Emmiters

Hope tha helps you Lolodomo

I think @parkerc answered most of your questions. If not, there is a lot of information about how to connect different IR sensors and transmitters - including those from other manufacturers - on the Keene Electronics website: [url=][/url] under the Infra Red tab.

Regarding the plugins for Kira, as they currently stand the following is possible:

The IR receiver plugin i[/i] can receive codes from any number of Kira modules that are on the same IP subnet as Vera and on the same UDP port. You can also set the IPaddress field in the plugin so it will only accept codes from a single module. You could create multiple KiraRx devices to handle codes from specific Kira modules if you set unique UDP port numbers for each module and plugin.

The IR transmitter plugin i[/i] is associated with a specific Kira module by IPaddress and UDP port. You could create multiple KiraTx devices to service multiple Kira modules. To receive codes for learning, KiraTx searches for a KiraRx device using the same UDP port. If it finds one, it will use it to receive the codes. If it doesn’t find one, it will set up its own UDP socket to its associated Kira module and learn the codes directly.

So, you have a fair amount of flexibility. I don’t think there is any need to have multiple Kira modules in a single room. As @parkerc has explained, you can use IR distribution units to feed multiple emitters and/or blasters. For multiple rooms, there could be justification for having dedicated Kira modules for each. Each module would need its own KiraTx device. It could also have its own KiraRx device if you set unique UDP port numbers.

I have not incorporated any particular mechanism in the plugins to forward IR codes. You could use scenes triggered by a specific code to transmit that - or a different - code through a particular kira module but there would be some latency. There are other solutions for this which may be faster. See Keene Electronics site for Powermid and other IR Extenders.

Thank you for your answers.

Can you confirm than in standalone mode, the Kira sends on its IR output all the IR signals it receives on its IR input ?

Please tell me if this setup is ok:

  • IRSR as IR receiver
  • KLD4010 (10 m cable) between the IR receiver and the Kira
  • Kira
  • 3,5 mm stereo jack between the IR output of the Kira and to the IR input of the IRBKIT
  • IRBKIT as IR distribution amp
  • IRBW or IRDW or IRUW or IRHPW as IR emitters

In this setup, I can use IR remotes or Vera+kira to send IR codes.

Regarding the connection between the Kira and the distribution kit, I probably need the KLDE6M, a stereo jack 3.5mm. My french dealer does not provide this cable. Can a standard jack cable work or is it a real specific cable with standard connectors ?

An alternative would be to have a splitter as input of the distribution kit, with two IR inputs, the IR receiver and the Kira. Is it better ? That would avoid to pass through the Kira for IR codes coming from the remotes. Kira will be used only from the Vera.

Alternative to avoid the long cable ?

  • Powermid extender
  • Powermid transmitter in front of the IR led of the Kira

Of course, I imagine a last alternative would be to use the Kira as the main and unique receiver but it requires an IP access at this location and the Kira box is not really beautiful ;D

Can you confirm than in standalone mode, the Kira sends on its IR output all the IR signals it receives on its IR input ?
No - it does [b]not[/b] do this. A single module will receive IR and send it via UDP and receive UDP and send it via IR. It is not an IR repeater. You can use a pair of modules to achieve this, though.
... the Kira box is not really beautiful
Very true but, if you use an external IR sensor and emitter, it can be invisible. ;D

Sorry but I’m off to work so I cannot answer your other questions right now.

Sadly you cannot use a standard stereo 3.5 jack for this, so it does need to be a specific one. I have a splitter on my distribution unit for the KIRA and a standard IR receiver. Doing it this way, the KIRA can make use of all the emitters running from the distribution unit.