Kira IR Receiver and Transmitter Plugins

Here is the code with the internal IR receiver: K 2402 2220 08B4 01D6 2000 while here is the code when using the external IR receiver: K 2322 2267 1116 0224 021F 0241 0217 0225 023C 0225 0225 0242 0217 0225 023C 0225 0225 0242 0217 0225 0675 0242 066B 0223 0670 0224 0675 0242 0217 0225 0675 0242 0662 0225 0675 0225 0237 0224 0225 0242 021F 0224 0237 0225 0675 0225 0237 0224 021F 0241 021F 0224 0670 0242 0670 0224 0668 0226 0675 0242 0217 0225 0675 0242 0670 0224 0668 0225 2000
These are obviously totally different codes. My plugins do not care whether you use internal or external IR receivers. They just get UDP packets from KIRA.

Two possibilities occur to me: Some remote buttons output different codes for long or short button presses. If you want both codes you will need to learn them separately. Also I noticed significant variation in codes transmitted from near or far distances - although not so significant to explain the difference in two burst pairs to thirty-four burst-pairs…

When I push learn in the Rx or Tx plugin, I see "Waiting for code..." and then nothing.
Set [b]Debug[/b] in the [i]Advanced[/i] tab to [b]1[/b] and [i]Save/Relaod[/i]. Try the learn operation again and post the log covering the period from when you click [b]Learn[/b] to about 35 seconds later when you should get a timeout message. If you don't get a timeout message there will be an error in the log.

[quote=“RexBeckett, post:39, topic:175170”]

The code displayed in the KiraRx and KiraTx plugins have not the same format, maybe you could display the two formats, the original Kira format and your format ?

What would be the advantage in that?

KiraTx learns, imports, displays and transmits native KIRA code format. KiraRx learns and imports native Kira format but saves the codes in a compressed form for faster and more reliable recognition. If it is too difficult to learn the codes twice, learn them with KiraTx and then copy them from the display and paste/import them into KiraRx. What additional functionality would help?[/quote]

There was just a misunderstanding on my side after reading this topic because I thought that the two plugins were sharing the same codes. But with your new explanation about your compressed format, I understand that this format is not usable for transmitting but better for recognition.
I can learn twice (or copy/paste like you explain), no problem.

[quote=“RexBeckett, post:39, topic:175170”]

If the name field is not empty, the code is not sent.

It shouldn’t make any difference what is in the Name field. It works OK on my system. Does it show Code sent? Does the red light flash on KIRA?[/quote]

Yes and yes. But it is not systematic…
I need to make more tests, with and without the amp kit. My current feeling is that the transmitting is just not reliable with my current installation.
Will do more tests … after sleeping.

[quote=“RexBeckett, post:42, topic:175170”]

When I push learn in the Rx or Tx plugin, I see “Waiting for code…” and then nothing.

Set Debug in the Advanced tab to 1 and Save/Relaod. Try the learn operation again and post the log covering the period from when you click Learn to about 35 seconds later when you should get a timeout message. If you don’t get a timeout message there will be an error in the log.[/quote]

Will do that after a night. It is now very very late in France.

It is now very very late in France.
and only an hour earlier in the UK... ? bient?t ;D

[quote=“RexBeckett, post:46, topic:175170”]

It is now very very late in France.

and only an hour earlier in the UK… ? bient?t ;D[/quote]

We are crazy ;D

After a rest, that’s largely better :slight_smile:

Sorry for the wrong information regarding the external IR input, it is finally working, I just forgot to change the computer IP address and set it again to the Vera IP. As I was doing tests with the PC and the Vera, I have done a lot of switchs between the 2 IP.

Regarding the IR code transmitting, I learned again my 3 test codes and now the transmitting is perfectly reliable. 8)

I have now played with these buttons of the plugin: First, Next, Find, Delete, Learn, Save, Test. And no problem.

Everything is working for me, very good job. 8)

The only little thing: Sent display is not updated, I always have the text “Test…”. Test is I think the name of the first code I created with the plugin. My three codes are now named Red, Blue and Green.

The interface is not very fast, there are delays for example between the time you push the Learn button and the time the label is updated to “waiting for code” or even to display the captured code. But not a real problem, the important is that it works well.

I can now confirm that the double connections between the Kira and the amp kit that I described before is working well.

I now tried to send IR codes through a scene and I got this error:

08 05/18/13 11:34:24.379 JobHandler_LuaUPnP::HandleActionRequest device: 0 service: urn:micasaverde-com:serviceId:HomeAutomationGateway1 action: RunScene <0x2ee88680> 08 05/18/13 11:34:24.379 JobHandler_LuaUPnP::HandleActionRequest argument SceneNum=21 <0x2ee88680> 08 05/18/13 11:34:24.379 Scene::RunScene running 21 test sonos <0x2ee88680> 08 05/18/13 11:34:24.380 JobHandler_LuaUPnP::HandleActionRequest device: 426 service: urn:dcineco-com:serviceId:KiraTx1 action: SendIRCode <0x2ee88680> 08 05/18/13 11:34:24.380 JobHandler_LuaUPnP::HandleActionRequest argument IRCodeName=Red <0x2ee88680> 50 05/18/13 11:34:24.381 luup_log:426: KiraTx: Sending code name: Red <0x2ee88680> 01 05/18/13 11:34:24.381 LuaInterface::CallFunction_Job device 426 function SKiraTx_KiraTx1_SendIRCode_run failed [string "..."]:197: attempt to call global 'sendcode' (a nil value) <0x2ee88680>

My scene is just few calls to the action SendIRCode at different delays; I built it just using the scene advanced tab.

The bug can be fixed easily just inersing the order of your functions sendIRcode and sendcode.
With this fix, my scene is working well.

Very strange. It used to work but now I had to change one of the functions from local to global. Odd things happen in implementation files. I must have changed something else that broke it. Anyway, it now works again. Download from: KiraTx. You just need to upload the new I_KiraTx.xml.

I’m glad it is mostly working now. Thanks for being the alpha-tester. :slight_smile:

The only little thing: Sent display is not updated, I always have the text "Test...".
It will always show [i]Test...[/i] when you click the [b]Test[/b] button. The proper code name will be displayed when you fire it through the [b]SendIRCode[/b] action.
The interface is not very fast, there are delays for example between the time you push the Learn button and the time the label is updated to "waiting for code" or even to display the captured code.
Yes - it's annoying but unfortunately down to how fast MiOS updates the display when the state-variables are changed. It would probably require a change to JS instead of Flash for the control tab to fix it. I have been trying to use the simple, built-in method but it is limited in capabilities and performance.

[quote=“lolodomo, post:49, topic:175170”]The bug can be fixed easily just inersing the order of your functions sendIRcode and sendcode.
With this fix, my scene is working well.[/quote]

OK, thanks for that. I wonder why it used to work…

I’ve rearranged the two functions and uploaded the change to Google.

[quote=“RexBeckett, post:50, topic:175170”]

The only little thing: Sent display is not updated, I always have the text “Test…”.

It will always show Test… when you click the Test button. The proper code name will be displayed when you fire it through the SendIRCode action.[/quote]

That’s ok, I see the changes now with scene.

When a function is local, it has to be declared first before to be used.

I must have changed the functions to local whilst tidying up the code and omitted to upload it to my own system for testing. ::slight_smile:

I was thinking about something this morning: what not having a unique plugin ? It will be more easier for users and it will avoid the double learn of IR codes. The two plugins have a lot in common. If I am right, the only point is that you will have to store the two formats in your “database”:

  • the original Kira format to be used for the transmitting
  • your compressed format to be used for the receiving

Hi @lolodomo, thanks for the feedback.

I’m sure it would be possible to integrate the transmit and receive functions into one plugin. As you say, a lot of the code is similar. I created KiraRx because I wanted the IR receive functionality and it didn’t seem to exist. I added KiraTx following a request from @parkerc although there are several other solutions available for sending IR from Vera. I still think of them as separate functions - that happen to use the same type of hardware as an interface.

There are a couple of things to resolve before the two plugins could be merged:

KiraRx is designed to work with multiple KIRA units that share a common port. KiraTx is written to control a single KIRA module. It will be interesting to decide how to handle support for multiple modules. I foresee the need for a list of IP addresses and ports… It will probably also need named zones to identify codes received or sent with a particular KIRA module.

There is a time impact of looking-up received codes in a large list. I would expect the list in a combined plugin to get much larger (there are probably more codes to transmit than need to be recognised). Would it be necessary to flag codes that should be recognised to limit the size of the look-up list?

I doubt that the simple, built-in flash would support the extra display fields in a timely manner. A shift to VS is probably essential.

I shall give this further thought. Meanwhile, I shall be interested to see if anybody other than you uses KiraTx. :slight_smile:

@lolodomo,

Another approach would be to keep the plugins separate but have a shared database of IR codes. I would still want to flag codes that could be used for recognition in KiraRx to keep the look-up list as small as possible. This would allow you to learn and name codes just once from any KiraRx or KiraTx plugin and have them available for all other instances. Would this meet your desires?

[quote=“RexBeckett, post:57, topic:175170”]@lolodomo,

Another approach would be to keep the plugins separate but have a shared database of IR codes. I would still want to flag codes that could be used for recognition in KiraRx to keep the look-up list as small as possible. This would allow you to learn and name codes just once from any KiraRx or KiraTx plugin and have them available for all other instances. Would this meet your desires?[/quote]

Yes, that would be a big enhancement.

[quote=“RexBeckett, post:56, topic:175170”]There are a couple of things to resolve before the two plugins could be merged:

KiraRx is designed to work with multiple KIRA units that share a common port. KiraTx is written to control a single KIRA module. It will be interesting to decide how to handle support for multiple modules. I foresee the need for a list of IP addresses and ports… It will probably also need named zones to identify codes received or sent with a particular KIRA module.[/quote]

Several cases:

  • Case 1: you have only one Kira and want to get receiving and transmitting capabilities: you create a device and set the IP of the Kira
  • Case 2: you have several Kira and want to get receiving and transmitting capabilities: you create one device per Kira and set the IP of the Kira for each device
  • Case 3: you have one or several Kira and want to get receiving capability only: you create inly one device and don’t care about the IP
There is a time impact of looking-up received codes in a large list. I would expect the list in a combined plugin to get much larger (there are probably more codes to transmit than need to be recognised). Would it be necessary to flag codes that should be recognised to limit the size of the look-up list?

Why not…

I doubt that the simple, built-in flash would support the extra display fields in a timely manner. A shift to VS is probably essential.

That should be doable. The window can have a scrollbar if really necessary.

I am now with the final installation and the transmission (using the Test button) is sometimes working but most of time not working.
I have to investiguate to determine if it is a bug in the plugin or a problem in my installation.