Hi,
I am back with an update from my Mobile Alerts adventure with a conclusion and 3 new issues.
First the conclusion: It does not work with the MA sensors. The previous rare readings where most likely stray data from my neighbors. (Which was actually nice at it gave me 3 sensors I could test and successfully integrate in Openhab using the Jeelink binding.)
Meanhwile, I am pretty sure the MA sensors use a different protocol. I think they use a global unique ID otherwise adding sensors in the app with a QR code and changing battery without re-registering (even when separated for multiple days from the gateway) would not work.
So being able to use the MA sensors would be pretty nice, as we would not have the ID problem.
One of the issues I found has nothing to do with the binding but with my PINE64 (Ubuntu 16.04) which I used initially for my tests. It simply gets no sensor data from the Jeelink. To simplify the setting I used picocom and also echo / tail -f to communicate with the Jeelink. I could read teh version, set frequency and data rate and turn off the LED but no data. Also to note: cat never gave me anything and immediately returned when called.
Using my Microsoft Surface Book (Windows 10), I got readings every few seconds from my neighbor’s sensors.
I also used a 2m USB 3 extension to eliminate disturbance from the PINE64 being the cause and also left the PINE64 running with everything positioned the same while successfully reading data within Windows.
Next to the cat closing immediately I also have some other different behavior. Looks like on the PINE64, the first command after opening a connection is lost. You can see it in the log I posted previously, where I had to scan twice to get a response from the Jeelink. Also when I connect directly via tail -f, and issue a echo “v”, I get nothing, but all following “v” give me the version.
Feels like I have to wake up the Jeelink every time first. I guess it is some faulty USB driver implementation or maybe just a wrong driver or config. Worst case it is a hardware issue. Had no time to research it yet.
The second issue had no impact in any functionality for me, but I noticed that scanning for a Jeelink device under Windows causes a Java exception when the device is already online.
I used the Openhab 2.0.0 release version with the latest JAR for the binding downloaded last night (2.0.0.201701211052)
10:06:39.455 [INFO ] [nk.discovery.JeeLinkDiscoveryService] - Stopping discovery of JeeLink USB Receivers...
10:06:39.456 [INFO ] [nk.discovery.JeeLinkDiscoveryService] - Stopped discovery of JeeLink USB Receivers.
10:06:39.456 [INFO ] [nk.discovery.JeeLinkDiscoveryService] - Starting discovery of JeeLink USB receivers...
10:06:39.456 [DEBUG] [nk.discovery.JeeLinkDiscoveryService] - Iterating ports...
10:06:39.764 [DEBUG] [nk.discovery.JeeLinkDiscoveryService] - Scanning port COM3...
10:06:39.765 [INFO ] [link.handler.JeeLinkSerialConnection] - Creating serial connection for port COM3 with baud rate 57600...
10:06:39.765 [INFO ] [link.handler.JeeLinkSerialConnection] - Opening serial connection to port COM3 with baud rate 57600...
10:06:39.779 [ERROR] [nk.discovery.JeeLinkDiscoveryService] - Port could not be opened: COM3
org.openhab.binding.jeelink.handler.ConnectException: gnu.io.PortInUseException: Unknown Application
at org.openhab.binding.jeelink.handler.JeeLinkSerialConnection.openConnection(JeeLinkSerialConnection.java:101)
at org.openhab.binding.jeelink.discovery.JeeLinkDiscoveryService.startScan(JeeLinkDiscoveryService.java:56)
at org.eclipse.smarthome.config.discovery.AbstractDiscoveryService.startScan(AbstractDiscoveryService.java:199)
at org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.startScan(DiscoveryServiceRegistryImpl.java:382)
at org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.startScans(DiscoveryServiceRegistryImpl.java:358)
at org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.startScan(DiscoveryServiceRegistryImpl.java:216)
at org.eclipse.smarthome.io.rest.core.discovery.DiscoveryResource.scan(DiscoveryResource.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)[:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)[:1.8.0_121]
at java.lang.reflect.Method.invoke(Unknown Source)[:1.8.0_121]
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)[159:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)[159:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)[159:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)[159:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)[159:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)[159:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)[159:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)[159:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)[159:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)[157:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)[157:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)[157:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)[157:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)[157:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)[157:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)[159:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)[159:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)[155:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)[155:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)[155:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)[155:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)[155:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76)[10:com.eclipsesource.jaxrs.publisher:5.3.1.201602281253]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)[81:org.eclipse.jetty.servlet:9.2.19.v20160908]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)[81:org.eclipse.jetty.servlet:9.2.19.v20160908]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)[173:org.ops4j.pax.web.pax-web-jetty:4.3.0]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)[79:org.eclipse.jetty.security:9.2.19.v20160908]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:287)[173:org.ops4j.pax.web.pax-web-jetty:4.3.0]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)[81:org.eclipse.jetty.servlet:9.2.19.v20160908]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)[173:org.ops4j.pax.web.pax-web-jetty:4.3.0]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.Server.handle(Server.java:499)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)[72:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[83:org.eclipse.jetty.util:9.2.19.v20160908]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[83:org.eclipse.jetty.util:9.2.19.v20160908]
at java.lang.Thread.run(Unknown Source)[:1.8.0_121]
Caused by: gnu.io.PortInUseException: Unknown Application
at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:475)
at org.openhab.binding.jeelink.handler.JeeLinkSerialConnection.openConnection(JeeLinkSerialConnection.java:70)
... 54 more
10:06:39.795 [INFO ] [nk.discovery.JeeLinkDiscoveryService] - Closing all open ports...
10:07:09.457 [INFO ] [nk.discovery.JeeLinkDiscoveryService] - Stopping discovery of JeeLink USB Receivers...
10:07:09.458 [INFO ] [nk.discovery.JeeLinkDiscoveryService] - Stopped discovery of JeeLink USB Receivers.
I guess the COM port does not close properly.
Last issue is bit more annoying but can be worked around and is maybe rather a bug in the Openhab Paper UI and not in the binding.
Whenever I update the init commands and save it, it does not show the changes whenever I go back to editing. Only when I save them again, it also updates in the GUI.
Example:
- Enter edit mode: current setting: “a0;v” - shown setting: “a0;v” - change to “a0” and save --> is applied to the device
- Enter edit mode: current setting: “a0” - shown setting: “a0;v” - exit without saving --> nothing happens with device
- Enter edit mode: current setting: “a0” - shown setting: “a0;v” - exit with saving --> nothing happens with device
- Enter edit mode: current setting: “a0” - shown setting: “a0” - exit with saving --> nothing happens with device