TCP Binding status polling

Hi,

I’m really new to openHAB (first day) and I have a question on how to setup my specific scenario.
My house was built with a “pre domotica” option. It simply means that I have a relais and dimmer module attached to my lights.
The system is using UDP commands to turn lights on and off with a fairly easy protocol.
I already managed to turn a light on and off trought the web interface.

main.items

{udp=">[ON:10.10.1.30:1001:'MAP(my.garage.map)'] >[OFF:10.10.1.30:1001:'MAP(my.garage.map)']"}

my.garage.map

ON=S0400
OFF=C0400

Basically I have to send SXX00 to turn on a light and CXX00 to turn it off again. 04 is the ID for the light in my garage.
(if you have a better suggestion to do this, please feel free to comment)

Now I would also like to see the status of my lights since I can still use my normal light switches.
The way the module works is that I have to send a IXX00 to get the current status of a light.
But I can’t see how I would configure this in openHAB. Can somebody point me in the right direction?

Thanks
Tim

You might be able to write a cron-based rule that sends IX00 at some frequency through an item dedicated to that purpose, and then add “in” binding sections to your switch items that read and map the responses to update their states. That depends on what the query/response dialogue is.

Thanks for the quick response. The response I get is I000XXYY01. Where XX is the ID of the output and YY is the status (00 or 01)
Could you give a sample of how the “in” binding section could look like? As I said, I’m a real beginner and I’m already happy that I can turn a light on and off. :slight_smile:

OK, one approach would be to dedicate a String item to send status requests using a cron-based rule, and another rule to trigger on “received update”, and use the logic in that rule to update the switch items’ states. I am on mobile so can’t easily give concrete examples at the moment. The String item would be bound to > and < directions. Ping later if this is too much to follow and I will try to make it more concrete when at the keyboard.

Interested in following this…I have a Vantage system which uses similar TCP serial commands. I have OH working and have the Hue Emulation acting as a bridge to the Echo.

I find the states out of whack on a frequent basis due to regular button pushes and would love to be able to keep the current state update in OH.

Please post your solution.

Thanks,

Squid

This is only a theory. There might be some obstacle I can’t see without trying it. It would definitely need refinements even if it worked. Your use case is very near the territory where a proper binding might be the only solution.

openhab.cfg:

udp:updatewithresponse=true
udp:blocking=true

your.items:

Switch Light4 "Light4" { udp=">[ON:10.10.1.30:1001:S0400], >[OFF:10.10.1.30:1001:C0400]", autoupdate="false" }
String Light4Query "Light4Query [%s]" { udp=">[*:10.10.1.30:1001:default]", autoupdate="false" }

your.rules:

rule "Query Light 4"
when
  Time cron "0/30 * * * * ?"
then
  Light4Query.sendCommand("I400")
end

rule "Update Light 4"
when
  Item Light4Query received update
then
  switch Light4Query.state.toString {
    case "I0000400": Light4.postUpdate(OFF)
    case "I0000401": Light4.postUpdate(ON)
  }
end

Thanks alot! I got it to work with some small changes.

my.items

String Light4Query "Light4Query [%s]" { udp=">[10.10.1.30:1001:default]", autoupdate="false" }

my.rules

rule "Query Light 4"
when
  Time cron "0/30 * * * * ?"
then
  Light4Query.sendCommand("I0400")
end

rule "Update Light 4"
when
  Item Light4Query received update
then
  switch Light4Query.state.toString.substring(6,8) {
    case "00": Light_GF_Garage_Ceiling.postUpdate(OFF)
    case "01": Light_GF_Garage_Ceiling.postUpdate(ON)
  }
end

Could I put the update off all my lights in the same 2 rules? Or would it be best to separate it per light?
I really appreciate the help :smiley:

Glad you got it working!

The cron-based rule sends the string down the socket and updates the state of the same String item with the response, and it might cause problems to send multiple queries down the socket in quick succession. But experimentation would likely give an answer about that possible concern. Otherwise, having a pair of rules per “query” String item would probably work reliably. Again – not sure how your remote device will cope with multiple queries in quick succession.

I would like to hear what you settle on, as it would probably be helpful to others with similar devices.

Following along here for my situation…

My switches look like this

Switch Bar "Bar" [ "Switchable" ] {tcp=">[ON:10.5.1.6:3040:'MAP(bar.map)'],>[OFF:10.5.1.6:3040:'MAP(bar.map)']"}

With the map file contents:

ON=VSW!1 120 3 6\r
OFF=VSW!1 120 3 6\r

I can query the Vantage System for status by sending:

VGS@ 120 3\r

And the response I can get back is one of three options:

0=OFF
1=ON
2=NOT PROGRAMMED

Do all I need to to is change TCP for UDP and update the sendCommand and case statements to the specifics I outlined above?

I also noticed in the example above the switch changed to include the command after the IP address and colon:

Why do you have DEFAULT after the IP address in the STRING?

Thanks,

Squid

A second question. :slight_smile: I need to send similar commands for my dimmers. How would I tackle that?

The word default was added to the 1.9.0-SNAPSHOT TCP binding and means, send the string command through without any changes. (See the pull request where the binding was improved.) Paolo also updated the wiki page. If you are using an older TCP binding (like you are running openHAB 1.8 for example), you can replace your older JAR with this one.

I don’t know how your dimmers are supposed to work. Do you mean that you want to query their state in a way similar to the on/off switches?

Ok, I’m stuck and hoping you can assist.

This is in my item file:

Switch Living_Room "Living Room" [ "Switchable" ] {tcp=">[ON:10.5.1.6:3040:'MAP(lv_room.map)'],>[OFF:10.5.1.6:3040:'MAP(lv_room.map)']"}
String LRQuery "LRQuery [%s]" { tcp=">[10.5.1.6:3040:default]", autoupdate="false" }

This is my MAP or Transform file"

ON=VSW!1 97 2 6\r
OFF=VSW!1 97 2 6\r

This is my rules file:

rule "Query LivingRoom"
when
  Time cron "0/30 * * * * ?"
then
  LRQuery.sendCommand("VGS@1 97 2")
end

rule "Update LR"
when
  Item LRQuery received update
then
  switch LRQuery.state.toString {
    case "0": Living_Room.postUpdate(OFF)
    case "1": Living_Room.postUpdate(ON)
  }
end

I see no update of the switch state, yet I see the proper response coming back in the OH.log file which I’ve attached below. I see that it’s looking in all my transform files to match the response from the lighting system…why is it not getting matched to the case statement in the rule? I’m using OH2.

I think I am real close, can one of you experienced geniuses guide me a bit?


This is the output of my openhab.log file

2016-11-28 20:43:14.835 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - The channel for /10.5.1.6:3040 is now connected
2016-11-28 20:43:30.578 [ERROR] [ing.tcp.protocol.internal.TCPBinding] - transformation throws exception [transformation=default, response=VGS@1 97 2]
java.lang.IllegalArgumentException: given transformation function 'default' does not follow the expected pattern '<function>(<pattern>)'
	at org.openhab.binding.tcp.protocol.internal.TCPBinding.splitTransformationConfig(TCPBinding.java:250)[191:org.openhab.binding.tcp:1.9.0.b4]
	at org.openhab.binding.tcp.protocol.internal.TCPBinding.transformResponse(TCPBinding.java:266)[191:org.openhab.binding.tcp:1.9.0.b4]
	at org.openhab.binding.tcp.protocol.internal.TCPBinding.internalReceiveChanneledCommand(TCPBinding.java:73)[191:org.openhab.binding.tcp:1.9.0.b4]
	at org.openhab.binding.tcp.AbstractSocketChannelBinding.internalReceiveCommand(AbstractSocketChannelBinding.java:917)[191:org.openhab.binding.tcp:1.9.0.b4]
	at org.openhab.core.binding.AbstractBinding.receiveCommand(AbstractBinding.java:97)[192:org.openhab.core.compat1x:2.0.0.b4]
	at org.openhab.core.events.AbstractEventSubscriber.handleEvent(AbstractEventSubscriber.java:42)[192:org.openhab.core.compat1x:2.0.0.b4]
	at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:415)[3:org.apache.karaf.services.eventadmin:4.0.4]
	at org.apache.felix.eventadmin.impl.tasks.HandlerTask.run(HandlerTask.java:90)[3:org.apache.karaf.services.eventadmin:4.0.4]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)[:1.8.0_111]
	at java.util.concurrent.FutureTask.run(Unknown Source)[:1.8.0_111]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)[:1.8.0_111]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)[:1.8.0_111]
	at java.lang.Thread.run(Unknown Source)[:1.8.0_111]
2016-11-28 20:43:30.869 [ERROR] [ing.tcp.protocol.internal.TCPBinding] - transformation throws exception [transformation=default, response=1
]
java.lang.IllegalArgumentException: given transformation function 'default' does not follow the expected pattern '<function>(<pattern>)'
	at org.openhab.binding.tcp.protocol.internal.TCPBinding.splitTransformationConfig(TCPBinding.java:250)[191:org.openhab.binding.tcp:1.9.0.b4]
	at org.openhab.binding.tcp.protocol.internal.TCPBinding.transformResponse(TCPBinding.java:266)[191:org.openhab.binding.tcp:1.9.0.b4]
	at org.openhab.binding.tcp.protocol.internal.TCPBinding.parseBuffer(TCPBinding.java:157)[191:org.openhab.binding.tcp:1.9.0.b4]
	at org.openhab.binding.tcp.AbstractSocketChannelBinding.parseChanneledBuffer(AbstractSocketChannelBinding.java:1030)[191:org.openhab.binding.tcp:1.9.0.b4]
	at org.openhab.binding.tcp.AbstractSocketChannelBinding.execute(AbstractSocketChannelBinding.java:1766)[191:org.openhab.binding.tcp:1.9.0.b4]
	at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:157)[192:org.openhab.core.compat1x:2.0.0.b4]
	at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173)[192:org.openhab.core.compat1x:2.0.0.b4]
2016-11-28 20:43:30.869 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'bar.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.869 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command OFF on item Bar  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'bar.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command ON on item Bar  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'kitchen.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command OFF on item Kitchen  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'kitchen.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command ON on item Kitchen  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'dn_room.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command OFF on item Dining_Room  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'dn_room.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command ON on item Dining_Room  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'stairs.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command OFF on item Stairs  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'stairs.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command ON on item Stairs  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'k_bar.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command OFF on item Kitchen_Bar  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'k_bar.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command ON on item Kitchen_Bar  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'lv_room.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command OFF on item Living_Room  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'lv_room.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command ON on item Living_Room  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file '90.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command OFF on item Hallway1  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file '90.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command ON on item Hallway1  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'cfan.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command OFF on item Ceiling_Fan  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'cfan.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command ON on item Ceiling_Fan  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'off.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command OFF on item All_Off  
2016-11-28 20:43:30.885 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '1
' with the file 'off.map' : Target value not found in map for '1
'
2016-11-28 20:43:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input 1
 to match command ON on item All_Off  
  1. It looks like you might be using an older version of the TCP binding than the one that supports the default keyword.
  2. Your TCP messages might be including a CR or LF character at the end (not how in the log the messages are split onto an extra line), so it’s not matching the transformation file contents. Have a look at changing the binding’s postamble to be the line delimiter to use with this device (wiki)

In looking at PaperUI it states that my TCP binding is 1.9b4.

what version do I need to be running, and would I just put this in the add on folder?

Thanks,

Squid

I recommend pulling the latest build version from here if you don’t want to update your entire OH2 distro. Uninstall your existing TCP binding and put the new JAR in your addons folder. At the openhab> prompt, make sure you’re using the intended version using bundle:list.

Changing out the TCP binding introduced all kinds of errors in the log file…any thoughts?

2016-11-29 00:17:33.691 [WARN ] [eclipse.jetty.servlet.ServletHandler] - 
javax.servlet.ServletException: java.lang.IllegalStateException: Request scope has been already shut down.
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76)[11:com.eclipsesource.jaxrs.publisher:5.3.1.201602281253]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)[79:org.eclipse.jetty.servlet:9.2.14.v20151106]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)[79:org.eclipse.jetty.servlet:9.2.14.v20151106]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:70)[165:org.ops4j.pax.web.pax-web-jetty:4.2.4]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)[77:org.eclipse.jetty.security:9.2.14.v20151106]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:271)[165:org.ops4j.pax.web.pax-web-jetty:4.2.4]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)[79:org.eclipse.jetty.servlet:9.2.14.v20151106]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)[165:org.ops4j.pax.web.pax-web-jetty:4.2.4]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.Server.handle(Server.java:499)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)[70:org.eclipse.jetty.io:9.2.14.v20151106]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[81:org.eclipse.jetty.util:9.2.14.v20151106]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[81:org.eclipse.jetty.util:9.2.14.v20151106]
	at java.lang.Thread.run(Unknown Source)[:1.8.0_111]
Caused by: java.lang.IllegalStateException: Request scope has been already shut down.
	at jersey.repackaged.com.google.common.base.Preconditions.checkState(Preconditions.java:173)[147:org.glassfish.jersey.bundles.repackaged.jersey-guava:2.22.2]
	at org.glassfish.jersey.process.internal.RequestScope.retrieveCurrent(RequestScope.java:239)[151:org.glassfish.jersey.core.jersey-common:2.22.2]
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:314)[151:org.glassfish.jersey.core.jersey-common:2.22.2]
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)[152:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)[152:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	... 26 more
2016-11-29 00:17:35.251 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'lights.items'
2016-11-29 00:17:35.360 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'pool.items'
2016-11-29 00:17:36.250 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'LR.rules'
2016-11-29 00:17:36.343 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'hallway.rules'
2016-11-29 00:17:36.796 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'sid.sitemap'
2016-11-29 00:17:37.622 [WARN ] [eclipse.jetty.servlet.ServletHandler] - 
javax.servlet.ServletException: A MultiException has 1 exceptions.  They are:
1. java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_2,3,241377814) has been shut down

	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76)[11:com.eclipsesource.jaxrs.publisher:5.3.1.201602281253]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)[79:org.eclipse.jetty.servlet:9.2.14.v20151106]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)[79:org.eclipse.jetty.servlet:9.2.14.v20151106]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:70)[165:org.ops4j.pax.web.pax-web-jetty:4.2.4]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)[77:org.eclipse.jetty.security:9.2.14.v20151106]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:271)[165:org.ops4j.pax.web.pax-web-jetty:4.2.4]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)[79:org.eclipse.jetty.servlet:9.2.14.v20151106]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)[165:org.ops4j.pax.web.pax-web-jetty:4.2.4]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.Server.handle(Server.java:499)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)[70:org.eclipse.jetty.io:9.2.14.v20151106]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[81:org.eclipse.jetty.util:9.2.14.v20151106]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[81:org.eclipse.jetty.util:9.2.14.v20151106]
	at java.lang.Thread.run(Unknown Source)[:1.8.0_111]
Caused by: A MultiException has 1 exceptions.  They are:
1. java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_2,3,241377814) has been shut down

	at org.jvnet.hk2.internal.FactoryCreator.getFactoryHandle(FactoryCreator.java:106)[144:org.glassfish.hk2.locator:2.4.0.b34]
	at org.jvnet.hk2.internal.FactoryCreator.dispose(FactoryCreator.java:173)[144:org.glassfish.hk2.locator:2.4.0.b34]
	at org.jvnet.hk2.internal.SystemDescriptor.dispose(SystemDescriptor.java:526)[144:org.glassfish.hk2.locator:2.4.0.b34]
	at org.glassfish.jersey.process.internal.RequestScope$Instance.remove(RequestScope.java:532)[151:org.glassfish.jersey.core.jersey-common:2.22.2]
	at org.glassfish.jersey.process.internal.RequestScope$Instance.release(RequestScope.java:549)[151:org.glassfish.jersey.core.jersey-common:2.22.2]
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:319)[151:org.glassfish.jersey.core.jersey-common:2.22.2]
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)[152:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)[152:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	... 26 more
Caused by: java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_2,3,241377814) has been shut down
	at org.jvnet.hk2.internal.ServiceLocatorImpl.checkState(ServiceLocatorImpl.java:2288)[144:org.glassfish.hk2.locator:2.4.0.b34]
	at org.jvnet.hk2.internal.ServiceLocatorImpl.getServiceHandleImpl(ServiceLocatorImpl.java:629)[144:org.glassfish.hk2.locator:2.4.0.b34]
	at org.jvnet.hk2.internal.ServiceLocatorImpl.getServiceHandle(ServiceLocatorImpl.java:622)[144:org.glassfish.hk2.locator:2.4.0.b34]
	at org.jvnet.hk2.internal.ServiceLocatorImpl.getServiceHandle(ServiceLocatorImpl.java:640)[144:org.glassfish.hk2.locator:2.4.0.b34]
	at org.jvnet.hk2.internal.FactoryCreator.getFactoryHandle(FactoryCreator.java:103)[144:org.glassfish.hk2.locator:2.4.0.b34]
	... 34 more
2016-11-29 00:17:37.622 [WARN ] [org.eclipse.jetty.server.HttpChannel] - /rest/events
javax.servlet.ServletException: javax.servlet.ServletException: A MultiException has 1 exceptions.  They are:
1. java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_2,3,241377814) has been shut down

	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:88)[165:org.ops4j.pax.web.pax-web-jetty:4.2.4]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.Server.handle(Server.java:499)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)[70:org.eclipse.jetty.io:9.2.14.v20151106]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[81:org.eclipse.jetty.util:9.2.14.v20151106]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[81:org.eclipse.jetty.util:9.2.14.v20151106]
	at java.lang.Thread.run(Unknown Source)[:1.8.0_111]
Caused by: javax.servlet.ServletException: A MultiException has 1 exceptions.  They are:
1. java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_2,3,241377814) has been shut down

	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76)[11:com.eclipsesource.jaxrs.publisher:5.3.1.201602281253]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)[79:org.eclipse.jetty.servlet:9.2.14.v20151106]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)[79:org.eclipse.jetty.servlet:9.2.14.v20151106]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:70)[165:org.ops4j.pax.web.pax-web-jetty:4.2.4]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)[77:org.eclipse.jetty.security:9.2.14.v20151106]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:271)[165:org.ops4j.pax.web.pax-web-jetty:4.2.4]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)[79:org.eclipse.jetty.servlet:9.2.14.v20151106]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)[78:org.eclipse.jetty.server:9.2.14.v20151106]
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)[165:org.ops4j.pax.web.pax-web-jetty:4.2.4]
	... 8 more
Caused by: A MultiException has 1 exceptions.  They are:
1. java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_2,3,241377814) has been shut down

	at org.jvnet.hk2.internal.FactoryCreator.getFactoryHandle(FactoryCreator.java:106)[144:org.glassfish.hk2.locator:2.4.0.b34]
	at org.jvnet.hk2.internal.FactoryCreator.dispose(FactoryCreator.java:173)[144:org.glassfish.hk2.locator:2.4.0.b34]
	at org.jvnet.hk2.internal.SystemDescriptor.dispose(SystemDescriptor.java:526)[144:org.glassfish.hk2.locator:2.4.0.b34]
	at org.glassfish.jersey.process.internal.RequestScope$Instance.remove(RequestScope.java:532)[151:org.glassfish.jersey.core.jersey-common:2.22.2]
	at org.glassfish.jersey.process.internal.RequestScope$Instance.release(RequestScope.java:549)[151:org.glassfish.jersey.core.jersey-common:2.22.2]
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:319)[151:org.glassfish.jersey.core.jersey-common:2.22.2]
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)[152:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)[152:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)[149:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	... 26 more
Caused by: java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_2,3,241377814) has been shut down
	at org.jvnet.hk2.internal.ServiceLocatorImpl.checkState(ServiceLocatorImpl.java:2288)[144:org.glassfish.hk2.locator:2.4.0.b34]
	at org.jvnet.hk2.internal.ServiceLocatorImpl.getServiceHandleImpl(ServiceLocatorImpl.java:629)[144:org.glassfish.hk2.locator:2.4.0.b34]
	at org.jvnet.hk2.internal.ServiceLocatorImpl.getServiceHandle(ServiceLocatorImpl.java:622)[144:org.glassfish.hk2.locator:2.4.0.b34]
	at org.jvnet.hk2.internal.ServiceLocatorImpl.getServiceHandle(ServiceLocatorImpl.java:640)[144:org.glassfish.hk2.locator:2.4.0.b34]
	at org.jvnet.hk2.internal.FactoryCreator.getFactoryHandle(FactoryCreator.java:103)[144:org.glassfish.hk2.locator:2.4.0.b34]
	... 34 more
2016-11-29 00:17:37.622 [WARN ] [org.eclipse.jetty.server.HttpChannel] - Could not send response error 500: javax.servlet.ServletException: javax.servlet.ServletException: A MultiException has 1 exceptions.  They are:
1. java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_2,3,241377814) has been shut down

2016-11-29 00:17:38.839 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2016-11-29 00:17:39.073 [INFO ] [assic.internal.servlet.WebAppServlet] - Started Classic UI at /classicui/app
2016-11-29 00:17:39.451 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /ui
2016-11-29 00:17:39.732 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
2016-11-29 00:17:40.122 [INFO ] [ulation.internal.HueEmulationServlet] - Started Hue Emulation service at /api
2016-11-29 00:17:40.200 [ERROR] [org.openhab.binding.tcp             ] - FrameworkEvent ERROR - org.openhab.binding.tcp
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.tcp [193]
  Unresolved requirement: Import-Package: org.openhab.core.binding

	at org.eclipse.osgi.container.Module.start(Module.java:434)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
1 Like

At the openhab> prompt

feature:install openhab-runtime-compat1x

in case the feature was uninstalled when you uninstalled the old TCP binding. Of course try restarting your openHAB server if that doesn’t clear it up.

First Off I Want to Thank You for all of your assistance with this.

I followed your instructions and reinstalled the version of the binding that you linked to and then followed up by re-installing the OH1 compatibility feature.

I was still seeing the line breaking as you mentioned in one of your earlier posts.

I was able to get the rule to complete successfully by adding the

\r

for Carriage Return in the case statement of the rule.

My rule now looks like this…

rule "Update LR"
when
  Item LRQuery received update
then
  switch LRQuery.state.toString {
    case "0\r": Living_Room.postUpdate(OFF)
    case "1\r": Living_Room.postUpdate(ON)
  }
end

Many thanks to you and the community for furthering my knowledge and excitement of OH…on to new challenges! :grin:

1 Like

Sorry for replying a bit late. But I didn’t have the time to advance on this. Hopefully I will have some time this Friday. :slight_smile:

To set a value to my dimmer I need to send SXYY1ZZZ

  • X = the ID of the light attached to the dimmer

  • YY = the percantage to set the dimmer (99=100)

  • ZZZ = interval (ms) to reach the requested value (min. 001 – max. 250)

To get the current value of a dimmer I need to send IX000000

  • X = the ID of the light attached to the dimmer

And the reply of that call is I0110XYY

  • X = the ID of the light attached to the dimmer

  • YY = the percantage to set the dimmer (99=100)

I think that should cover everything. I think that updating the dimmer value will work in a very similar way as the ON/OFF for the lights.
But my only gap is, how do I send the dimmer value I selected in the app or web interface?

Thanks again for all the help

I’ve been trying a bit myself and I think I can use a JavaScript transform for this.

Dimmer Light_GF_Living_Ceiling       "Living"         (gGF, Lights) {udp=">[*:10.10.1.44:1001:'JS(living.js)']", autoupdate="false" }
(function(i) {
	if(i=100)
		i=99;
	
	if(i<10)
		i="0"+i;
    var result="S1"+i+"1250";
    return result;
})(input)

But it’s not working yet. Can somebody help to see what I’m still doing wrong here?