This page last changed on Dec 30, 2012 by svalent.

Hello,

I am trying create sensor on base UDP command:

command name: Temperature1
Protocol: UDP
IP: 192.168.1.40
Port: 9090
Command: *S*GET_TEMP1*K*

Sensor is :
Name: SensTemp1
Command: Temperature1
Type: level

after start controller (2.0.1) i receive on my second server 192.168.1.40:9090 UDP packet "*S*GET_TEMP1*K*" ,immediately server
response " $server->send("5");" (i writing socket server in perl. It was easier than java for me...)

everrithing is OK (on android phone in GUI i see on my text label(which have setting Sensor SensTemp1) value 5)

but:
1) controller send UDP packet every one second ...
2) after about 15 .. 30 ping/pong (send UDP packet & receive UDP answer from 192.168.1.40) controller get exception "java.net.SocketTimeoutException: Receive timed out" and stop sending UDP reqeust to 192.168.1.40

My question is :
1) why so often ?? (why not - perhaps once per minute ? Can I setting interval ? (polling interval))
2) of course - it may happen that the 192.168.1.40 responds after longer time (perhaps 50 ms?) or never (if is down) . But can I setting timeout time?
And when controller get timeout - why definitly stops getting sensor value ?

many thanks

(and - Imust add : OpenRemote is very good project ...., but my knowledge is very poor at this time... )

2) parameter timeout is in controller.xml ?:

/**

  • Sets the timeOut
  • @param timeOut the new timeOut
    */
    public void setTimeOut(String timeOut) {
    try
    Unknown macro: { Integer tempValue = Integer.parseInt(timeOut.trim()); if (tempValue > 0)
    Unknown macro: { this.timeOut = tempValue; }
    }

    catch (NumberFormatException e)
    Unknown macro: { logger.error("time out property in controller.xml is not an integer", e); }

    }

and - default is 1 (but 1 Second or 1 milisec ???) :

/** The default timeout used to wait for a result */
public static final int DEFAULT_TIMEOUT = 1;

Posted by svalent at Dec 30, 2012 20:12

There is code but that is only used for the socket timeout and has nothing todo with how often the command is executed itself to retrieve a new value.
UDPSocketCommand is still using the deprecated StatusCommand interface when used for a sensor.
This means it is polling every 500ms by default.

Posted by mredeker at Dec 31, 2012 15:51

thanks....
result for this time for me is = i rewrite code and now using HTTP protocol - everything is OK
(but more traffics for one polling... )

S.

Posted by svalent at Jan 04, 2013 20:13
Document generated by Confluence on Jun 05, 2016 09:32