Tellstick binding for OpenHab2

More problems with this binding, created new thread:

Thanks for your good work!

Hi!
I have been using the tellstick binding both on OH1.8 and now openHAB 2.2.0 Build #1109. The device is Tellstick DUO. I have both sensors and switches connected and they seem to work fine. Great job everybody that have contributed!

Now, I also have a Tellstick NET located far away, controling both switches and sensors. I have been able to connect that to OH using the tokens you request from Telldus.

My question is, can you connect both the DUO and the NET at the same time? I have tried it and it seems to work but it also seems like the things and items sometimes might get mixed up between the two and the connection is lost. It might also be due to pilot errorā€¦ As it is a bit of a hassle to get things back together I thought I might just ask if it is planned to work this way before I make any more experiments?

I personally have a Duo and a .Net running against the same Openhab2, seems
to work fine. However I am not using the .Net much. I might be a good idea
to define these as bridges in a thing file.
Jarle

Thanks Jarle!
Iā€™ll give it another try!
Gunnar

Hi all.
I just updated from snapshot 1103 to 1114 and something seems to be wrong with the Tellstick binding. The devices are UNINITIALIZED and the Tellstick Duo device is INITIALIZING.

First question: There is a setting on the gateway for location of the so file, is it supposed to point to the directory (/usr/lib) or the library file itself (/usr/lib/libtelldus-core.so.2)? Neither seems to workā€¦ Iā€™ve never seen this setting beforeā€¦

Secondly, anyone else got problems with this version and know whatā€™s wrong? I get the following in the log when restarting the binding:

20:00:42.587 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'tellstick:telldus-core:1' changed from INITIALIZING to UNINITIALIZED
20:00:42.591 [ERROR] [rnal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.dispose()' on 'org.openhab.binding.tellstick.internal.core.TelldusCoreBridgeHandler@6032bb': null
java.lang.NullPointerException: null
        at org.openhab.binding.tellstick.internal.core.TelldusCoreBridgeHandler.dispose(TelldusCoreBridgeHandler.java:81) [213:org.openhab.binding.tellstick:2.2.0.201712052342]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:157) [112:org.eclipse.smarthome.core:0.9.0.201712011551]
        at org.eclipse.smarthome.core.internal.common.TrackingCallable.call(TrackingCallable.java:45) [112:org.eclipse.smarthome.core:0.9.0.201712011551]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        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) [?:?]
20:00:42.716 [ERROR] [home.core.thing.internal.ThingManager] - Exception occurred while disposing handler of thing 'tellstick:telldus-core:1': null
java.lang.NullPointerException: null
        at org.openhab.binding.tellstick.internal.core.TelldusCoreBridgeHandler.dispose(TelldusCoreBridgeHandler.java:81) [213:org.openhab.binding.tellstick:2.2.0.201712052342]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:157) [112:org.eclipse.smarthome.core:0.9.0.201712011551]
        at org.eclipse.smarthome.core.internal.common.TrackingCallable.call(TrackingCallable.java:45) [112:org.eclipse.smarthome.core:0.9.0.201712011551]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        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) [?:?]
20:00:42.844 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'tellstick:telldus-core:1' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)
20:00:43.358 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'tellstick:telldus-core:1' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
20:00:48.361 [WARN ] [rnal.common.AbstractInvocationHandler] - Timeout of 5000ms exceeded while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.tellstick.internal.core.TelldusCoreBridgeHandler@5af8af'. Thread 'safeCall-27' (701) is in state 'RUNNABLE'
        at java.lang.Class.isArray(Native Method)
        at com.sun.jna.Function.isPrimitiveArray(Function.java:625)
        at com.sun.jna.Function.convertArgument(Function.java:498)
        at com.sun.jna.Function.invoke(Function.java:297)
        at com.sun.jna.Library$Handler.invoke(Library.java:212)
        at com.sun.proxy.$Proxy148.tdSensor(Unknown Source)
        at org.tellstick.device.TellstickSensor.getAllSensors(TellstickSensor.java:48)
        at org.openhab.binding.tellstick.internal.core.TelldusCoreBridgeHandler.rescanTelldusDevices(TelldusCoreBridgeHandler.java:136)
        at org.openhab.binding.tellstick.internal.core.TelldusCoreBridgeHandler.initialize(TelldusCoreBridgeHandler.java:111)
        at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:157)
        at org.eclipse.smarthome.core.internal.common.TrackingCallable.call(TrackingCallable.java:45)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        ...
20:00:48.650 [WARN ] [home.core.thing.internal.ThingManager] - Initializing handler for thing 'tellstick:telldus-core:1' takes more than 5000ms.

Also tried with debug log on, got nothing more useful.

Is tdtool working as expected ?, the timeout there is really unexpected. I will commit a fix to the nullpointer in dispose

Yep, no problem there. After a couple of OH restart the binding started fine as well. That was a couple of days ago, havenā€™t dared touching it since then.

Hello all,
Iā€™m totally new to both Linux and OpenHab, but I jumped right in to it anyway, unfortunately Iā€™m stuck with a problem when Iā€™m trying to activate the binding to Tellstick 2.2.0 I get a massive error log (the pasted part is not all), Iā€™m not sure if Iā€™m supposed to install anything else to the Raspberry or only the raspian and then activate the binding?
Do I need to do any installation for Tellstick beside the Openhab?

Have anyone of you old timers seen this type of issue before?

Appreciate any help

/Jocke

2017-12-27 22:30:50.249 [ERROR] [l.discovery.TellstickBridgeDiscovery] - Could not load telldus core, please make sure Telldus is installed and correct 32/64 bit java.

java.lang.UnsatisfiedLinkError: Unable to load library ā€˜telldus-coreā€™: Native library (linux-arm/libtelldus-core.so) not found in resource path (/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.diagnostic.boot-4.1.3.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.jaas.boot-4.1.3.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.main-4.1.3.jar:/usr/share/openhab2/runtime/lib/boot/org.osgi.core-6.0.0.jar)

You also need to have telldus-core installed, thatā€™s the software that contains the drivers for the Tellstick. Check http://developer.telldus.com/wiki/TellStick_installation_Linux. Probably the best for Raspian would be the repository installation found on http://developer.telldus.com/wiki/TellStickInstallationUbuntu

Daniel,
Thank you for your feedback, I will try, and see if I can manage that installation, the Linux part is for a windows user not that easy to understand.

Thanks again.

I wish you a happy new year

/Jocke

Hi, this link does not seem to work anymore.

I have done a new installation of OpenHab 2, but cannot get the ā€œbuilt-inā€ bundle to work.
I had this up and running earlier, but perhaps I installed the add on manually.

The version in latest Openhab2 should work fine, or use this

Need some help from you guys. I am trying to migrate my openhab instance to an Pine64 board and have struggled with getting Tellstick-core interface working. I wonder if you could give me some advice.

I am currently running Ubuntu 16.04 and while the board is 64-bit I have compiled the telldusd service myself which works great. The error I get is this from /var/log/openhab2/openhab.log:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.tellstick.JNA$CLibrary
	at org.tellstick.device.TellstickDevice.getDevices(TellstickDevice.java:245) ~[?:?]
	at org.openhab.binding.tellstick.internal.core.TelldusCoreBridgeHandler.rescanTelldusDevices(TelldusCoreBridgeHandler.java:135) ~[?:?]
	at org.openhab.binding.tellstick.internal.discovery.TellstickDiscoveryService.startScan(TellstickDiscoveryService.java:97) ~[?:?]
	at org.eclipse.smarthome.config.discovery.AbstractDiscoveryService.startScan(AbstractDiscoveryService.java:222) ~[?:?]
	at org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.startScan(DiscoveryServiceRegistryImpl.java:409) ~[?:?]
	at org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.startScans(DiscoveryServiceRegistryImpl.java:385) ~[?:?]
	at org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.startScan(DiscoveryServiceRegistryImpl.java:241) ~[?:?]
	at org.eclipse.smarthome.io.rest.core.internal.discovery.DiscoveryResource.scan(DiscoveryResource.java:97) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]...

I have installed Jnalib eg. apt-get install libjna-java this is needed right?
(@jarlebh could you give some direction here?)

My Java version is currently :

[19:51:59] pine64@pine64:~$ java -d64 -version
openjdk version "1.8.0_152"
OpenJDK Runtime Environment (Zulu Embedded 8.25.0.79-linux-aarch64) (build 1.8.0_152-b79)
OpenJDK 64-Bit Server VM (Zulu Embedded 8.25.0.79-linux-aarch64) (build 25.152-b79, mixed mode, Evaluation)

[19:52:02] pine64@pine64:~$ java -d32 -version
Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.

As I understod it the 64/32bit versions of telldus service and java must match to have JNA work.
Is something else needed?

I would guess that the java process canā€™t find the telldus core so file. Is this file in the default location ? There is an config option to point to another folder, but I have never tested it myself.

Jarle

1 Like

Thanks for the input got me in the right direction.

Found a solution today. Reinstalled the whole machine with 32-bit library for both java and telldusd. If someone else need a guide for installing tellstick-core on PINE64 do this:

  1. Install Java Zulu the way its done in openhabian (link here). The important stuff is sudo dpkg --add-architecture armhf and having the correct package in your source.list. The script solves all this so just use openhabian for that.

  2. This script worked for me while installing tellstick-core:

sudo dpkg --add-architecture armhf
wget -O - http://download.telldus.se/debian/telldus-public.key | apt-key add -
echo "deb http://download.telldus.com/debian/ stable main" > /etc/apt/sources.list.d/telldus-stable.list
apt update
apt -y install libc6:armhf libncurses5:armhf libstdc++6:armhf   libc-bin:armhf
apt -y install libjna-java telldus-core

(3. Optional) Create a new startup script for systemd. First off locate where telldusd is, either /usr/bin or /usr/sbin. Then create a new service definition: /lib/systemd/system/telldusd.service.

[Unit]
Description=Tellstick service daemon
After=multi-user.target

[Service]
Type=forking
ExecStart=/usr/sbin/telldusd

[Install]
WantedBy=multi-user.target

After creating the script run sudo systemctl daemon-reload as well as sudo systemctl start telldusd.service.

@jarlebh Have you looked at adding Tellstick Local API support? It seems pretty straight forward. Hereā€™s a node version that Iā€™m currently using (using both live & local api): https://github.com/mifi/telldus-api

1 Like

I donā€™t have any device with the local api, so I really donā€™t have any incentive to do that. :wink:

Iā€™m using the Tellstick binding for controlling a subset of my lights at home.

I have a rule that executes the following where the top three devices are controlled via TellstickDuo.

 if(dark.state == ON){
      hallway_bureau_light.sendCommand(ON)
      corner_light.sendCommand(ON)
      tv_light.sendCommand(ON)
      workroom_desk.sendCommand(30)
    }

However it seems that most of the times the rule triggers only 1 or 2 of the items are actually turned on although the state in OpenHAB logs and phone app is changed. In my mind this would indicate signal problems but I can count the number of times this has happened when manually switching a light using two fingers.

Therefore it seems unbelievable that this is a distance or interference issue. Is this a known error? Any way to fix it? Adding a delay is the one thing I can possibly think of trying (not preferred of course).

Edit: Should probably clarify now that Telldus has updated its product series. Using Tellstick Duo 433 Mhz :slight_smile:

Have you tried changing the ā€œrepeatā€ setting on the device Things? I have it set to 2 on most of my devices, but higher on ones that sometimes donā€™t reactā€¦

This seems to have helped. I have not experienced that many problems lately.

While weā€™re at it, I have a delay (in the UIā€™s, habpanel, app etc.) when flipping switches that are configured with the tellstick binding.

I switch it, it switches back and then after a few seconds it actually switches. Is this due to the binding reading the tdtool status? Does anyone know how one could eliminate this? My only idea is to create an extra switch item + rule for all items but that feels like a mess.