New Jeelink Openhab2 Binding

Thank you for your fast reply, Volker.
In deed, a restart of openhab stopped it.
:slight_smile:

Thanks,
Matthias

You are welcome. The bug is already fixed in 2.3.0-snapshot. So if you want to avoid this problem in the future, you can upgrade the binding.

Use this one:
https://github.com/vbier/openhab2-addons/raw/jars/addons/binding/org.openhab.binding.jeelink/org.openhab.binding.jeelink-2.3.0-SNAPSHOT.jar

Hello!

Thanks for developing this awesome Binding! I am using the version (binding-jeelink - 2.2.0) of the jeelink binding since it has been released and i am experiencing a confusing behaviour.

I have 4 temperature sensors bound and everything works until i reboot the system.
After the reboot (or openhab service restart) the temperature, humidity, and battery new channel loose their channel links. But this happens only with one of those four sensors… the other remaining three seem to be unaffected by the channel link losses.

As a matter of fact that means for me that my temperature control is not working until i rellink the channels again through the paper ui (pretty easy to do - but you have to be aware about that problem - so its really annoying).

Release = Raspbian GNU/Linux 8 (jessie)
Kernel = Linux 4.9.35-v7+
Platform = Raspberry Pi 3 Model B Rev 1.2
openHAB 2.2.0-1 (Release Build)
binding-jeelink - 2.2.0
I use the simple Item Linking Mode
The openhab.log only mentions rule and sitemap errors. But those are subsequent faults of the lost channel links of this sensor.

Is it possible that this problem could be related to this? https://community.openhab.org/t/mysensors-binding-channel-names-disappearing-in-paperui-control-page-after-reboot/35706
There is a mention for a fix for binding developers --> I tried the workarounds, they are not working for me.

As you can see in the attached screenshot i have to relink the other channels. After that my rules and sitemaps work as they should again. This error is completely reproducible. It happens after each reboot!

Do you have an idea why this is happening? Is there a solution, a simple fix? Is it possible to make a rule to relink the channels after reboot?

With best regards and thanks in advance
Walter

Whether channels are linked or not is not part of the binding’s responsibility. This seems to be a bug in the openHAB code. I have used paper UI to link items only for a few days and then setup items files. Have you tried that?

The PCA301 code got merged into the 2.3 branch yesterday. :champagne:

I have another change in the pipeline that should make sure that the init commands are sent correctly.
Previously, the init commands have been sent when the first reading was received. This did obvioulsy not work if you needed an init command to change the datarate in order to receive readings.
Therefore I have now changed the code to send the init commands after the first reading has been received or a configurable timeout has occurred. The timeout is 15s by default and can be changed in the stick configuration.
Together with the changes that have been merged, this should now make LGWs work. I have destroyed some parts with my soldering iron in the process of building a LGW. But now that I got it working I have tested the binding code and everything looks good so far.
I have connected LaCrosse and PCA301 sensors and both are working fine.

It would be nice if some of you could test the updated binding before I create a pull request:
https://github.com/vbier/openhab2-addons/raw/jars/addons/binding/org.openhab.binding.jeelink/org.openhab.binding.jeelink-2.3.0-SNAPSHOT.jar

Hallo Volker,
nach meinem Umzug und gecrashtem NUC samt FHEM wollt ich das optisch viel ansprechende Openhab testen.
Einfache Sachen wie Hue, AVR, TV… laufen top.
Im FHEM hatte ich zwei Jeelinks, einer für meine PCA301 der andere für TFA Dostmann.
Beide liefen unter FHEM, muss da nun ein neuer Sketch drauf?
Hab eben deiner News bzgl. der PCA301 gelesen aber bekomm die einfach nicht zum laufen.

Gibt es etwas ähnliches wie das Wiki im FHEM für alle Aktoren für Openhab?
Sowas ist echt einfacher für Noobs.

Gruß Stefan

Step by step:

  • you download the jar, put it into the openHAB addons folder
  • you wait for the add-on to be shown in the paper UI
  • you make sure the serial device can be seen by openHAB (only if connected directly via usb)
  • you create a Jeelink thing manually in the paper UI inbox
  • you scan for sensors using the paper UI inbox
  • you create items file(s) linking the channels to items (if paper UI simple mode is disabled)
  • you see updates and can control things in the paper UI
  • you use a UI of your choice and use the items
  • you write a blog or wiki article on how you have set everything up and link it here for other noobs

Google the steps to get detailed information.
If this fails, write detailed information on what you have tried and what did not work as expected

  • I pluged in the pca301 flashed Jeelink attached to ttyUSB0
  • create the Jeelink in the paper ui inbox

2018-03-07 19:08:09.038 [hingStatusInfoChangedEvent] - ‘jeelink:jeelinkUsb:0ecb16f4’ changed from UNINITIALIZED to INITIALIZING

2018-03-07 19:08:09.048 [hingStatusInfoChangedEvent] - ‘jeelink:jeelinkUsb:0ecb16f4’ changed from INITIALIZING to ONLINE

But after scan nothing happens.
When I push the button on the pca301 device the Jeelink´s blue led flash´s, but nothin to see in the event log.

Ist the socket paired to the stick? Die you press the button while discovery was in progress?
It is essential that the stick receives a reading while discovery is running.
If that does not help, enable trace logging in the console and paste the relevant part (discovery with button press) of the openhab.log file.

Yes the socket was/is paired with the stick (from previous fhem setup).
Yes I pressed the button in discovery mode an the led flash´s

You meen this?

2018-03-07 20:18:48.050 [DEBUG] [elink.internal.JeeLinkHandlerFactory] - creating JeeLinkHandler for thing c57ae68a...
2018-03-07 20:18:48.052 [DEBUG] [elink.internal.JeeLinkHandlerFactory] - registering sensor discovery service...
2018-03-07 20:18:48.062 [DEBUG] [org.openhab.binding.jeelink         ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=321, service.bundleid=188, service.scope=singleton} - org.openhab.binding.jeelink
2018-03-07 20:18:48.070 [DEBUG] [l.connection.JeeLinkSerialConnection] - Creating serial connection for port /dev/ttyUSB0 with baud rate 57600...
2018-03-07 20:18:48.071 [DEBUG] [l.connection.JeeLinkSerialConnection] - Opening serial connection to port /dev/ttyUSB0 with baud rate 57600...

.

Yes, but with trace logging enabled. Search this thread for instructions.

Looks good ,or?

2018-03-07 20:36:26.283 [TRACE] [connection.AbstractJeeLinkConnection] - Read line from port /dev/ttyUSB0: OK 24 4 4 15 166 240 1 1 143 80 38
2018-03-07 20:36:33.991 [TRACE] [connection.AbstractJeeLinkConnection] - Read line from port /dev/ttyUSB0: OK 24 5 4 5 64 11 1 5 255 216 240
2018-03-07 20:36:35.532 [DEBUG] [l.connection.JeeLinkSerialConnection] - Closing serial connection to port /dev/ttyUSB0...
2018-03-07 20:36:50.402 [DEBUG] [elink.internal.JeeLinkHandlerFactory] - creating JeeLinkHandler for thing 4f579379...
2018-03-07 20:36:50.405 [DEBUG] [elink.internal.JeeLinkHandlerFactory] - registering sensor discovery service...
2018-03-07 20:36:50.422 [DEBUG] [l.connection.JeeLinkSerialConnection] - Creating serial connection for port /dev/ttyUSB0 with baud rate 57600...
2018-03-07 20:36:50.423 [DEBUG] [l.connection.JeeLinkSerialConnection] - Opening serial connection to port /dev/ttyUSB0 with baud rate 57600...
2018-03-07 20:37:00.820 [TRACE] [connection.AbstractJeeLinkConnection] - Read line from port /dev/ttyUSB0: OK 24 7 5 5 64 16 1 170 170 170 170
2018-03-07 20:37:01.444 [TRACE] [connection.AbstractJeeLinkConnection] - Read line from port /dev/ttyUSB0: OK 24 7 4 5 64 16 0 0 0 0 0
2018-03-07 20:37:03.155 [TRACE] [connection.AbstractJeeLinkConnection] - Read line from port /dev/ttyUSB0: OK 24 7 5 5 64 16 0 170 170 170 170

But no items

The log does not show that discovery has been started?

I deleted the stick and run it again

2018-03-07 20:59:24.664 [DEBUG] [l.connection.JeeLinkSerialConnection] - Closing serial connection to port /dev/ttyUSB0...
2018-03-07 20:59:24.758 [DEBUG] [org.openhab.binding.jeelink         ] - ServiceEvent UNREGISTERING - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=324, service.bundleid=188, service.scope=singleton} - org.openhab.binding.jeelink
2018-03-07 20:59:34.334 [DEBUG] [core.karaf.internal.FeatureInstaller] - Running scheduled sync job
2018-03-07 20:59:52.138 [DEBUG] [elink.internal.JeeLinkHandlerFactory] - creating JeeLinkHandler for thing 70432608...
2018-03-07 20:59:52.139 [DEBUG] [elink.internal.JeeLinkHandlerFactory] - registering sensor discovery service...
2018-03-07 20:59:52.143 [DEBUG] [org.openhab.binding.jeelink         ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=325, service.bundleid=188, service.scope=singleton} - org.openhab.binding.jeelink
2018-03-07 20:59:52.160 [DEBUG] [l.connection.JeeLinkSerialConnection] - Creating serial connection for port /dev/ttyUSB0 with baud rate 57600...
2018-03-07 20:59:52.163 [DEBUG] [l.connection.JeeLinkSerialConnection] - Opening serial connection to port /dev/ttyUSB0 with baud rate 57600...
2018-03-07 20:59:52.492 [TRACE] [connection.AbstractJeeLinkConnection] - Read line from port /dev/ttyUSB0: OK 24 8 4 5 86 62 1 2 131 68 76
2018-03-07 20:59:52.883 [TRACE] [connection.AbstractJeeLinkConnection] - Read line from port /dev/ttyUSB0: OK 24 6 4 6 200 255 1 2 4 60 154
2018-03-07 20:59:53.075 [TRACE] [connection.AbstractJeeLinkConnection] - Read line from port /dev/ttyUSB0: OK 24 7 4 5 64 16 1 0 0 0 0
2018-03-07 21:00:09.369 [TRACE] [connection.AbstractJeeLinkConnection] - Read line from port /dev/ttyUSB0: OK 24 7 5 5 64 16 1 170 170 170 170
2018-03-07 21:00:09.977 [TRACE] [connection.AbstractJeeLinkConnection] - Read line from port /dev/ttyUSB0: OK 24 7 4 5 64 16 0 0 0 0 0
2018-03-07 21:00:11.560 [TRACE] [connection.AbstractJeeLinkConnection] - Read line from port /dev/ttyUSB0: OK 24 7 5 5 64 16 0 170 170 170 170

Did you start discovery for the jeelink binding in the inbox of the paper ui?

Inbox > JeeLink Binding > Search

Did you paste the wrong part of the log? A discovery should look like this:

2018-03-06 19:55:49.601 [DEBUG] [nal.discovery.SensorDiscoveryService] - discovery started for bridge jeelink:jeelinkUsb:4c6d16fd
2018-03-06 19:55:50.410 [DEBUG] [nal.discovery.SensorDiscoveryService] - discovery for bridge jeelink:jeelinkUsb:4c6d16fd found already known sensor id 30
2018-03-06 19:55:54.151 [DEBUG] [nal.discovery.SensorDiscoveryService] - discovery for bridge jeelink:jeelinkUsb:4c6d16fd found already known sensor id 58
2018-03-06 19:55:54.642 [DEBUG] [nal.discovery.SensorDiscoveryService] - discovery for bridge jeelink:jeelinkUsb:4c6d16fd found already known sensor id 30
2018-03-06 19:55:57.894 [DEBUG] [nal.discovery.SensorDiscoveryService] - discovery for bridge jeelink:jeelinkUsb:4c6d16fd found already known sensor id 38
2018-03-06 19:56:02.411 [DEBUG] [nal.discovery.SensorDiscoveryService] - discovery for bridge jeelink:jeelinkUsb:4c6d16fd found unknown sensor of type jeelink:pca301 with id 1-160-236
2018-03-06 19:56:02.445 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘jeelink:pca301:1-160-236’ to inbox.
2018-03-06 19:56:03.059 [DEBUG] [nal.discovery.SensorDiscoveryService] - discovery for bridge jeelink:jeelinkUsb:4c6d16fd found already known sensor id 58
2018-03-06 19:56:06.487 [DEBUG] [nal.discovery.SensorDiscoveryService] - discovery for bridge jeelink:jeelinkUsb:4c6d16fd found already known sensor id 38
2018-03-06 19:56:11.582 [DEBUG] [nal.discovery.SensorDiscoveryService] - discovery for bridge jeelink:jeelinkUsb:4c6d16fd found already known sensor id 30
2018-03-06 19:56:11.963 [DEBUG] [nal.discovery.SensorDiscoveryService] - discovery for bridge jeelink:jeelinkUsb:4c6d16fd found already known sensor id 58
2018-03-06 19:56:15.082 [DEBUG] [nal.discovery.SensorDiscoveryService] - discovery for bridge jeelink:jeelinkUsb:4c6d16fd found already known sensor id 38
2018-03-06 19:56:19.600 [DEBUG] [nal.discovery.SensorDiscoveryService] - discovery stopped for bridge jeelink:jeelinkUsb:4c6d16fd

It should at least contain the discovery started and stopped messages.

Hm,
openhab> log:get
Logger │ Level
───────────────────────────────────────────────────┼──────
ROOT │ INFO
javax.jmdns │ ERROR
org.apache.karaf.jaas.modules.audit │ INFO
org.apache.karaf.kar.internal.KarServiceImpl │ ERROR
org.apache.karaf.shell.support │ OFF
org.eclipse.smarthome │ INFO
org.jupnp │ ERROR
org.openhab │ TRACE
org.openhab.binding.jeelink │ TRACE
org.ops4j.pax.url.mvn.internal.AetherBasedResolver │ ERROR
org.ops4j.pax.web.pax-web-runtime │ OFF
smarthome.event │ DEBUG
smarthome.event.InboxUpdatedEvent │ ERROR
smarthome.event.ItemAddedEvent │ ERROR
smarthome.event.ItemRemovedEvent │ ERROR
smarthome.event.ItemStateEvent │ ERROR
smarthome.event.ThingAddedEvent │ ERROR
smarthome.event.ThingRemovedEvent │ ERROR
smarthome.event.ThingStatusInfoEvent │ ERROR

And the content from the openhab.log
(you see the removed jeelink and the rest of entries above"

It is not a logging configuration problem. It looks like the discovery is not started, but I have no idea why.

Can you check that you only have one version of the binding installed? Type

bundle:list |grep Jeelink

Into the console.