Closed GoogleCodeExporter closed 8 years ago
Fixed by https://github.com/openhab/openhab/pull/18
Original comment by kai.openhab
on 1 Oct 2013 at 2:36
Issue 482 has been merged into this issue.
Original comment by kai.openhab
on 5 Oct 2013 at 3:29
Plesse reopen, See Issue 482
Original comment by daniel.g...@gmail.com
on 8 Oct 2013 at 7:52
Could you please have a look, Karel?
Original comment by kai.openhab
on 8 Oct 2013 at 8:46
Issue 482 has been merged into this issue.
Original comment by kai.openhab
on 8 Oct 2013 at 8:46
Jason,
Can you confirm that you tried this with the lateste TCP jar available from
github?
In openhab.cfg you can add tcp:selecttimeout=xyx with xyz an internval in
milliseconds. The default value is the latest version of the binding is 1000,
and means that the binding will do a blocking Select() until a time-out after
1000ms has passed. By tweaking this parameter you can change the
CPU-load/behaviour of the binding, e.g. the frequency by which the binding
polls for socket channels that are ready for communication.
Karel
Original comment by karel.go...@gmail.com
on 8 Oct 2013 at 9:32
May you please give me an hour before I setup,test and confirm this for you...
Original comment by jasonhec...@gmail.com
on 8 Oct 2013 at 9:38
I've tried values for tcp:selecttimeout=xyx of 10, 1000 and 10000. The
javaw.exe process fully utilizes one of my cores.
Original comment by daniel.g...@gmail.com
on 8 Oct 2013 at 10:48
[deleted comment]
I am unable to test right now at work but will later tonight.
My setup is to have OH as TCP Client to Twisted Matrix running TCP Server. On
connection from the OH client Twisted then serves data to the client. In this
case the data is the Rpi CPU Temperature.
My item config is: { tcp="<[192.168.0.201:2100]"} but this doesnt work as it
did with 1.2. As suggested in
https://groups.google.com/forum/#!topic/openhab/qJo_48FDMGA by Karel I then
added the " after the port like this: { tcp="<[192.168.0.201:2100:"]"} but this
doesnt work as well. The binding throws a null pointer exception. Sorry I cant
get to the debug logs right now.
Karel/ OH team: have you considered using an asynchronous networking library? I
use twisted matrix [python lib]which uses callback and takes care of the
blocking code. Someone else asked for a Java equivalent at StackOverflow:
http://stackoverflow.com/questions/675093/twisted-in-java
and leads here: http://www.zynaptic.com/reaction/ with the following:
Reaction is a flexible asynchronous programming framework which may be used to
implement complex event-driven applications. It is heavily influenced by the
Twisted programming framework developed by TwistedMatrix Labs for the Python
programming language.
The focus of the Reaction library is on the concurrency and callback model and
as such it is application neutral. Use it to manage lots of concurrent I/O or
to farm out compute intensive tasks to multicore processors - it's your call.
As well as being usable as a basic Java library, Reaction can also run as an
independent OSGi service and integrate into any GUI framework you choose. Start
digging into the user guide to find out more.
Original comment by jasonhec...@gmail.com
on 8 Oct 2013 at 1:34
Jason, will investigate Twisted asap. Opted for Java NIO as to be as std java
as possible, and at the time I was experimenting with Quartz, so I went for
that combination.
As for your first question, the enable inbound communication, you need to add
tcp:port=xyz to openhab.cfg (that is for the actual 1.4 jar). and you need to
add ' ', not " , for example 'REGEX(.*)' or alike
K
Original comment by karel.go...@gmail.com
on 8 Oct 2013 at 1:47
Hi Karel,
Note that Twisted is a python async networking framework. I understand trying
to be as std as possible but then you have to deal with IO blocking code that
others have already developed solutions/frameworks for.
Is there a way to configure OH to have it be the TCP client but for incoming
data [ie. OH inits the socket connection but the data flow is primary from the
server to the OH client]
Or is the methodology that OH Tcp clients send data and OH TCP Server receive
data? In my view the data direction [send or receive] should be decoupled from
the socket initiating end [client or server].
Thanks and thanks for the help on the two single quotes rather than one double
quote. ;)
J
Original comment by jasonhec...@gmail.com
on 8 Oct 2013 at 2:51
Hi Jason,
the wiki is not in sync anymore with the code in the repo. Pls see
https://groups.google.com/forum/#!searchin/openhab/karel$20goderis$20tcp/openhab
/nvpJ5JXjUag/TVIiG1p49rwJ for a bit of an explanation - it does answer your
question on directions, clients and servers ;-)
the high cpu stuff I need to test myself
K
Original comment by karel.go...@gmail.com
on 8 Oct 2013 at 3:44
Ok - First of all I slap myself on the head for a very stupid bug that causes
the selecttimeout parameter to be parsed incorrectly. That being said, after
correction I can confirm that i has little impact. Putting it to 10000 (10
seconds) did not change a lot because I think at each select Keys get selected
for write operations. I tried tweaking the Quartz set up (thread pool size and
priority) but that did not change anything at all.
I then added a simple Thread.sleep(250) to slow down the Quartz thread and that
did the trick. I will provide an official patch soon (hopefully tonight), I
will first check the timeout that is used in AbstractActiveBinding, or
alternatively, change the core of the TCP binding to be an extension of
AbstractActiveBinding instead of AbstractBinding....
K
Original comment by karel.go...@gmail.com
on 8 Oct 2013 at 4:23
Fixed. (Commit awaiting approval/integration on github)
Original comment by karel.go...@gmail.com
on 8 Oct 2013 at 8:01
Great, thank you!
Am 08.10.2013 22:02 schrieb <openhab@googlecode.com>:
Original comment by daniel.g...@gmail.com
on 8 Oct 2013 at 8:23
Original comment by kai.openhab
on 9 Oct 2013 at 7:33
1.4.0 Tcp binding works great. Thanks for the quick turn around.
Much appreciated. Now I need to get it going on the Rpi.
Original comment by jasonhec...@gmail.com
on 11 Oct 2013 at 10:38
Original issue reported on code.google.com by
jasonhec...@gmail.com
on 29 Sep 2013 at 7:35