Sanitising IR codes (for new plugin for KIRA)

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
ldobson
Plugin Developer
Posts: 15
Joined: Thu Apr 16, 2009 9:55 am

Sanitising IR codes (for new plugin for KIRA)

Post by ldobson » Fri Apr 17, 2009 10:34 am

I'm working on a plugin for the Keene Electronics "IR Anywhere" - http://www.keene.co.uk/electronics/mult ... code=KIRAM

I've got it to the point where I can transmit and receive IR from the unit, but the incoming IR streams are never the same twice. This obviously makes it difficult to build reliable events based on button presses. An example stream might look like this:

2417 0A87 034B 01F9 0181 01F8 018E 01DC 035B 01C3 0367 039E 01A8 01DD 0190 01DD 019A 01DF 01AA 01DA 019E 01DB 018F 01DF 0198 01F9 018E 0383 01A7 01DE 0369 01C4 01B5 01C4 01A8 039E 0369 039C 018E 01DE 01A9 01DA 035E 01C3 01A8 01FB 2000

The next time this button is pressed there will be the same amount of numbers, but they will be slightly (and sometimes more than slightly) different.

I've started down the road of sanitising this stream by decreasing the number space from 16-bit, rounding and then increasing but this approach could quite easily start clashing button presses from different remotes, and I have no idea what the best number space to use is (if there even is a universally "best" one to use that covers any remote that might be pointed at it). Has anyone else ran into this? Are the irdecode routines already available in EventGhost useful for this problem?

I've used the MCE remote plugin and all incoming events are single 16-bit numbers, does anyone know how it manages this? (I've looked at the plugin code but it seems that the heavy lifting is done by the MS dll)

Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: Sanitising IR codes (for new plugin for KIRA)

Post by Bartman » Fri Apr 17, 2009 2:52 pm

It is quite normal that the incoming data changes as there are toggle bits in the data and it is not that uncommon, that the transmission is faulty on bad lighting conditions.
Maybe the data is compatible with the EG IR decoder. Take a look in the latest beta at the USB-UIRT and UIRT plugin.

User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Sanitising IR codes (for new plugin for KIRA)

Post by Bitmonster » Fri Apr 17, 2009 3:21 pm

It might be advisable to first get some basic knowledge how consumer IR decodings work:
http://www.sbprojects.com/knowledge/ir/ir.htm
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

ldobson
Plugin Developer
Posts: 15
Joined: Thu Apr 16, 2009 9:55 am

Re: Sanitising IR codes (for new plugin for KIRA)

Post by ldobson » Mon Apr 20, 2009 8:45 am

Thanks for that, very interesting. It turns out that the streams are compatible with the EG irdecode routine after a bit of converting, so I've done that and now have a plugin that works both ways. You can get it here if you've got a KIRA - http://www.zedbogey.com/stuff/egkira.zip

I plan to beef it up now to give it actions for all configurable aspects of the unit.

User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Sanitising IR codes (for new plugin for KIRA)

Post by Bitmonster » Mon Apr 20, 2009 3:09 pm

Oh, that was quick.

Very interesting. This device might be a good choice for many users and for an IP device it is quite affordable. But I haven't found any information about delivery costs outside UK.

If you have/get a SourceForge account, you can get SVN access, so you can directly update the plugin in the development trunk.

Have you contacted the manufacturer and informed him, that you made the device usable in EG? Might be very interesting for him.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: Sanitising IR codes (for new plugin for KIRA)

Post by Bartman » Mon Apr 20, 2009 6:19 pm

£ 59.99 (£ 99.99 for a pair) for sending and receiving is really quite affordable.
Does the plugin support multiple devices and the repeater function?

ldobson
Plugin Developer
Posts: 15
Joined: Thu Apr 16, 2009 9:55 am

Re: Sanitising IR codes (for new plugin for KIRA)

Post by ldobson » Mon Apr 20, 2009 6:36 pm

The plugin supports multiload, so you'd just add as many as you've got units - to keep it simple I'm using the UDP port setting as both the client and server, so your units would have to be set to different port numbers but that's not a problem. I don't know what the repeater function is, I thought I'd read all available info!

I have been in contact with a tech guy at Keene, he's been very helpful and they are indeed interested in getting support in apps such as this.

SVN access would be cool, my SourceForge login is "ldobson". Thanks!

Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: Sanitising IR codes (for new plugin for KIRA)

Post by Bartman » Mon Apr 20, 2009 6:42 pm

With repeater function i meant one unit receiving ir and the other sending the exact same code. But with EG in the middle so it canbe scripted.

User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Sanitising IR codes (for new plugin for KIRA)

Post by Bitmonster » Mon Apr 20, 2009 6:51 pm

You can now commit it to:
https://eventghost.svn.sourceforge.net/ ... ugins/KIRA

Looking at the description of the device, I found no reference to possible Wake-On-LAN capabilities. Such a function triggered by an IR code stored in the device would be very cool.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

ldobson
Plugin Developer
Posts: 15
Joined: Thu Apr 16, 2009 9:55 am

Re: Sanitising IR codes (for new plugin for KIRA)

Post by ldobson » Mon Apr 20, 2009 7:20 pm

Bartman wrote:With repeater function i meant one unit receiving ir and the other sending the exact same code. But with EG in the middle so it canbe scripted.
Oh yeah, should be do-able very easily. I've got two units set up as one Receiver and one Target so that I can control my equipment from another room. You'd just tell the Receiver unit to send all the codes to the PC and give it a dummy address for the Target (if you don't want the Target receiving codes from both the Receiver and EG). Then you'd configure the plugin to talk to the Target. Viola, EG is acting as the man in the middle and you can configure it up to do what you like (this is assuming both units are set to the same UDP port, otherwise you'd need two instances of the plugin).

Bitmonster - thanks for the SVN access, I'll probably not put it in until I've rec'd and acted on any feedback from Keene.

ldobson
Plugin Developer
Posts: 15
Joined: Thu Apr 16, 2009 9:55 am

Re: Sanitising IR codes (for new plugin for KIRA)

Post by ldobson » Mon Apr 20, 2009 7:22 pm

Of course, I meant "Voila"

;-)

Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: Sanitising IR codes (for new plugin for KIRA)

Post by Bartman » Mon Apr 20, 2009 7:24 pm

But one device can act as a receiver and a sender simultanisly?
Just curios becauce I am thinking of extending my setup to other rooms.

ldobson
Plugin Developer
Posts: 15
Joined: Thu Apr 16, 2009 9:55 am

Re: Sanitising IR codes (for new plugin for KIRA)

Post by ldobson » Mon Apr 20, 2009 8:21 pm

Yes, you just set it to "standalone" mode, then it sends stuff from its IR receiver to the PC, and it accepts IR streams on its UDP port and punts them at its IR output.

ldobson
Plugin Developer
Posts: 15
Joined: Thu Apr 16, 2009 9:55 am

Re: Sanitising IR codes (for new plugin for KIRA)

Post by ldobson » Tue Apr 21, 2009 9:59 am

btw they'll deliver outside the UK, just use the sales contact mail address to get a price.

ldobson
Plugin Developer
Posts: 15
Joined: Thu Apr 16, 2009 9:55 am

Re: Sanitising IR codes (for new plugin for KIRA)

Post by ldobson » Fri Apr 24, 2009 8:13 am

v1.0.2 now in the SVN repository. Note that using the plugin as a repeater will not work atm due to some sort of socket concurrency issue. Events fire OK, you can transmit IR OK, but it won't do a transmit as a result of an event. I suspect this is because I'm using the server socket to send packets as well as receive them - I'm doing it this way because the KIRA requires the source and destination ports to be the same. I'll work on this over the weekend and hopefully have a fix soon.

Post Reply