openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.9k stars 3.59k forks source link

[Tellstick] Completely stopped working since going from 2.3 stable to snapshot #3849

Closed DanielMalmgren closed 6 years ago

DanielMalmgren commented 6 years ago

Expected Behavior

The Binding should start and get the relevant Things online.

Current Behavior

The gateway gets status UNKNOWN and all the other Tellstick devices get OFFLINE.

Steps to Reproduce (for Bugs)

  1. Install and start the binding

Context

Pasting full log below, but the important row seems to be the "Invalid calling convention 63". The interesting thing is that I got the exact same error when I tried to get this binding running in an arm64 environment and came to the conclusion that it had something with JNA using the wrong architecture to do. Now however I'm in a pure 32 bit (arm) environment in which everything worked fin in 2.3.0.

Your Environment

OS: Debian Jessie CPU: ARMv7 (i.MX6 Quad) OH: Build #1330 Tellstick Binding: 2.4.0.201808131007

Log

Full debug log when starting the Binding:

2018-08-20 12:53:31.792 [DEBUG] [org.openhab.binding.tellstick       ] - BundleEvent STARTING - org.openhab.binding.tellstick
2018-08-20 12:53:31.887 [DEBUG] [org.openhab.binding.tellstick       ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=662, service.bundleid=234, service.scope=bundle, component.name=org.openhab.binding.tellstick.internal.TellstickHandlerFactory, component.id=438} - org.openhab.binding.tellstick
2018-08-20 12:53:32.035 [DEBUG] [org.openhab.binding.tellstick       ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=663, service.bundleid=234, service.scope=bundle, component.name=org.openhab.binding.max.internal.discovery, component.id=439} - org.openhab.binding.tellstick
2018-08-20 12:53:32.253 [DEBUG] [org.openhab.binding.tellstick       ] - BundleEvent STARTED - org.openhab.binding.tellstick
2018-08-20 12:53:32.479 [DEBUG] [org.openhab.binding.tellstick       ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=664, service.bundleid=234, service.scope=singleton} - org.openhab.binding.tellstick
2018-08-20 12:53:32.598 [DEBUG] [ternal.core.TelldusCoreBridgeHandler] - Initializing Tellstick bridge handler.
2018-08-20 12:53:32.638 [INFO ] [ternal.core.TelldusCoreBridgeHandler] - Loading telldus-core from /usr/lib/
2018-08-20 12:53:32.768 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Initialize TelldusDeviceHandler Configuration[{key=protocol; type=String; value=oregon}, {key=name; type=String; value=2914:6}, {key=model; type=String; value=2914}, {key=deviceId; type=String; value=6_2914_oregon}]. class class org.eclipse.smarthome.config.core.Configuration
2018-08-20 12:53:32.761 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Initialize TelldusDeviceHandler Configuration[{key=protocol; type=String; value=fineoffset}, {key=name; type=String; value=temperature:203}, {key=model; type=String; value=temperature}, {key=deviceId; type=String; value=203_temperature_fineoffset}]. class class org.eclipse.smarthome.config.core.Configuration
2018-08-20 12:53:32.745 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Initialize TelldusDeviceHandler Configuration[{key=protocol; type=String; value=arctech}, {key=repeat; type=BigDecimal; value=2}, {key=name; type=String; value=Fönsterlampa förrådet}, {key=model; type=String; value=codeswitch}, {key=deviceId; type=String; value=13}, {key=dimmer; type=Boolean; value=false}]. class class org.eclipse.smarthome.config.core.Configuration
2018-08-20 12:53:32.743 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Initialize TelldusDeviceHandler Configuration[{key=protocol; type=String; value=arctech}, {key=repeat; type=BigDecimal; value=2}, {key=name; type=String; value=Fönsterlampa övervåning}, {key=model; type=String; value=codeswitch}, {key=deviceId; type=String; value=12}, {key=dimmer; type=Boolean; value=false}]. class class org.eclipse.smarthome.config.core.Configuration
2018-08-20 12:53:33.013 [DEBUG] [lstick.handler.TelldusDevicesHandler] - device: 13 bridgeStatusChanged: UNKNOWN
2018-08-20 12:53:32.936 [DEBUG] [lstick.handler.TelldusDevicesHandler] - device: 203_temperature_fineoffset bridgeStatusChanged: UNKNOWN
2018-08-20 12:53:32.878 [DEBUG] [lstick.handler.TelldusDevicesHandler] - device: 6_2914_oregon bridgeStatusChanged: UNKNOWN
2018-08-20 12:53:32.845 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! DEVICE with id '1' to smarthome inbox
2018-08-20 12:53:32.812 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Initialize TelldusDeviceHandler Configuration[{key=protocol; type=String; value=fuhaote}, {key=repeat; type=BigDecimal; value=2}, {key=name; type=String; value=Vitrinskåpet i vardagsrummet}, {key=model; type=String; value=codeswitch}, {key=deviceId; type=String; value=17}, {key=dimmer; type=Boolean; value=false}]. class class org.eclipse.smarthome.config.core.Configuration
2018-08-20 12:53:32.790 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Initialize TelldusDeviceHandler Configuration[{key=protocol; type=String; value=arctech}, {key=repeat; type=BigDecimal; value=2}, {key=name; type=String; value=Ljusslinga balkongräcke}, {key=model; type=String; value=codeswitch}, {key=deviceId; type=String; value=1}, {key=dimmer; type=Boolean; value=false}]. class class org.eclipse.smarthome.config.core.Configuration
2018-08-20 12:53:33.305 [DEBUG] [lstick.handler.TelldusDevicesHandler] - device: 17 bridgeStatusChanged: UNKNOWN
2018-08-20 12:53:33.229 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! DEVICE with id '5' to smarthome inbox
2018-08-20 12:53:33.210 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Initialize TelldusDeviceHandler Configuration[{key=protocol; type=String; value=waveman}, {key=repeat; type=BigDecimal; value=2}, {key=name; type=String; value=Ringklocka ytterdörr}, {key=model; type=String; value=codeswitch}, {key=deviceId; type=String; value=20}, {key=dimmer; type=Boolean; value=false}]. class class org.eclipse.smarthome.config.core.Configuration
2018-08-20 12:53:33.186 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Initialize TelldusDeviceHandler Configuration[{key=protocol; type=String; value=fineoffset}, {key=name; type=String; value=temperature:234}, {key=model; type=String; value=temperature}, {key=deviceId; type=String; value=234_temperature_fineoffset}]. class class org.eclipse.smarthome.config.core.Configuration
2018-08-20 12:53:33.176 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Handle event REFRESH for tellstick:sensor:1:203_temperature_fineoffset:temperature
2018-08-20 12:53:33.145 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Initialize TelldusDeviceHandler Configuration[{key=protocol; type=String; value=arctech}, {key=repeat; type=BigDecimal; value=2}, {key=name; type=String; value=Utebelysning}, {key=model; type=String; value=codeswitch}, {key=deviceId; type=String; value=16}, {key=dimmer; type=Boolean; value=false}]. class class org.eclipse.smarthome.config.core.Configuration
2018-08-20 12:53:33.108 [DEBUG] [lstick.handler.TelldusDevicesHandler] - device: 12 bridgeStatusChanged: UNKNOWN
2018-08-20 12:53:33.749 [DEBUG] [lstick.handler.TelldusDevicesHandler] - device: 16 bridgeStatusChanged: UNKNOWN
2018-08-20 12:53:33.678 [DEBUG] [lstick.handler.TelldusDevicesHandler] - No available bridge handler found for 203_temperature_fineoffset bridge org.eclipse.smarthome.core.thing.internal.BridgeImpl@3e3cfcb2 .
2018-08-20 12:53:33.646 [DEBUG] [lstick.handler.TelldusDevicesHandler] - device: 234_temperature_fineoffset bridgeStatusChanged: UNKNOWN
2018-08-20 12:53:33.588 [DEBUG] [lstick.handler.TelldusDevicesHandler] - device: 20 bridgeStatusChanged: UNKNOWN
2018-08-20 12:53:33.510 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! DEVICE with id '6' to smarthome inbox
2018-08-20 12:53:33.498 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Initialize TelldusDeviceHandler Configuration[{key=protocol; type=String; value=fineoffset}, {key=name; type=String; value=temperature:167}, {key=model; type=String; value=temperature}, {key=deviceId; type=String; value=167_temperature_fineoffset}]. class class org.eclipse.smarthome.config.core.Configuration
2018-08-20 12:53:33.485 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Handle event REFRESH for tellstick:switch:1:17:state
2018-08-20 12:53:33.414 [DEBUG] [lstick.handler.TelldusDevicesHandler] - device: 1 bridgeStatusChanged: UNKNOWN
2018-08-20 12:53:34.021 [DEBUG] [lstick.handler.TelldusDevicesHandler] - No available bridge handler found for 17 bridge org.eclipse.smarthome.core.thing.internal.BridgeImpl@3e3cfcb2 .
2018-08-20 12:53:33.998 [DEBUG] [lstick.handler.TelldusDevicesHandler] - device: 167_temperature_fineoffset bridgeStatusChanged: UNKNOWN
2018-08-20 12:53:33.933 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! DEVICE with id '12' to smarthome inbox
2018-08-20 12:53:33.909 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Handle event REFRESH for tellstick:switch:1:20:state
2018-08-20 12:53:33.885 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Initialize TelldusDeviceHandler Configuration[{key=protocol; type=String; value=arctech}, {key=repeat; type=BigDecimal; value=2}, {key=name; type=String; value=Edvins fönsterlampa}, {key=model; type=String; value=codeswitch}, {key=deviceId; type=String; value=6}, {key=dimmer; type=Boolean; value=false}]. class class org.eclipse.smarthome.config.core.Configuration
2018-08-20 12:53:33.844 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-08-20 12:53:33.817 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Initialize TelldusDeviceHandler Configuration[{key=protocol; type=String; value=arctech}, {key=repeat; type=BigDecimal; value=2}, {key=name; type=String; value=Ellas fönsterlampa}, {key=model; type=String; value=codeswitch}, {key=deviceId; type=String; value=5}, {key=dimmer; type=Boolean; value=false}]. class class org.eclipse.smarthome.config.core.Configuration
2018-08-20 12:53:33.807 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Handle event REFRESH for tellstick:switch:1:16:state
2018-08-20 12:53:34.545 [DEBUG] [lstick.handler.TelldusDevicesHandler] - device: 5 bridgeStatusChanged: UNKNOWN
2018-08-20 12:53:34.433 [DEBUG] [lstick.handler.TelldusDevicesHandler] - device: 6 bridgeStatusChanged: UNKNOWN
2018-08-20 12:53:34.335 [DEBUG] [lstick.handler.TelldusDevicesHandler] - No available bridge handler found for 20 bridge org.eclipse.smarthome.core.thing.internal.BridgeImpl@3e3cfcb2 .
2018-08-20 12:53:34.312 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! DEVICE with id '13' to smarthome inbox
2018-08-20 12:53:34.191 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-08-20 12:53:34.108 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Handle event REFRESH for tellstick:switch:1:1:state
2018-08-20 12:53:34.732 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Handle event REFRESH for tellstick:switch:1:6:state
2018-08-20 12:53:34.705 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! DEVICE with id '16' to smarthome inbox
2018-08-20 12:53:34.672 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-08-20 12:53:34.605 [DEBUG] [lstick.handler.TelldusDevicesHandler] - Handle event REFRESH for tellstick:switch:1:5:state
2018-08-20 12:53:34.573 [DEBUG] [lstick.handler.TelldusDevicesHandler] - No available bridge handler found for 16 bridge org.eclipse.smarthome.core.thing.internal.BridgeImpl@3e3cfcb2 .
2018-08-20 12:53:34.958 [DEBUG] [lstick.handler.TelldusDevicesHandler] - No available bridge handler found for 5 bridge org.eclipse.smarthome.core.thing.internal.BridgeImpl@3e3cfcb2 .
2018-08-20 12:53:34.888 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! DEVICE with id '17' to smarthome inbox
2018-08-20 12:53:34.851 [DEBUG] [lstick.handler.TelldusDevicesHandler] - No available bridge handler found for 6 bridge org.eclipse.smarthome.core.thing.internal.BridgeImpl@3e3cfcb2 .
2018-08-20 12:53:34.791 [DEBUG] [lstick.handler.TelldusDevicesHandler] - No available bridge handler found for 1 bridge org.eclipse.smarthome.core.thing.internal.BridgeImpl@3e3cfcb2 .
2018-08-20 12:53:35.094 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-08-20 12:53:35.060 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! DEVICE with id '20' to smarthome inbox
2018-08-20 12:53:35.028 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-08-20 12:53:34.988 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-08-20 12:53:35.294 [ERROR] [org.tellstick.device.TellstickSensor] - Tellstick error -3 msg Device not found
2018-08-20 12:53:35.185 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-08-20 12:53:35.390 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! SENSOR with id '203' to smarthome inbox
2018-08-20 12:53:35.561 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! SENSOR with id '234' to smarthome inbox
2018-08-20 12:53:35.650 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! SENSOR with id '6' to smarthome inbox
2018-08-20 12:53:35.740 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! SENSOR with id '6' to smarthome inbox
2018-08-20 12:53:35.803 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! SENSOR with id '50' to smarthome inbox
2018-08-20 12:53:35.866 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! SENSOR with id '50' to smarthome inbox
2018-08-20 12:53:35.947 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! SENSOR with id '101' to smarthome inbox
2018-08-20 12:53:36.015 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! SENSOR with id '28' to smarthome inbox
2018-08-20 12:53:36.075 [DEBUG] [.discovery.TellstickDiscoveryService] - Adding new TellstickDevice! SENSOR with id '160' to smarthome inbox
2018-08-20 12:53:36.140 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception
java.lang.IllegalArgumentException: Invalid calling convention 63
        at com.sun.jna.Native.createNativeCallback(Native Method) ~[?:?]
        at com.sun.jna.CallbackReference.<init>(CallbackReference.java:263) ~[?:?]
        at com.sun.jna.CallbackReference.getFunctionPointer(CallbackReference.java:449) ~[?:?]
        at com.sun.jna.CallbackReference.getFunctionPointer(CallbackReference.java:426) ~[?:?]
        at com.sun.jna.Function.convertArgument(Function.java:551) ~[?:?]
        at com.sun.jna.Function.invoke(Function.java:338) ~[?:?]
        at com.sun.jna.Library$Handler.invoke(Library.java:244) ~[?:?]
        at com.sun.proxy.$Proxy230.tdRegisterDeviceEvent(Unknown Source) ~[?:?]
        at org.tellstick.device.TellsticEventHandler.setupListeners(TellsticEventHandler.java:123) ~[?:?]
        at org.tellstick.device.TellsticEventHandler.<init>(TellsticEventHandler.java:48) ~[?:?]
        at org.openhab.binding.tellstick.internal.core.TelldusCoreBridgeHandler.setupListeners(TelldusCoreBridgeHandler.java:167) ~[?:?]
        at org.openhab.binding.tellstick.internal.core.TelldusCoreBridgeHandler.lambda$0(TelldusCoreBridgeHandler.java:119) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]
wborn commented 6 years ago

Surrounding the logging with triple backticks (``) instead of one () makes the logging a lot more readable @DanielMalmgren. ;-)

DanielMalmgren commented 6 years ago

Thanks a lot. I noticed the crappy readability but didn't really know what to do about it ;-)

wborn commented 6 years ago

I see you also asked for help in the community.

Did you also consider compiling telldus-core yourself? That might resolve issues for your platform and also give you a proper 64-bit version.

The compilation instructions seem pretty straightforward: https://developer.telldus.com/wiki/TellStickInstallationSource

EliasGabrielsson commented 6 years ago

I where also wondering if this have something todo with architecture. Have you notice that Telldus have released a 64 package?

It would be interesting to a) install a new openhabian instance, b) upgrade it to pre-release eg. 2.4.x and last c) install Telldus Center from openhabian tool as that will use the 64-bit pkg. If you have time to test that it would be wonderful.

DanielMalmgren commented 6 years ago

Sorry @wborn , missed your comment. Well, I tried compiling it myself when I was trying to get the binding running on my arm64 server. Struggled for days so I don't remember really what else I tried but in the end I just gave up, so now I'm on another server running armhf.

@EliasGabrielsson You mean there are precompiled 64 bit deb archives? That might make things a bit easier 😄 I've never used openhabian though and currently I've got no spare hardware to try this out...

Btw, might be worth mentioning here as well: Since this binding currently is completely broken I've made some workarounds so I can still use my devices anyway. Might be of use for others in the same boat: https://community.openhab.org/t/workaround-tutorial-using-tellstick-without-tellstick-binding/49976

EliasGabrielsson commented 6 years ago

Check out the script here if you would like to run it manually: https://github.com/openhab/openhabian/blob/fc1943afa22208a40e0c372d6271989f9af24adb/functions/packages.sh#L647

The script part can be used on an already installed Ubuntu/Debian system as well.

Alpoy commented 6 years ago

I can confirm this issue after upgrading snapshot release from 2.3 to 2.4. Tried recompiling the telldus-core but made no difference. (Debian jessie, Kernel 4.x)

DanielMalmgren commented 6 years ago

@jarlebh : Have you abandoned your work on this binding? That's the feeling I'm getting. If so, could you just give us a notification so that we know?

Masssssy commented 6 years ago

I'm running on a x86 machine with the Tellstick Duo and upgrading 2.3 -> 2.4 kills the functionality completely. Would gladly help to fix it but I'm a bit low on time right now...

DanielMalmgren commented 6 years ago

I'm running on a x86 machine with the Tellstick Duo and upgrading 2.3 -> 2.4 kills the functionality completely. Would gladly help to fix it but I'm a bit low on time right now...

Good to know it isn't only arm. Guess that means the binding is simply completely broken on all platforms. I don't know if it should be marked as broken somewhere?

martinvw commented 6 years ago

I'm running on a x86 machine with the Tellstick Duo and upgrading 2.3 -> 2.4 kills the functionality completely. Would gladly help to fix it but I'm a bit low on time right now...

Do you have the same error in your logs?

Masssssy commented 6 years ago

I downgraded as soon as my whole home went into a red alert defcon 1 crisis. If the logs weren't cleared on the downgrade I can dig it up or maybe try and reproduce by cloning my VM and upgrading that one.

martinvw commented 6 years ago

I downgraded as soon as my whole home went into a red alert defcon 1 crisis.

My wife knows these too 😃

Masssssy commented 6 years ago

Log from my start sequence on OH 2.4 (running on Ubuntu Server 64-bit)

2018-09-17` 20:31:55.336 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-09-17 20:31:55.462 [INFO ] [ternal.core.TelldusCoreBridgeHandler] - Loading telldus-core from C:/Program Files/Telldus/;C:/Program Files (x86)/Telldus/
2018-09-17 20:31:55.492 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-09-17 20:31:55.494 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-09-17 20:31:55.506 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-09-17 20:31:55.509 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-09-17 20:31:55.513 [ERROR] [org.tellstick.device.TellstickSensor] - Tellstick error -3 msg Device not found
2018-09-17 20:31:55.527 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-09-17 20:31:55.527 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-09-17 20:31:55.528 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-09-17 20:31:55.528 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-09-17 20:31:55.532 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-09-17 20:31:55.531 [WARN ] [lstick.handler.TelldusDevicesHandler] - Tellstick bridge handler not found. Cannot handle command without bridge.
2018-09-17 20:31:55.530 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception
java.lang.IllegalArgumentException: Invalid calling convention 63
        at com.sun.jna.Native.createNativeCallback(Native Method) ~[?:?]
        at com.sun.jna.CallbackReference.<init>(CallbackReference.java:263) ~[?:?]
        at com.sun.jna.CallbackReference.getFunctionPointer(CallbackReference.java:449) ~[?:?]
        at com.sun.jna.CallbackReference.getFunctionPointer(CallbackReference.java:426) ~[?:?]
        at com.sun.jna.Function.convertArgument(Function.java:551) ~[?:?]
        at com.sun.jna.Function.invoke(Function.java:338) ~[?:?]
        at com.sun.jna.Library$Handler.invoke(Library.java:244) ~[?:?]
        at com.sun.proxy.$Proxy155.tdRegisterDeviceEvent(Unknown Source) ~[?:?]
        at org.tellstick.device.TellsticEventHandler.setupListeners(TellsticEventHandler.java:123) ~[?:?]
        at org.tellstick.device.TellsticEventHandler.<init>(TellsticEventHandler.java:48) ~[?:?]
        at org.openhab.binding.tellstick.internal.core.TelldusCoreBridgeHandler.setupListeners(TelldusCoreBridgeHandler.java:167) ~[?:?]
        at org.openhab.binding.tellstick.internal.core.TelldusCoreBridgeHandler.lambda$0(TelldusCoreBridgeHandler.java:119) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]
DanielMalmgren commented 6 years ago

Yep, that's the old "Invalid calling convention 63"...

martinvw commented 6 years ago

Okay, it seems to be related to the JNA version, are you familiar with that @wborn?

wborn commented 6 years ago

No I haven't ever run into it myself @martinvw . But if I would, I'd recompile the library like I suggested in https://github.com/openhab/openhab2-addons/issues/3849#issuecomment-415881475.

jarlebh commented 6 years ago

Yes, that is true. I am currently exploring Home Assistant. I might come back some day, but for now I am not using OpenHAB

Den tor. 6. sep. 2018 kl. 08:25 skrev Daniel Malmgren < notifications@github.com>:

@jarlebh https://github.com/jarlebh : Have you abandoned your work on this binding? That's the feeling I'm getting. If so, could you just give us a notification so that we know?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openhab/openhab2-addons/issues/3849#issuecomment-418979113, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZhJrkhxNr7WtZoQZgTSRUl1y23HrWEks5uYL_VgaJpZM4WDzjT .

jannegpriv commented 6 years ago

What is the root-cause for the failure? Since it seems related to JNA, what functionality/change in OH 2.4 has caused the binding to fail? Or is it a change in the binding in 2.4 that caused it?

jannegpriv commented 6 years ago

I think I found the root-cause to the problem, in 2.4.0.M1 (#52) (2018-aug-15 21:52:02) and specifically Added JNA to distribution (#741), jna-4.5.2 has been added to OH2.4.

Since the tellstick binding uses javatellstick which in turn is compiled against jna-4.0.0, we end up in the "Invalid calling convention 63".

Work-around for getting tellstick binding to work (on a raspberry pi) is to move the the jna-4.5.2.jar and jna-platform-4.5.2.jar from /usr/share/openhab2/runtime/lib/boot/ to e.g. /tmp/ and restart OH.

DanielMalmgren commented 6 years ago

Great work there! Got my hope up again of actually having this solved before 2.4. I guess we should throw in @kaikreuzer here since he's the one that signed of #741. Would the solution to this be to not include jna in the binding at all but rather let it rely on the one included in OH?

EliasGabrielsson commented 6 years ago

Wow, well done @jannegpriv 🥇 If there going to be an JNA added to openha-distro I think we shall write a unit test that cover this. Eg. Every time JNA gets updated for some reason we at least get a warning for this binding.

kaikreuzer commented 6 years ago

the tellstick binding uses javatellstick which in turn is compiled against jna-4.0.0, we end up in the "Invalid calling convention 63".

In theory, 4.5.2 should be backward compatible to something that is compiled against 4.0.0, but it does not seem to be the case :-(

Yes, ideally, the binding should make use of the JNA version that is included in the distro. Is there a more recent version of javatellstick? Could it be compiled against 4.5.2 by ourselves?

DanielMalmgren commented 6 years ago

In theory, 4.5.2 should be backward compatible to something that is compiled against 4.0.0

Are you really sure about that? If I understand things correctly (see https://abi-laboratory.pro/?view=timeline&lang=java&l=jna) quite much was changed in 4.3.0. Doesn't get the feeling of binary compatibility.

I know @jannegpriv is working on getting the javatellstick source from Jarle though, so things are definitely moving in the right direction :-)

kaikreuzer commented 6 years ago

Are you really sure about that?

No, I was only speaking of the theory, if semantic versioning would have been followed on it....

jannegpriv commented 6 years ago

Unfortunately Jarle told me that he has had a HDD crash so the latest changes to javatellstick are gone, however Jarle suggested me to try to decompile the classfiles and update the source from that.

What I've seen so far is that there are fairly many changes done in the jar-file compared to the source, I will give it a try but I won't promise anything.

kaikreuzer commented 6 years ago

So you are saying, he included a newer version of the lib in the binding than what has been published on https://github.com/jarlebh/javatellstick? In any case, we should make sure that only the published code is used, otherwise we end up with a closed-source binding that does not comply with the EPL license anymore.

jannegpriv commented 6 years ago

Now I have decompiled the missing changes for javatellstick and also, with the help from the JNA forum, fixed the issue with incompatibility to newer versions of jna.

It was jna-4.2.1 that revealed the fault in the javatellstick code for linux based systems, and it was code for handling callbacks that failed (the call chain for the "Invalid calling convention 63" indicated that it was a callback setup that failed.

I have the complete and updated source code for javatellstick in my cloned javatellstick-repo. I've also updated javatellstick to compile against jna-4.5.2, same version as included in OH2.4 and built a new version of the lib, javatellstick-1.1.jar, containing all theses changes.

I've also updated the tellstick-binding to include javatellstick-1.1.jar and jna-4.5.2.jar and also fixed a typo in the naming of one of the included classes in javatellstick.

Finally I've built a new tellstick-binding jar-file for OH2.4 (seems also to work in OH2.3) and tested it on OH2.4 M4 since yesterday, however it will need further testing to make sure the decompilation has been done correctly. The jar-file can hopefully be downloaded here.

NOTE: I've only tested it on my raspberry running raspbian jessie, not on WIndows nor MacOS. NOTE: I've not changed any other parts of the source code for the tellstick binding, so old bugs are still there (if any).

If the tests are successfull, the changes I've made to the tellstick-binding needs to be made available via a pull request as I understand, I've started to prepare one but I'm not an expert so I might need help to get it right.

Big thanks to @ewallquist for initial testing!

DanielMalmgren commented 6 years ago

Yep. Works like charm here! Running 2.4.0.M4 on Debian armhf. Good work! I'd be very interested to see if this means the binding will also work in an arm64 environment, see if I get time testing that in the coming days.

Btw, does this mean that the binding includes the same jna that is already included in openhab-distro?

jannegpriv commented 6 years ago

Yep. Works like charm here! Running 2.4.0.M4 on Debian armhf. Good work! I'd be very interested to see if this means the binding will also work in an arm64 environment, see if I get time testing that in the coming days.

Nice to hear! :-)

Btw, does this mean that the binding includes the same jna that is already included in openhab-distro?

Yes, in this test jar-file it is present, however the class loader will load classes from jar-files in the /usr/share/openhab2/runtime/lib/boot/ first so it is not used at run time.

But it is unecessary to have it present in the jar-file since it now is included in the OH-platform, so I will try to remove it in coming builds.

DanielMalmgren commented 6 years ago

I had to try at once. I can confirm that it even works on arm64 now (without any 32 bits stuff involved whatsoever), which it has never done before. This is getting better by the hour :-D

jannegpriv commented 6 years ago

I need some help in how to not include the jna-4.5.2.jar in the binding.

Currently i've used the recommendations for 3rd party libraries to include the jna-4.5.2.jar in the binding. There is something called openHAB Target Platform that contains external jar-files but the version 1.0.33 does not contain jna.

Please @kaikreuzer guide me how to configure my Eclipse and Maven build to not include the jna-4.5.2.jar in the tellstick binding and instead use the JNA version that is included in the distro:-)

martinvw commented 6 years ago

I need some help in how to not include the jna-4.5.2.jar in the binding.

Maybe @kaikreuzer has an answer for that?

kaikreuzer commented 6 years ago

@jannegpriv Good question - I actually wasn't aware that you actively need to compile against it (I assumed its presence at runtime is enough).

It is probably easiest to include it in the target platform - I can take care of that. Just a quick question upfront: Do we only need the jna.jar or also the jna-platform.jar in the target platform?

jannegpriv commented 6 years ago

I'm not a JNA expert, but the Tellstick binding only needs the jna-4.5.2.jar. This thread indicates that it should be enough too. Please ping me when I can fetch an updated target platform! :-)

kaikreuzer commented 6 years ago

Done! All you need now is https://github.com/openhab/openhab-distro/pull/803.

jannegpriv commented 6 years ago

I managed to update the target platform in Eclipse to use 1.0.34 and the binding compiles fine in Eclipse after adding com.sun.java as a dependency/Imported Package in build.properties:

Import-Package: 
 com.google.common.collect,
 com.sun.jna,

and removing the jna-4.5.2.jar file from the local org.openhab.binding.tellstick/lib directory.

However the maven build fails since it uses the 1.0.33 version:

jannegpriv in /Users/jannegpriv/git/openhab2-master/git/openhab2-addons/addons/binding/org.openhab.binding.tellstick (3849-tellstick-jna-fix) (13 entries, 2 hidden)
$ mvn clean compile package 
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=256m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
[INFO] Scanning for projects...
Downloading from openhab-artifactory-snapshot: https://openhab.jfrog.io/openhab/libs-snapshot/org/openhab/pom-tycho/2.4.0-SNAPSHOT/maven-metadata.xml
Downloaded from openhab-artifactory-snapshot: https://openhab.jfrog.io/openhab/libs-snapshot/org/openhab/pom-tycho/2.4.0-SNAPSHOT/maven-metadata.xml (599 B at 90 B/s)
[WARNING] Could not transfer metadata org.openhab:pom-tycho:2.4.0-SNAPSHOT/maven-metadata.xml from/to p2-openhab-deps-repo (https://dl.bintray.com/openhab/p2/openhab-deps-repo/${ohdr.version}): Cannot access https://dl.bintray.com/openhab/p2/openhab-deps-repo/${ohdr.version} with type p2 using the available connector factories: BasicRepositoryConnectorFactory
Downloading from openhab-artifactory-snapshot: https://openhab.jfrog.io/openhab/libs-snapshot/org/openhab/pom/2.4.0-SNAPSHOT/maven-metadata.xml
Downloaded from openhab-artifactory-snapshot: https://openhab.jfrog.io/openhab/libs-snapshot/org/openhab/pom/2.4.0-SNAPSHOT/maven-metadata.xml (593 B at 311 B/s)
[WARNING] Could not transfer metadata org.openhab:pom:2.4.0-SNAPSHOT/maven-metadata.xml from/to p2-openhab-deps-repo (https://dl.bintray.com/openhab/p2/openhab-deps-repo/${ohdr.version}): Cannot access https://dl.bintray.com/openhab/p2/openhab-deps-repo/${ohdr.version} with type p2 using the available connector factories: BasicRepositoryConnectorFactory
...
...
[INFO] Fetching p2.index from https://dl.bintray.com/openhab/p2/openhab-deps-repo/1.0.33/ (173B)
[INFO] Fetching p2.index from https://dl.bintray.com/openhab/p2/openhab-deps-repo/1.0.33/ (173B)
[INFO] Adding repository https://dl.bintray.com/openhab/p2/openhab-deps-repo/1.0.33
[INFO] Resolving dependencies of MavenProject: org.openhab.binding:org.openhab.binding.tellstick:2.4.0-SNAPSHOT @ /Users/jannegpriv/git/openhab2-master/git/openhab2-addons/addons/binding/org.openhab.binding.tellstick/pom.xml
[INFO] {osgi.os=linux, osgi.ws=gtk, org.eclipse.update.install.features=true, osgi.arch=x86}
[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: org.openhab.binding.tellstick 2.4.0.qualifier
[ERROR]   Missing requirement: org.openhab.binding.tellstick 2.4.0.qualifier requires 'java.package; com.sun.jna 0.0.0' but it could not be found

How is the ohdr.version resolved? Seems to be set in the pom.xml for openhab-core. But I've not cloned that repo. @kaikreuzer What am I missing?

kaikreuzer commented 6 years ago

Sorry, my mistake, I forgot https://github.com/openhab/openhab-core/pull/427. I've just published the updated pom, so you can directly try again!

jannegpriv commented 6 years ago

Now the maven build runs fine, however when testing on my target platform running OH2.4M4 I get the following error:

2018-11-06 20:30:02.095 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.tellstick-2.4.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.tellstick [174]
  Unresolved requirement: Import-Package: com.sun.jna

A find in the /usr/share/openhab2 folder on my target platform yields:

openhab@openhab2:/usr/share/openhab2 $ find . -name '*.jar' |grep jna
./runtime/lib/boot/jna-4.5.2.jar
./runtime/lib/boot/jna-platform-4.5.2.jar
./runtime/system/net/java/dev/jna/jna-platform/4.5.2/jna-platform-4.5.2.jar
./runtime/system/net/java/dev/jna/jna/4.5.2/jna-4.5.2.jar

Hmm, /net/java/dev/jna ... Googling gives that the package name seems to have changed from com.sun.jna to net.java.dev.jna.

When I include the dependency/Imported Package in Eclipse I only find com.sun.jna when searching for jna.

Import-Package: 
 com.google.common.collect,
 com.sun.jna,

I think that it would work if the target runtime would refer to the package name net.java.dev.jna_4.5.2.jar so that I could use the package name net.java.dev.jna in the MANIFEST.MF file. @kaikreuzer What do you think?

kaikreuzer commented 6 years ago

If I read the SO answer correctly, the package name is com.sun.jna, while the maven group id is net.java.dev, so all should be fine as it is. I've also just checked that the file ./runtime/lib/boot/jna-4.5.2.jar contains com/sun/jna classes. I'm not sure why Karaf cannot resolve it, though. If this does not work, we could go and define a Karaf feature for JNA on which you could then depend.

jannegpriv commented 6 years ago

When I manually copy the jna-4.5.2.jar file to the /usr/share/openhab2/addons folder, karaf immediately resolves it. But why cannot karaf resolve it when it is placed in the following folders?

openhab@openhab2:/usr/share $ find . -name '*.jar'|grep jna
./openhab2/runtime/lib/boot/jna-4.5.2.jar
./openhab2/runtime/lib/boot/jna-platform-4.5.2.jar
./openhab2/runtime/system/net/java/dev/jna/jna-platform/4.5.2/jna-platform-4.5.2.jar
./openhab2/runtime/system/net/java/dev/jna/jna/4.5.2/jna-4.5.2.jar

@kaikreuzer Isn't for example the com.google.gson a similar external library, why does that gets resolved?

openhab@openhab2:/usr/share $ find . -name '*.jar'|grep gson
./openhab2/runtime/system/org/eclipse/smarthome/automation/org.eclipse.smarthome.automation.parser.gson/0.10.0.oh240M4/org.eclipse.smarthome.automation.parser.gson-0.10.0.oh240M4.jar
./openhab2/runtime/system/org/eclipse/orbit/bundles/com.google.gson/2.7.0.v20170129-0911/com.google.gson-2.7.0.v20170129-0911.jar
./openhab2/runtime/system/com/google/code/gson/gson/2.7/gson-2.7.jar
./openhab2/runtime/system/com/google/code/gson/gson/2.3.1/gson-2.3.1.jar

Since the original problem with the tellstick binding was caused by the addition of the jna-4.5.2.jar file to the /usr/share/openhab2/runtime/lib/boot/jna-4.5.2.jar, and that karaf then loaded that jar-file before the one that at that time was included in the tellstick binding, this indicates that it is not a problem with finding/loading the jar-file. More that the explicit addition of the com.sun.java as a dependency/Imported Package in build.properties:

Import-Package: 
 com.google.common.collect,
 com.sun.jna,

The MANIFEST.MF file in the jar-file contains a reference:

./META-INF/MANIFEST.MF:Import-Package: com.google.common.collect,com.sun.jna,org.apache.commo

I guess that that is parsed by karaf and then not being able to resolve it. What are our options to get this fixed?

jannegpriv commented 6 years ago

@kaikreuzer maybe I'll include the jna-4.5.2.jar file in the tellstick binding for now and we'll sort out the resolve issue at a later stage?

kaikreuzer commented 6 years ago

Sorry for my late reply @jannegpriv, but I am sick at the moment, so I cannot catch up with my todo list...

Just saw your PR, but I would very much suggest not to re-add the jar to the binding again - let's instead define a Karaf feature, which bundles the JNA jars and on which you can depend then; this should clearly remove the resolution problem and would even make the core distro a bit smaller again. If you do not know how to proceed, I can try to take care of this hopefully on the weekend.

jannegpriv commented 6 years ago

If you do not know how to proceed, I can try to take care of this hopefully on the weekend.

NP, I just want to complete this work since I will be away on vacation from middle of next week and I also guess that the release of 2.4 stable is not so far away either. Please ping ping me and give me instructions on how to proceed when you have had time to look into the karaf feature solution! :-)

kaikreuzer commented 6 years ago

Hey @jannegpriv, I have created a Karaf feature for JNA in https://github.com/openhab/openhab-core/pull/432 and adapted your PR to make use of that feature in https://github.com/jannegpriv/openhab2-addons/pull/1. You can simply merge this PR and it will become part of https://github.com/openhab/openhab2-addons/pull/4231. This should hopefully fix the issue!

jannegpriv commented 6 years ago

I merged your adaptations and successfully compiled a new jar-file. However tests on my target environment running OH2.4 M4 gives same error as before:

2018-11-18 01:34:56.808 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.tellstick-2.4.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.tellstick [268]
  Unresolved requirement: Import-Package: com.sun.jna

        at org.eclipse.osgi.container.Module.start(Module.java:444) ~[?:?]
        at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[?:?]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [10:org.apache.felix.fileinstall:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [10:org.apache.felix.fileinstall:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [10:org.apache.felix.fileinstall:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [10:org.apache.felix.fileinstall:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [10:org.apache.felix.fileinstall:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [10:org.apache.felix.fileinstall:3.6.4]

@kaikreuzer Do I have to test on latest snapshot when it includes your new karaf feature for jna or should it work on OH2.4 M4?

kaikreuzer commented 6 years ago

You'll need to test on the latest snapshot and probably better wait for https://github.com/openhab/openhab-distro/pull/810 to be merged as well.