One other suggestion if I can - this probably isn't an issue for me (yet), but as I have a number of devices that I'll probably use the tcp binding for (with different ways of working), it might be nice to adjust some of the settings (in openhab,cfg) on a per link basis?Thomas suggested I do this in the OWServer binding, so, in the openhab.cfg file, the interfaces are defined, along with the settings for this interface. Then, in the items file, instead of using the IP address, you use the interface reference. This has 2 advantages - 1) you can specify different settings for each interface, and 2) if you change an IP address, it just changes once in the openhab.cfg file, and not for dozens of files.eg....in openhab.cfg -:tcp:device1.address=192.168.2.21tcp:device1.port=1024tcp:device1.timeout=20000tcp:device1.blocking=falsetcp:device2.address=192.168.2.53tcp:device2.port=1024tcp:device2.timeout=40000tcp:device2.blocking=truein items -:tcp="<[device1:'REGEX(.*?<addr:17,battery:(.*?)>.*)'] >[OFF:device1:<addr:111,cmd,OFF>]""etcFor the way I'm using the binding, this would really be helpful, but I understand that others may be using it very differently (eg using port numbers to differentiate different items) in which case the above may not help (and may be more of a pain?). Anyway, just a thought... Thanks for producing the binding - it's a "difficult" one as I guess the "problem" with a generic TCP binding is everyone uses it slightly differently so it's probably difficult to keep everyone happy :)
Well, Indeed some configuration parameters could be applied to individual links, but if you don't mind I will attempt to do this on a long rainy afternoon somewhere in the future ;-) I first need to complete my building project and make sure the basics are running fine.[Unless someone else feels the urge to have a go at this]
<org.openhab.binding.tcp_1.3.0.201309201244.jar>
--
Hi Karel,
I would like to test your new TCP binding. Where can I download latest version?
Thank you,
Igor
--
Hi,
13:07:51.531 INFO o.o.u.w.i.s.WebAppServlet[:99]- Started Classic UI at /openhab.app13:07:55.328 ERROR org.quartz.core.JobRunShell[:222]- Job AbstractDatagramChannelBinding.2dec4d-Select-1381316875328 threw an unhandled Exception:java.lang.NullPointerException: nullat org.openhab.binding.tcp.AbstractDatagramChannelBinding$SelectorJob.execute(AbstractDatagramChannelBinding.java:1408)at org.quartz.core.JobRunShell.run(JobRunShell.java:213)at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)13:07:55.343 ERROR org.quartz.core.ErrorLogger[:2361]- Job (AbstractDatagramChannelBinding.2dec4d-Select-1381316875328 threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.at org.quartz.core.JobRunShell.run(JobRunShell.java:224)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)Caused by: java.lang.NullPointerException: nullat org.openhab.binding.tcp.AbstractDatagramChannelBinding$SelectorJob.execute(AbstractDatagramChannelBinding.java:1408)at org.quartz.core.JobRunShell.run(JobRunShell.java:213)... 1 common frames omitted13:11:56.968 INFO o.o.i.r.i.RESTApplication[:174]- Stopped REST API13:12:00.968 INFO o.o.u.w.i.s.WebAppServlet[:110]- Stopped Classic UI13:12:00.968 ERROR org.quartz.core.JobRunShell[:222]- Job AbstractSocketChannelBinding.1064e39-Select-1381317120968 threw an unhandled Exception:java.lang.NullPointerException: nullat org.openhab.binding.tcp.AbstractSocketChannelBinding$SelectorJob.execute(AbstractSocketChannelBinding.java:1382)at org.quartz.core.JobRunShell.run(JobRunShell.java:213)at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)13:12:00.968 ERROR o.o.b.t.AbstractSocketChannelBinding[:754]- An exception occurred while creating the Listener Channel on port number 25001 (Address already in use: bind)13:12:00.968 ERROR org.quartz.core.ErrorLogger[:2361]- Job (AbstractSocketChannelBinding.1064e39-Select-1381317120968 threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.at org.quartz.core.JobRunShell.run(JobRunShell.java:224)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)Caused by: java.lang.NullPointerException: nullat org.openhab.binding.tcp.AbstractSocketChannelBinding$SelectorJob.execute(AbstractSocketChannelBinding.java:1382)at org.quartz.core.JobRunShell.run(JobRunShell.java:213)... 1 common frames omitted13:12:00.984 ERROR org.quartz.core.JobRunShell[:222]- Job AbstractDatagramChannelBinding.9b1e83-Select-1381317120968 threw an unhandled Exception:java.lang.NullPointerException: nullat org.openhab.binding.tcp.AbstractDatagramChannelBinding$SelectorJob.execute(AbstractDatagramChannelBinding.java:1408)at org.quartz.core.JobRunShell.run(JobRunShell.java:213)at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)13:12:00.984 ERROR org.quartz.core.ErrorLogger[:2361]- Job (AbstractDatagramChannelBinding.9b1e83-Select-1381317120968 threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.at org.quartz.core.JobRunShell.run(JobRunShell.java:224)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)Caused by: java.lang.NullPointerException: nullat org.openhab.binding.tcp.AbstractDatagramChannelBinding$SelectorJob.execute(AbstractDatagramChannelBinding.java:1408)at org.quartz.core.JobRunShell.run(JobRunShell.java:213)... 1 common frames omitted13:12:00.984 ERROR o.o.b.t.AbstractDatagramChannelBinding[:775]- An exception occurred while creating the Listener Channel on port number 25002 (Address already in use: bind)13:13:36.578 INFO o.o.c.internal.CoreActivator[:92]- openHAB runtime has been started (v1.4.0).
--
Switch Camera_test "Cam" (Camera) { tcp=">[ON:192.168.1.38:8888:'on']" }
results in:
07:36:42.067 ERROR o.o.b.t.AbstractSocketChannelBinding[:964] - there is no channel that services [itemName=Camera_test, command=ON]
also the receiving side is strange:
String Camera_MSG1 "Camera [%s]" (Camera) { tcp="<[192.168.1.38:1025:'']" }
Kai, noticed you populated the Wiki pages on GitHub. Do we continue to edit the code.google.com ones, or we switch as of now?
--
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.
For more options, visit https://groups.google.com/groups/opt_out.
<tcp-binding-trim.patch>
Karel
--
You received this message because you are subscribed to a topic in the Google Groups "openhab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhab/qJo_48FDMGA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openhab+u...@googlegroups.com.
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.
That's what I was looking for, thanks for the clarification.
Regards,
Dario.
From mobile.
21:18:35.748 INFO o.o.m.c.i.ModelRepositoryImpl[:117]- Refreshing model 'jason.items'
21:18:35.753 DEBUG o.o.m.r.i.engine.RuleEngine[:305]- Executing rule 'emonRawRx'
21:18:35.768 DEBUG o.o.m.i.i.GenericItemProvider[:154]- Read items from model 'jason.items'
21:18:35.786 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'House_Vrms' -> '236.909999999999996589394868351519107818603515625'
21:18:35.795 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'House_ct1_realPower' -> '821.3899999999999863575794734060764312744140625'
21:18:35.797 DEBUG o.o.m.r.i.engine.RuleEngine[:305]- Executing rule 'Summary Housect1realPower'
21:18:35.807 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'House_ct2_realPower' -> '190.6200000000000045474735088646411895751953125'
21:18:35.826 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'House_ct3_realPower' -> '688.6000000000000227373675443232059478759765625'
21:18:35.835 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'House_ct4_realPower' -> '-37.9500000000000028421709430404007434844970703125'
21:18:35.838 DEBUG o.o.m.r.i.engine.RuleEngine[:305]- Executing rule 'Summary HouseVrms'
21:18:35.848 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'House_ct5_realPower' -> '-26.089999999999999857891452847979962825775146484375'
21:18:35.863 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'House_ct1_kwh' -> '810.0948694444447255591512657701969146728515625'
21:18:35.873 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'House_ct2_kwh' -> '178.507567850637627770993276499211788177490234375'
21:18:35.883 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'House_ct3_kwh' -> '616.298940277777774099376983940601348876953125'
21:18:35.891 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'House_ct4_kwh' -> '-15.7267099811676107634639265597797930240631103515625'
21:18:35.899 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'House_ct5_kwh' -> '-7.51965204678362653112344560213387012481689453125'
21:18:35.907 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'DailyRamp_ct1_kwh' -> '24093.86881563713905052281916141510009765625'
21:18:35.915 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'Daily_ct1_kwh' -> '16957.13824366825792822055518627166748046875'
21:18:35.922 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'MonthlyRamp_ct1_kwh' -> '227662.43402579266694374382495880126953125'
21:18:35.930 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'Monthly_ct1_kwh' -> '9523.5237080988590605556964874267578125'
21:18:35.938 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:00 PM' for item 'Monthly_kwh_units' -> '-218550.37577784221502952277660369873046875'
21:18:35.946 DEBUG o.o.c.p.i.PersistenceManager[:397]- Restored item state from 'Nov 14, 2013 9:18:01 PM' for item 'geyserOnOff' -> '0'
21:18:35.996 DEBUG o.o.b.t.AbstractSocketChannelBinding[:1303]- Setting up the outbound assigned channel Channel [item=rawEmon, command=3, direction=OUT, remote=/192.168.0.10:2001, buffer=, isBlocking=false, isReconnecting=false, channel=/192.168.0.10:59087::/192.168.0.10:2001, host=192.168.0.10, port=2001]
21:18:36.006 DEBUG o.o.p.r.internal.RRD4jService[:141]- Stored 'House_ct5_realPower' with state '-26.089999999999999857891452847979962825775146484375' in rrd4j database
21:18:36.010 DEBUG o.o.b.t.AbstractSocketChannelBinding[:1303]- Setting up the outbound assigned channel Channel [item=rawMote, command=2, direction=OUT, remote=/192.168.0.120:2110, buffer=, isBlocking=false, isReconnecting=false, channel=/192.168.0.10:59088::/192.168.0.120:2110, host=192.168.0.120, port=2110]
21:18:36.031 TRACE o.o.c.p.i.PersistItemsJob[:76]- Storing item 'House_ct5_realPower' with persistence service 'rrd4j' took 28ms
21:18:36.039 DEBUG o.o.p.r.internal.RRD4jService[:141]- Stored 'House_ct2_realPower' with state '190.6200000000000045474735088646411895751953125' in rrd4j database
21:18:36.045 ERROR o.o.c.s.AbstractActiveService[:195]- Error while executing background thread TCP Refresh Service
java.lang.NullPointerException: null
at java.util.regex.Matcher.getTextLength(Unknown Source)
at java.util.regex.Matcher.reset(Unknown Source)
at java.util.regex.Matcher.<init>(Unknown Source)
at java.util.regex.Pattern.matcher(Unknown Source)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.splitTransformationConfig(TCPBinding.java:236)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.transformResponse(TCPBinding.java:254)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.parseBuffer(TCPBinding.java:162)
at org.openhab.binding.tcp.AbstractSocketChannelBinding.parseChanneledBuffer(AbstractSocketChannelBinding.java:1019)
at org.openhab.binding.tcp.AbstractSocketChannelBinding.execute(AbstractSocketChannelBinding.java:1700)
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:176)
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:193)
21:18:36.091 TRACE o.o.c.p.i.PersistItemsJob[:76]- Storing item 'House_ct2_realPower' with persistence service 'rrd4j' took 53ms
21:18:36.113 DEBUG o.o.p.r.internal.RRD4jService[:141]- Stored 'House_ct4_realPower' with state '-37.9500000000000028421709430404007434844970703125' in rrd4j database
21:18:36.155 TRACE o.o.c.p.i.PersistItemsJob[:76]- Storing item 'House_ct4_realPower' with persistence service 'rrd4j' took 43ms
21:18:36.163 DEBUG o.o.p.r.internal.RRD4jService[:141]- Stored 'House_ct3_realPower' with state '688.6000000000000227373675443232059478759765625' in rrd4j database
21:18:36.210 TRACE o.o.c.p.i.PersistItemsJob[:76]- Storing item 'House_ct3_realPower' with persistence service 'rrd4j' took 48ms
21:18:36.217 DEBUG o.o.p.r.internal.RRD4jService[:141]- Stored 'House_Vrms' with state '238.49' in rrd4j database
21:18:36.247 TRACE o.o.c.p.i.PersistItemsJob[:76]- Storing item 'House_Vrms' with persistence service 'rrd4j' took 31ms
21:18:36.255 DEBUG o.o.p.r.internal.RRD4jService[:141]- Stored 'House_ct1_realPower' with state '882.88' in rrd4j database
21:18:36.311 TRACE o.o.c.p.i.PersistItemsJob[:76]- Storing item 'House_ct1_realPower' with persistence service 'rrd4j' took 57ms
21:18:36.357 ERROR o.o.c.s.AbstractActiveService[:195]- Error while executing background thread TCP Refresh Service
java.lang.NullPointerException: null
at java.util.regex.Matcher.getTextLength(Unknown Source)
at java.util.regex.Matcher.reset(Unknown Source)
at java.util.regex.Matcher.<init>(Unknown Source)
at java.util.regex.Pattern.matcher(Unknown Source)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.splitTransformationConfig(TCPBinding.java:236)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.transformResponse(TCPBinding.java:254)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.parseBuffer(TCPBinding.java:162)
at org.openhab.binding.tcp.AbstractSocketChannelBinding.parseChanneledBuffer(AbstractSocketChannelBinding.java:1019)
at org.openhab.binding.tcp.AbstractSocketChannelBinding.execute(AbstractSocketChannelBinding.java:1700)
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:176)
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:193)
21:18:36.668 ERROR o.o.c.s.AbstractActiveService[:195]- Error while executing background thread TCP Refresh Service
java.lang.NullPointerException: null
at java.util.regex.Matcher.getTextLength(Unknown Source)
at java.util.regex.Matcher.reset(Unknown Source)
at java.util.regex.Matcher.<init>(Unknown Source)
at java.util.regex.Pattern.matcher(Unknown Source)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.splitTransformationConfig(TCPBinding.java:236)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.transformResponse(TCPBinding.java:254)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.parseBuffer(TCPBinding.java:162)
at org.openhab.binding.tcp.AbstractSocketChannelBinding.parseChanneledBuffer(AbstractSocketChannelBinding.java:1019)
at org.openhab.binding.tcp.AbstractSocketChannelBinding.execute(AbstractSocketChannelBinding.java:1700)
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:176)
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:193)
21:18:37.731 ERROR o.o.c.s.AbstractActiveService[:195]- Error while executing background thread TCP Refresh Service
java.lang.NullPointerException: null
at java.util.regex.Matcher.getTextLength(Unknown Source)
at java.util.regex.Matcher.reset(Unknown Source)
at java.util.regex.Matcher.<init>(Unknown Source)
at java.util.regex.Pattern.matcher(Unknown Source)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.splitTransformationConfig(TCPBinding.java:236)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.transformResponse(TCPBinding.java:254)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.parseBuffer(TCPBinding.java:162)
at org.openhab.binding.tcp.AbstractSocketChannelBinding.parseChanneledBuffer(AbstractSocketChannelBinding.java:1019)
at org.openhab.binding.tcp.AbstractSocketChannelBinding.execute(AbstractSocketChannelBinding.java:1700)
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:176)
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:193)
21:18:38.003 DEBUG o.o.p.r.internal.RRD4jService[:141]- Stored 'House_ct5_realPower' with state '-26.089999999999999857891452847979962825775146484375' in rrd4j database
21:18:38.041 ERROR o.o.c.s.AbstractActiveService[:195]- Error while executing background thread TCP Refresh Service
java.lang.NullPointerException: null
at java.util.regex.Matcher.getTextLength(Unknown Source)
at java.util.regex.Matcher.reset(Unknown Source)
at java.util.regex.Matcher.<init>(Unknown Source)
at java.util.regex.Pattern.matcher(Unknown Source)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.splitTransformationConfig(TCPBinding.java:236)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.transformResponse(TCPBinding.java:254)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.parseBuffer(TCPBinding.java:162)
at org.openhab.binding.tcp.AbstractSocketChannelBinding.parseChanneledBuffer(AbstractSocketChannelBinding.java:1019)
at org.openhab.binding.tcp.AbstractSocketChannelBinding.execute(AbstractSocketChannelBinding.java:1700)
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:176)
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:193)
21:18:38.094 TRACE o.o.c.p.i.PersistItemsJob[:76]- Storing item 'House_ct5_realPower' with persistence service 'rrd4j' took 92ms
21:18:38.107 DEBUG o.o.p.r.internal.RRD4jService[:141]- Stored 'House_ct2_realPower' with state '190.6200000000000045474735088646411895751953125' in rrd4j database
21:18:38.191 TRACE o.o.c.p.i.PersistItemsJob[:76]- Storing item 'House_ct2_realPower' with persistence service 'rrd4j' took 85ms
21:18:38.198 DEBUG o.o.p.r.internal.RRD4jService[:141]- Stored 'House_ct4_realPower' with state '-37.9500000000000028421709430404007434844970703125' in rrd4j database
21:18:38.238 TRACE o.o.c.p.i.PersistItemsJob[:76]- Storing item 'House_ct4_realPower' with persistence service 'rrd4j' took 41ms
21:18:38.245 DEBUG o.o.p.r.internal.RRD4jService[:141]- Stored 'House_ct3_realPower' with state '688.6000000000000227373675443232059478759765625' in rrd4j database
21:18:38.266 TRACE o.o.c.p.i.PersistItemsJob[:76]- Storing item 'House_ct3_realPower' with persistence service 'rrd4j' took 22ms
21:18:38.273 DEBUG o.o.p.r.internal.RRD4jService[:141]- Stored 'House_Vrms' with state '238.49' in rrd4j database
21:18:38.325 TRACE o.o.c.p.i.PersistItemsJob[:76]- Storing item 'House_Vrms' with persistence service 'rrd4j' took 53ms
21:18:38.333 DEBUG o.o.p.r.internal.RRD4jService[:141]- Stored 'House_ct1_realPower' with state '882.88' in rrd4j database
21:18:38.352 ERROR o.o.c.s.AbstractActiveService[:195]- Error while executing background thread TCP Refresh Service
java.lang.NullPointerException: null
at java.util.regex.Matcher.getTextLength(Unknown Source)
at java.util.regex.Matcher.reset(Unknown Source)
at java.util.regex.Matcher.<init>(Unknown Source)
at java.util.regex.Pattern.matcher(Unknown Source)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.splitTransformationConfig(TCPBinding.java:236)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.transformResponse(TCPBinding.java:254)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.parseBuffer(TCPBinding.java:162)
at org.openhab.binding.tcp.AbstractSocketChannelBinding.parseChanneledBuffer(AbstractSocketChannelBinding.java:1019)
at org.openhab.binding.tcp.AbstractSocketChannelBinding.execute(AbstractSocketChannelBinding.java:1700)
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:176)
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:193)
21:18:38.378 TRACE o.o.c.p.i.PersistItemsJob[:76]- Storing item 'House_ct1_realPower' with persistence service 'rrd4j' took 46ms
21:18:38.663 ERROR o.o.c.s.AbstractActiveService[:195]- Error while executing background thread TCP Refresh Service
java.lang.NullPointerException: null
at java.util.regex.Matcher.getTextLength(Unknown Source)
at java.util.regex.Matcher.reset(Unknown Source)
at java.util.regex.Matcher.<init>(Unknown Source)
at java.util.regex.Pattern.matcher(Unknown Source)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.splitTransformationConfig(TCPBinding.java:236)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.transformResponse(TCPBinding.java:254)
at org.openhab.binding.tcp.protocol.internal.TCPBinding.parseBuffer(TCPBinding.java:162)
at org.openhab.binding.tcp.AbstractSocketChannelBinding.parseChanneledBuffer(AbstractSocketChannelBinding.java:1019)
at org.openhab.binding.tcp.AbstractSocketChannelBinding.execute(AbstractSocketChannelBinding.java:1700)
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:176)
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:193)
Karel, All,I am afraid I need some clarification:Here is what I am trying to do (in the "grand scheme of things"): Trying to avoid writing an Enocean/TCP binding.In my setup I have to Ethernet/Enocean Gateways (Thermokon STC) that encapsulate the Enocean Protocol into TCP (strangely mapping every byte they receive fromtheir binary version into two characters), so that a telegram (in both directions) has a form of "A55A0B07009B640E000565E80071" with the first four characters being a sync sequence and the lasta checksum. Also, in the last few bytes the actual enocean device is encoded.Now, what I could have tried is to extend the existing enocean binding, to make it communicate through TCP, but the binding is somewhat incomplete (so far it is unidirectional).I have an installation at home that has a number of switches in each room as well as thermostats (with and without controls and with and without humidity sensors). Also,and this is where the serial enocean binding doesn´t help, I have enocean actors for light switching and heating control distributed in a number of places in the house.Ideally, the TCP binding with all of its nice functionality and configurability would form a basis to put another binding on top. As fas as I understand the TCP bindings state is, that it bindsa destination(or source) to an individual item. While this works for many cases, it does not deal with an encapsulated protocol well.So I decided to fiddle around with a number of rules and some pseudo-functions that I wrote as lambda-expressions to see how far I would get with understanding the protocol using the rule system, basically using the idea of triggering a rule on a single item, when data comes in and dispatch it to the actual items from there (this kind of works already, but needs to be cleaned up).For sending data to my gateways I need to encode the destination and the commands in a string add preamble and checksum and send it out to the gateway.Here is where I am stuck. I have created my telegrams (in a rule, one type for on, on type for off) and now want to send it out to the gateway.It might be just a simple thing that I am missing. I would like to send the generated string "as is" to the destination, but get errors of the type:14:07:38.304 WARN o.o.c.i.e.EventPublisherImpl[:80] - given new state is NULL, couldn't post update for 'EnoceanOutgoing'I have tried a few versions of the item definition, using Strings and Switches.Here is what I currently have:
Switch EnoceanOutgoing "Outgoing Gateway" {tcp=">[ON:127.0.0.1:5000:'REGEX((.*))'],>[OFF:127.0.0.1:5000:'REGEX((.*))']"} // receiver nc on localhost started with
"nc -l -i 10 127.0.0.1 5000"
var String teleg = ""
postUpdate(DemoTCP5,"Constructing telegram")
teleg = constructTelegram.apply("000102030405060708090A")
postUpdate(DemoTCP5,"Trying to send "+ teleg) // to debug that telegram is constructed successfully
EnoceanOutgoing.sendCommand(teleg) // causes Error
sendCommand(EnoceanOutgoing,ON)// is received by nc
Here is the output (there are a few debug posts in some Items from the telegram building, pls. ignore14:33:03.083 INFO o.o.m.c.i.ModelRepositoryImpl[:97] - Refreshing model 'demo.rules'
14:35:12.097 INFO runtime.busevents[:22] - Enocean_0005393A received command ON
14:35:12.098 DEBUG o.o.m.r.i.engine.RuleEngine[:285] - Executing rule 'enoOutgoingSwitch'
14:35:12.272 INFO runtime.busevents[:22] - Enocean_00228A61 received command ON
14:35:12.283 INFO runtime.busevents[:26] - DemoTCP5 state updated to Constructing telegram
14:35:12.913 INFO runtime.busevents[:26] - DemoTCP7 state updated to after checksum 000102030405060708090A37
14:35:12.928 INFO runtime.busevents[:26] - DemoTCP5 state updated to Trying to send A55A000102030405060708090A37
14:35:12.933 WARN o.o.c.i.e.EventPublisherImpl[:58] - given command is NULL, couldn't send command to 'EnoceanOutgoing'
14:35:12.940 DEBUG o.o.c.t.i.s.RegExTransformationService[:42] - about to transform 'ON' by the function '(.*)'
14:35:12.940 DEBUG o.o.b.t.p.internal.TCPBinding[:243] - transformed response is 'ON'
14:35:12.941 INFO runtime.busevents[:22] - EnoceanOutgoing received command ON
14:35:12.941 INFO runtime.busevents[:26] - EnoceanOutgoing state updated to ON
14:35:12.964 WARN o.o.c.i.e.EventPublisherImpl[:80] - given new state is NULL, couldn't post update for 'EnoceanOutgoing'
14:35:13.081 DEBUG o.o.b.t.AbstractSocketChannelBinding[:1717] - Picked WriteBufferElement [Channel=Channel [item=EnoceanOutgoing, command=ON, direction=OUT, remote=/127.0.0.1:5000, buffer=, isBlocking=false, isReconnecting=false, channel=/127.0.0.1:63402::/127.0.0.1:5000, host=127.0.0.1, port=5000], buffer=ON, isblocking=false] from the queue
14:35:13.081 DEBUG o.o.b.t.AbstractSocketChannelBinding[:1727] - Sending ON for the outbound channel /127.0.0.1:63402->/127.0.0.1:5000
I tried with various forms in the REGEX ((.*)) and (.*), was also successful in sending aribtrary strings directly encoded in the item definition but now am a bit stuck on how to send a rule generated message to/through an item using the TCP binding. (I would assume that is also something that folks who want to send parametrized messages to other types of receivers).Any pointers in the right direction (or a nice interface to the TCP binding, on which I could plug an adapter for the enocean binding).ThanksClemens
Cant you just use the native TCP binding and then just update a string item with a custom value?
--
You received this message because you are subscribed to a topic in the Google Groups "openhab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhab/qJo_48FDMGA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openhab+u...@googlegroups.com.
How about using the script engine which is designed specificaly for more advanved stuff that cant fit into the rules eng. How you use it though is beyond me hence I have not had any reason to use it yet.
--
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "openhab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhab/qJo_48FDMGA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openhab+u...@googlegroups.com.
is there a guide on how to copy an existing binding and compile it? I've downloaded the full package before and compiled it, but dont know how to compile just a single new binding!
cheers
Dave
Currently I'm trying the new 1.40 snapshots becahue 1.3.1doesn't seem to Support MAP files for TCP binding.But none of the items below - all woking with 1.3.1 - are sending a command to the socket Server:
Switch Sw1 "Schalter1" (Test) {tcp=">[ON:127.0.0.1:8888:'Schalter1 ON'],>[OFF:127.0.01:8888:'Schalter1 OFF']"}
Rollershutter Rol1 "Rolladen1" (Test) {tcp=">[UP:127.0.0.1:8888:'Roll1 UP'],>[DOWN:127.0.01:8888:'Roll1 DOWN'],>[STOP:127.0.01:8888:'Roll1 STOP']"}
Dimmer Dim1 "Dimmer1" (Test) {tcp=">[0:127.0.0.1:8888:'Dimmer1 %d']"}
What could be wrong with my setup? Again: my configuration is working with 1.3.1
Is there a good documantation or a good example on how to implement a new binding? Which actual binding is aa good example for a new binding?
14:50:23.096 DEBUG o.o.i.r.i.r.ItemResource[:196] - Received HTTP POST request at 'items/Dim1' with value '40'.
14:50:23.096 INFO runtime.busevents[:22] - Dim1 received command 40
14:50:23.440 DEBUG o.o.i.r.i.b.GeneralBroadcaster[:41] - broadcaster 'org.openhab.io.rest.internal.broadcaster.GeneralBroadcaster$1@a6508ca' is empty
What is the correct item definition for a dimmer?
logger.info("Received {} from the remote end {}",new String(result.array()),sChannel.toString());
String transformedResponse = transformResponse(provider.getProtocolCommand(itemName, command),new String(result.array()));
String sResult = new String(result.array()).split("\0")[0];
logger.info("Received {} from the remote end {}",sResult,sChannel.toString());
String transformedResponse = transformResponse(provider.getProtocolCommand(itemName, command),sResult);
The same Problem in parseBuffer. My changed code is:
String theUpdate = new String(byteBuffer.array()).split("\0")[0];
Maybe split is not the best way to cut the string at the first null character... But I have really no experience with Java programming and this is a way it worked.
Another Option would be to use the trim() function:
String theUpdate = new String(byteBuffer.array()).trim();
which would also trim all white spaces, but I don't know if this is wanted.
For now I could do a setup for all my switches with a seperate MAP-file for each switch to have unique commands ( I need to identify the switch at my socket Server), but for about 100 Switches this would be very anoying.
Is there a Transformation function which could just add some text (e.g. the name of the item) in front or behind the command?
For example, when switching Switch SW1 to on, I need to send "SW1ON", "SW1_ON", "SW1 ON" or something similar to my socket server.
Also: if a string is not found in a MAP-file, why is an empty string returned by the Transformation and not the input string? I think this would be better...
Thanks again for your help and your work.
I think the best would be if we could do some simple string operations within the transformation section.
I tried to use JavaScript but within the Javascript there is no item information available. Also no ingi about the function etc. But it should be not a lot of work to add it to the transformation function.
Another possibility would be to add something like a String transformation with simple string operations (Add, Insert, Delete, Left, Right, Mid, Pos, Len, Replace, Upper, Lower...) which could be used recursively. But for that we should also habe some placeholders for e.g. function, item name etc.
If we would have one oft that ( the adding oft item and function information to JavaScript should be easy and is more flexible) the TCP binding (and also other bindings) could be used in a very flexible and universal way.
--
You received this message because you are subscribed to a topic in the Google Groups "openhab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhab/qJo_48FDMGA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openhab+u...@googlegroups.com.
All,
I have spent the last few days rewriting the TCP and UDP bindings and things are advancing well. Both bindings now are truly TCP/UDP clients and servers, thus allowing incoming connections from remote ends, with "allowed" hosts defined in the Item definitions. Also, there is a mechanism built in (that can be configured) to share network connections between Commands in an Item (ex: Switch DemoSwitch "Switch" <heating> { tcp=">[ON:127.0.0.1:3336:'on_cmd'], >[OFF:127.0.01:3336:'off_cmd']"} would run over 1 single TCP connection), whereas by default a connection would set up for each individual Command. Also, it is possible to share connections between Items (ex: Switch DemoSwitch "Switch" <heating> { tcp=">[ON:127.0.0.1:3336:'on_cmd'], >[OFF:127.0.01:3336:'off_cmd']"}
Switch DemoSwitch2 "Switch2" <heating> { tcp=">[ON:127.0.0.1:3336:'on_cmd'], >[OFF:127.0.0.1:3336:'off_cmd']"}) -> 1 TCP connection) as well as between Directions (e.g. if an outbound connection to a given host:port is established, and the binding would be listening for an incoming connection coming from the same host:port, then that "listening" item will equally piggy-backing on the outbound connection). Furthermore, in the event of network failures, data send to remote devices can (configurable) be queued and sent later on when the network connection is restored. One will be able to define pre-amble and post-ambles to be attached bits of data that are sent over. For unstable remote devices, for which from time to time a connection needs to be reset it is now possible to define a cron job to do these resets. Maximum buffer sizes can be chosen and so forth.
All that being said, for those will live installations (e.g. Arduino boards etc), do you have any other particular requirements that should be covered in the "base" binding? Things that are specific to your setup or where the type of device can influence the behaviour of the TCP/UDP binding?
Thanks
K
--
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.