This page last changed on Dec 13, 2012 by mbarne36.

Hello all.

Following great advice from Marcus over a couple of previous threads, and an Android fix by Richard relating to Virtual Commands, I have a great implementation of UDPListener up and running.

But the obvious limitations of the current implementation of UDPListener is that it can only match a Regex and pass up to the Event Handler (in a Rule) the Timestamp of the match.... no data is passed up.

So with a few ON or OFF UDP commands, it is easily possible to create virtual commands with just a few Regex's to hold status of some switches based on UDP Status, but when I need a Level (i.e. 0-255) it seems that I will need one heck-load of Regex Sensors - one for each level, rather than using a Regex of "Level:*..." which would match against "Level:<000..255>" and pass up the data to be explored in a rule that could look like:

rule "MyUDPListenerRule"
when
    $temp:CustomState(source == "UDPListenerSensor")
then
    System.out.println($temp.getValue());
    execute.command("UDPCommand", $temp.getValue());
end

Thoughts?
thanks in advance.

Hi Martyn,

For whatever reason the current UDPListener implementation is hard coded to push the system time in milliseconds back to the status cache rather than passing any filtered data from the received UDP packet. An approach like that used for the Telnet protocol could be used and matched Regex Group could be passed back.

Rich

Posted by kurrazyman at Dec 13, 2012 22:08

True, for now the UDPListener only pushes the current timestamp into the sensor and not any data received
I am using it like this beauce I just want to have the info that an IR command was received (I use it to detect IR command via IRtrans).
There is certainly room for improvements

@Martyn: Do you know Java? Maybe you can help out

Posted by mredeker at Dec 14, 2012 07:50

Oh no... I think the gauntlet has been laid
there is probably no avoiding it any longer is there? I'm going to have to learn to build and compile.

Yes Marcus... many moons ago I was (for about 15 years) a programmer and Java is not beyond me. Nowadays I spend my time with budgets and appraisals and addressing customer needs and have left the "fun stuff" behind..... but since getting my RPi and becoming a weekend Python programmer my juices have been aroused once again for the soft stuff!

Let me see if I can successfully compile this weekend and then I would be very happy to help out on this, or any other aspect - it's certainly a great project and the community are fantastic here.

There's a "How To" guide for downloading the compiler and tools right?

Posted by mbarne36 at Dec 14, 2012 08:52

The documentation part is still a little behind
You can find some info here: http://www.openremote.org/display/docs/OpenRemote+2.0+Developer+Tutorial

Posted by mredeker at Dec 14, 2012 09:28
Document generated by Confluence on Jun 05, 2016 09:32