Tinkerforge: Symbolic Names in 1.8.1 don't seem to work

H all,

I’m having some problems to get the Tikerforge Binding to behave as I want it to.
I have a Tinkerforge weatherstation kit with a Wifi Master extension, and I’m using that together with the 1.8.1 binding.

It works, if I remove all but the barest config from openhab.cfg and put the uid’s in my items, such as:

openhab.cfg:

tinkerforge:hosts=192.168.199.121:4223

site.items

Number TFW_temperature “Temperature [%.2f °C]” (TFW) {tinkerforge=“uid=vN7, subid=temperature”}

It should have the same effect, if I do:

openhab.cfg:

tinkerforge:hosts=192.168.199.121:4223

tinkerforge:temperature.uid=vN7
tinkerforge:temperature.type=barometer_temperature
tinkerforge:temperature.subid=temperature

site.items:

Number TFW_temperature “Temperature [%.2f °C]” (TFW) {tinkerforge=“name=temperature”}

However, the second example doesn’t work at all.

Also, according to the documentation, I should be able to influence the polling of the tinkersorge sensors by putting

openhab.cfg:

tinkerforge.refresh=300000

Also, this seems to be ignored, and I get traffic every second.

Am I doing anything wrong, or is this broken?

Cheers.

Thomas

Doc error I just fixed. Should be tinkerforge:refresh=300000

ok, corrected that. All the devices that support callbackPeriod still seems to be sending data every second. And I don’t seem to be able to add configuration for them to openhab.cfg, or the binding will jsut stop working.

This is what I have configured in the setup with symbolic names:

openhab.cfg:

tinkerforge:hosts=192.168.199.121:4223
tinkerforge:refresh=300000

tinkerforge:lcddisplay.uid=vBL
tinkerforge:lcddisplay.type=bricklet_LCD20x4

tinkerforge:lcdbacklight.uid=vBL
tinkerforge:lcdbacklight.subid=backlight
tinkerforge:lcdbacklight.type=backlight

tinkerforge:lcdbutton0.uid=vBL
tinkerforge:lcdbutton0.subid=button0
tinkerforge:lcdbutton0.type=lcd_button

tinkerforge:lcdbutton1.uid=vBL
tinkerforge:lcdbutton1.subid=button1
tinkerforge:lcdbutton1.type=lcd_button

tinkerforge:lcdbutton2.uid=vBL
tinkerforge:lcdbutton2.subid=button2
tinkerforge:lcdbutton2.type=lcd_button

tinkerforge:lcdbutton3.uid=vBL
tinkerforge:lcdbutton3.subid=button3
tinkerforge:lcdbutton3.type=lcd_button
tinkerforge:lcdbutton3.tactile=True

tinkerforge:alight.uid=uMB
tinkerforge:alight.type=bricklet_ambient_lightv2
tinkerforge:alight.illuminanceRange=6
tinkerforge:alight.integrationTime=7
tinkerforge:alight.callbackPeriod=300000
tinkerforge:alight.threshold=0

tinkerforge:barometer.uid=vN7
tinkerforge:barometer.type=bricklet_barometer
tinkerforge:barometer.callbackPeriod=300000
tinkerforge:barometer.threshold=0

tinkerforge:temperature.uid=vN7
tinkerforge:temperature.type=barometer_temperature
tinkerforge:temperature.subid=temperature

tinkerforge:humidity.uid=xvJ
tinkerforge:humidity.type=bricklet_humidity
tinkerforge:humidity.callbackPeriod=300000
tinkerforge:humidity.threshold=0

site.items:

Number TFW_illuminance “Helligkeit [%.0f Lux]” (TFW) {tinkerforge=“name=alight”}
Number TFW_temperature “Temperatur [%.2f °C]” (TFW) {tinkerforge=“name=temperature”}
Number TFW_pressure “Luftdruck [%.1f hPA]” (TFW) {tinkerforge=“name=barometer”}
Number TFW_humidity “rel. Luftfeuchte [%.1f %%]” (TFW) {tinkerforge=“name=humidity”}
String TFW_LCD “LCD” { tinkerforge=“name=lcddisplay”}
Switch TFW_LCDBacklight “LCD Hintergrundbeleuchtung” { tinkerforge=“name=lcdbacklight”}
Switch TFW_Button0 “Button0: Hintergrundbeleuchtung” { tinkerforge=“name=lcdbutton0”}
Switch TFW_Button1 “Button1” { tinkerforge=“name=lcdbutton1”}
Switch TFW_Button2 “Button2” { tinkerforge=“name=lcdbutton2”}
Switch TFW_Button3 “Button3” { tinkerforge=“name=lcdbutton3”}

When I change the config of the items to point to the symbolic names instead of the uid, I can see that the log output of my running oipenhab throws a null pointer exception for every item thus modified.

Could you provide this log output to try to diagnose the cause?

Sure. This is my config when I start openhab.cfg (just one item highlighted to shorten the output):

site.items:
Number TFW_illuminance “Helligkeit [%.0f Lux]” (TFW) {tinkerforge=“uid=uMB, illuminanceRange=6, integrationTime=7, callbackPeriod=300000, threshold=0”}

openhab.cfg:
tinkerforge:hosts=192.168.199.121:4223
tinkerforge:refresh=300000
tinkerforge:alight.uid=uMB
tinkerforge:alight.type=bricklet_ambient_lightv2
tinkerforge:alight.illuminanceRange=6
tinkerforge:alight.integrationTime=7
tinkerforge:alight.callbackPeriod=300000
tinkerforge:alight.threshold=0

The debug log shows:

07:39:22.710 [DEBUG] [i.internal.GenericItemProvider:341 ] - Start processing binding configuration of Item ‘TFW_illuminance (Type=NumberItem, State=Uninitialized)’ with ‘TinkerforgeGenericBindingProvider’ reader.
07:39:22.712 [DEBUG] [kerforgeGenericBindingProvider:81 ] - token: uid=uMB
07:39:22.713 [DEBUG] [kerforgeGenericBindingProvider:81 ] - token: illuminanceRange=6
07:39:22.713 [DEBUG] [kerforgeGenericBindingProvider:81 ] - token: integrationTime=7
07:39:22.713 [DEBUG] [kerforgeGenericBindingProvider:81 ] - token: callbackPeriod=300000
07:39:22.719 [DEBUG] [kerforgeGenericBindingProvider:81 ] - token: threshold=0
07:39:24.982 [DEBUG] [.t.internal.TinkerforgeBinding:194 ] - TFINIT connectModel called
07:39:24.987 [DEBUG] [o.b.t.i.c.ConfigurationHandler:179 ] - CONFIG key:value alight.callbackPeriod : 300000
07:39:24.996 [DEBUG] [o.b.t.i.c.ConfigurationHandler:179 ] - CONFIG key:value alight.illuminanceRange : 6
07:39:24.996 [DEBUG] [o.b.t.i.c.ConfigurationHandler:179 ] - CONFIG key:value alight.integrationTime : 7
07:39:24.996 [DEBUG] [o.b.t.i.c.ConfigurationHandler:179 ] - CONFIG key:value alight.threshold : 0
07:39:24.996 [DEBUG] [o.b.t.i.c.ConfigurationHandler:179 ] - CONFIG key:value alight.type : bricklet_ambient_lightv2

Then I change my site.items to:

Number TFW_illuminance “Helligkeit [%.0f Lux]” (TFW) {tinkerforge=“name=alight”}

And the corresponding output is:

07:41:05.357 [DEBUG] [kerforgeGenericBindingProvider:81 ] - token: name=alight
07:41:05.357 [DEBUG] [.t.internal.TinkerforgeBinding:657 ] - ITEMUPDATE bindingChanged item TFW_illuminance
07:41:05.361 [ERROR] [AbstractGenericBindingProvider:120 ] - Binding org.openhab.binding.tinkerforge.internal.TinkerforgeBinding threw an exception:
java.lang.NullPointerException: null
at org.openhab.binding.tinkerforge.internal.TinkerforgeBinding.getDeviceIdsForDeviceName(TinkerforgeBinding.java:765) ~[na:na]
at org.openhab.binding.tinkerforge.internal.TinkerforgeBinding.updateItemValues(TinkerforgeBinding.java:633) ~[na:na]
at org.openhab.binding.tinkerforge.internal.TinkerforgeBinding.bindingChanged(TinkerforgeBinding.java:658) ~[na:na]
at org.openhab.model.item.binding.AbstractGenericBindingProvider.notifyListeners(AbstractGenericBindingProvider.java:118) [org.openhab.model.item_1.8.1.jar:na]
at org.openhab.model.item.binding.AbstractGenericBindingProvider.addBindingConfig(AbstractGenericBindingProvider.java:112) [org.openhab.model.item_1.8.1.jar:na]
at org.openhab.binding.tinkerforge.internal.TinkerforgeGenericBindingProvider.processBindingConfiguration(TinkerforgeGenericBindingProvider.java:103) [bundlefile:na]
at org.openhab.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:348) [org.openhab.model.item_1.8.1.jar:na]
at org.openhab.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:324) [org.openhab.model.item_1.8.1.jar:na]
at org.openhab.model.item.internal.GenericItemProvider.processBindingConfigsFromModel(GenericItemProvider.java:171) [org.openhab.model.item_1.8.1.jar:na]
at org.openhab.model.item.internal.GenericItemProvider.modelChanged(GenericItemProvider.java:390) [org.openhab.model.item_1.8.1.jar:na]
at org.openhab.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:159) [org.openhab.model.core_1.8.1.jar:na]
at org.openhab.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:100) [org.openhab.model.core_1.8.1.jar:na]
at org.openhab.model.core.internal.folder.FolderObserver.checkFolder(FolderObserver.java:142) [org.openhab.model.core_1.8.1.jar:na]
at org.openhab.model.core.internal.folder.FolderObserver.run(FolderObserver.java:99) [org.openhab.model.core_1.8.1.jar:na]

On a sidenote:
For my backlight configuration, I get:

openhab.cfg:

tinkerforge:lcdbacklight.uid=vBL
tinkerforge:lcdbacklight.subid=backlight
tinkerforge:lcdbacklight.type=backlight

log output:

07:39:25.042 [DEBUG] [o.b.t.i.c.ConfigurationHandler:148 ] - deviceConfig {ohId=lcdbacklight, subid=backlight, uid=vBL, type=backlight}
07:39:25.046 [DEBUG] [o.b.t.i.c.ConfigurationHandler:699 ] - CONFIG setting no tfConfig device_type backlight
07:39:25.047 [DEBUG] [o.b.t.i.c.ConfigurationHandler:723 ] - *** uid is “vBL”

It seems that the config is not recognized, although it should be correct, according to the binding documentation.

Kind regards,

Thomas

Hi Thomas,

I’ve added a note to a slightly related issue because both that issue and this one related to unexpected NullPointerExceptions in the binding code. I think if the root cause of the NPE is fixed, then your configuration should (hopefully!) start to work.

Thanks for reporting this issue. I will soon look at it.

It seems there is another issue with the tinkerforge binding (or it might just be a followup symptom:

Since I am not able to set the parameters (Range and integration time) for the ambient light sensor through the config file, I need to use the Brick Viewer and set the parameters manually. In my case, I need to set integration time to 50ms and range to unlimited or the sensor will be saturated throughout the day.

When I do this, the Tinkerforge binding reports the illuminance as being a factor of 10 too high. This might be due to the mismatch in what the binding thinks are set as parameters and what I did through the brick viewer, or it might be a general calculation error.

If there is a fix for the first issue (symbolic names and the setting of parameters through openhab.cfg), I’ll gladly have a go at testing this behaviour with the ambient light bricklet.

Cheers,

Thomas

Hi @tkuehne,

I think that’s not related to the symbolic names issue. If you want to integrate the Ambient Light V2 Bricklet you have to use the bricklet_ambient_lightv2 type which is described here: https://github.com/openhab/openhab/wiki/Tinkerforge-Binding#ambient-light-bricklet-v2 .
You should be able to configure range and integration time within openhab.cfg.

Can you give it a try?

Thanks,
Theo

Hi Theo,

thanks for following up. I can’t test it, because the display of data will stop if I configure any symbolic names in opnhab.cfg. So, for the moment, I think this requires a fix first, before this can be analyzed further.