New features in Ikea Tradfri binding are not visible

I recognized new features for tradfri binding in the source at
/master/extensions/binding/org.eclipse.smarthome.binding.tradfri

Thing types 0107, 0820 and 830

additional features_2017-11-09_223900
I updated openhabian just now to build openHAB 2.2.0~20171109111930-1 (Build #1075)
From paperUI I deinstalled tradfri binding and installed it again. But the new types are not all visible in the paperUI

I have the controller for the Color bulb and another for 30x30 panel.
I can see in my Id’s that the id 65540 ( maybe the Color controller) is existent on the gateway, but does not show up in the inbox after a new Things search.

I also have a motion detector package with a 1000lm bulb but it is not installed.

Did I made a fault or are the new features not in the 1075 build?

p.s It was a pleasure for me reading the code.

Dear v.k.,

those changes weren’t available in the #1075 snapshot of OH2, because the TRADFRI binding is located in the ESH sources. There was a new build some hours ago based on the latest snapshot of the ESH framework of this afternoon. Please update and try again.

See https://github.com/eclipse/smarthome/wiki/ESH-used-in-openHAB and Updated ESH bundles in 2.2.0-SNAPSHOT - Important for TRADFRI users - this should answer all questions :slight_smile:

Dear Christoph

I made a second installation on a win10 machine following the developer guide Basic IDE-Setup up . (very good description):clap:
it works.

After changing the run configuration for tradfri and org.eclipse.smarthome.config.discovery.mdns (there was an error message in the log) , the tradfri binding was available and I could see all the new features.:smiley:

Detected my bridge and two test bulbs. :slightly_smiling_face:
small issue:
After a new start the bulbs can not be switched from paperUI.
I have to remove the bulbs from the things , but they appear one minute later in the inbox. Adding them as things makes them switchable again in paperUI

Every minute I get a onUpDate response in the log with a lot of text, makes it hard to watch the log.

I am glad to hear that you got it working. My bulbs are working fine, even in Paper UI. Did you define any item for the RGB bulb manually in a *.items file? Or do you only use the Paper UI items for controlling the bulb?

Concerning the “onUpDate response”: Do you have DEBUG logging enabled for the Tradfri binding?

I use Paper UI for all tradfri and homematic things.

I did not define a item for the rgb bulb.

maybe a silly question: where to enable/disable DEBUG logging for the tradfri binding?
I did not found it in the source.
There is something in the plugins configuration, but I’m not familiar with this settings:
Default Start level is 4 and tradfri is default, default

today I restarted the openHAB_runtime and all tradfri and homematic things were lost.
I had to setup both gateways .

After a restart a tradfri panel or bulb is not under control from the paper UI.
Deleting and adding from the inbox solves this problem.

I started openHAB_runtime one day later.
all tradfri and homematic things got restored.
Control of the trafri bulbs did not work.
Deleting and adding from the inbox solves this problem.

Maybe there was a shutdown problem yesterday.
I used “terminate” to stop the lauch.
Is there another way to stop execution of the launch

Have a look here: http://docs.openhab.org/administration/logging.html

I have no clue what happens in your environment. Do you have enabled “Auto Approve” for Inbox or “Simple Mode” for item linking?

changing the smarthome entry and the openHAB entry to INFO in the file Infrastructure–>launch–>home–>logback_debug.xml solved the problem.
Now it’s easier to locale possible problems.

I have Simple Mode enabled. “Auto Approve” added all unwanted Homematic Things to the UIControl, but did not solve the startup problem for tradfri

As the problem does not show up on the raspberry it may be a initialisation problem of the bulbs and panels caused by a timing problem on my windows machine which is rather fast (I7).
The homematic components do not show such a behavior.

There are a lot of NullPointerExceptions at startup in the log. I do not add them all
I will later edit the post and remove the logs.

this code throws the null pointer exception :
in: TradfriLightHandler.handleCommand
coapClient.asyncGet(this);
so the coapClient may be null?
I edited the code and added some null-pointer checking.
the coap client is obviously not initialized.
I set a breakpoint at TradfriThingHandler.initialize at the first line of case Online:
this bp is never reached.
I assume that initialize for the panel or the bulbs is never executed with bridge.status() online
Later on the gateway is discovered per udp and then the first CoAp response happens.
but then its not added as a inbox entry, as it is present in the ThingRegistry

2017-11-15 22:27:12.554 [DEBUG] [o.e.s.b.t.i.TradfriCoapHandler:56   ] - CoAP response
options: {"Content-Format":"application/json", "Max-Age":604800}
payload: {"9019":1,"9001":"Panel_01","9002":1510082837,"3":{"0":"IKEA of Sweden","6":1,"1":"FLOALT panel WS 30x30","2":"","3":"1.2.217"},"9020":1510758458,"9003":65540,"9054":0,"5750":2,"3311":[{"5850":0,"5851":254,"5711":250,"5709":24841,"5710":24593,"5706":"f5faf6","9003":0}]} 
2017-11-15 22:27:12.554 [DEBUG] [.s.b.t.h.TradfriGatewayHandler:294  ] - requestDeviceDetails response: {"9019":1,"9001":"Panel_01","9002":1510082837,"3":{"0":"IKEA of Sweden","6":1,"1":"FLOALT panel WS 30x30","2":"","3":"1.2.217"},"9020":1510758458,"9003":65540,"9054":0,"5750":2,"3311":[{"5850":0,"5851":254,"5711":250,"5709":24841,"5710":24593,"5706":"f5faf6","9003":0}]}
2017-11-15 22:27:12.554 [DEBUG] [.t.i.d.TradfriDiscoveryService:144  ] - Adding device tradfri:0220:1c757dc6:65540 to inbox
2017-11-15 22:27:12.555 [DEBUG] [s.c.d.internal.PersistentInbox:198  ] - Discovery result with thing 'tradfri:0220:1c757dc6:65540' not added as inbox entry. It is already present as thing in the ThingRegistry.

I have a longer debug log which I do not want to put in the post. May I send it per pm?

This is what I found before detailed debugging

2017-11-15 14:53:51.515 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:gateway:a7caxXxX' updated: UNKNOWN
2017-11-15 14:53:51.518 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:gateway:a7caxXxX' changed from INITIALIZING to UNKNOWN
2017-11-15 14:53:51.526 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: INITIALIZING
2017-11-15 14:53:51.535 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2017-11-15 14:53:51.539 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: OFFLINE (BRIDGE_OFFLINE): Tradfri gateway offline 'UNKNOWN'
2017-11-15 14:53:51.542 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0100:a7caxXxX:65538' updated: INITIALIZING
2017-11-15 14:53:51.548 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0100:a7caxXxX:65538' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2017-11-15 14:53:51.565 [ERROR] [.c.thing.link.ThingLinkManager:283  ] - Exception occurred while informing handler: nulljava.lang.NullPointerException: null
	at org.eclipse.smarthome.binding.tradfri.handler.TradfriLightHandler.handleCommand(TradfriLightHandler.java:119)
	at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.channelLinked(BaseThingHandler.java:205)
	at org.eclipse.smarthome.core.thing.link.ThingLinkManager.informHandlerAboutLinkedChannel(ThingLinkManager.java:281)
	at org.eclipse.smarthome.core.thing.link.ThingLinkManager.receiveTypedEvent(ThingLinkManager.java:321)
	at org.eclipse.smarthome.core.thing.link.ThingLinkManager.receiveTypedEvent(ThingLinkManager.java:1)
	at org.eclipse.smarthome.core.events.AbstractTypedEventSubscriber.receive(AbstractTypedEventSubscriber.java:50)
	at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:207)
	at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:1)
	at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:181)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
.....
2017-11-15 14:53:51.611 [ERROR] [.c.thing.link.ThingLinkManager:283  ] - Exception occurred while informing handler: nulljava.lang.NullPointerException: null
	at org.eclipse.smarthome.binding.tradfri.handler.TradfriControllerHandler.handleCommand(TradfriControllerHandler.java:70)
	at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.channelLinked(BaseThingHandler.java:205)
	at org.eclipse.smarthome.core.thing.link.ThingLinkManager.informHandlerAboutLinkedChannel(ThingLinkManager.java:281)
	at org.eclipse.smarthome.core.thing.link.ThingLinkManager.receiveTypedEvent(ThingLinkManager.java:321)
	at org.eclipse.smarthome.core.thing.link.ThingLinkManager.receiveTypedEvent(ThingLinkManager.java:1)
	at org.eclipse.smarthome.core.events.AbstractTypedEventSubscriber.receive(AbstractTypedEventSubscriber.java:50)
	at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:207)
	at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:1)
	at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:181)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

2017-11-15 14:53:51.611 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0830:a7caxXxX:65539' changed from INITIALIZING to OFFLINE (BRIDGE_OFFLINE): Tradfri gateway offline 'UNKNOWN'

!ENTRY org.eclipse.osgi 4 0 2017-11-15 14:53:53.421
!MESSAGE Bundle initial@reference:file:plugins/org.apache.httpcomponents.httpclient_4.5.2.v20170210-0925.jar was not resolved.

!ENTRY org.eclipse.osgi 4 0 2017-11-15 14:53:53.429
!MESSAGE Bundle initial@reference:file:plugins/org.apache.httpcomponents.httpclient_4.5.2.v20170210-0925.jar was not resolved.
2017-11-15 14:53:54.370 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:gateway:a7caxXxX' updated: ONLINE
2017-11-15 14:53:54.372 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:gateway:a7caxXxX' changed from UNKNOWN to ONLINE
2017-11-15 14:53:54.373 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0100:a7caxXxX:65538' updated: ONLINE
2017-11-15 14:53:54.380 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0100:a7caxXxX:65538' changed from OFFLINE (BRIDGE_OFFLINE): Tradfri gateway offline 'UNKNOWN' to ONLINE
2017-11-15 14:53:54.381 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0210:a7caxXxX:65537' updated: ONLINE
2017-11-15 14:53:54.386 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0210:a7caxXxX:65537' changed from OFFLINE (BRIDGE_OFFLINE): Tradfri gateway offline 'UNKNOWN' to ONLINE
2017-11-15 14:53:54.389 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: ONLINE
2017-11-15 14:53:54.414 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' changed from OFFLINE (BRIDGE_OFFLINE): Tradfri gateway offline 'UNKNOWN' to ONLINE
2017-11-15 14:53:54.416 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0830:a7caxXxX:65536' updated: ONLINE
2017-11-15 14:53:54.421 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0830:a7caxXxX:65536' changed from OFFLINE (BRIDGE_OFFLINE): Tradfri gateway offline 'UNKNOWN' to ONLINE
2017-11-15 14:53:54.422 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0830:a7caxXxX:65539' updated: ONLINE
2017-11-15 14:53:54.427 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0830:a7caxXxX:65539' changed from OFFLINE (BRIDGE_OFFLINE): Tradfri gateway offline 'UNKNOWN' to ONLINE

on PaperUI Control I see a Panel_01 control, but no on/off switch in this control:
If I move Helligkeit or Farbtemperatur , I get a NullPointerException with a Stacktrace
The Helligkeit Slider is updated on the control, but no reaction of the physical panel.

1.2 2017-11-15 13:47:14.601 [ERROR] [s.c.t.i.p.DefaultMasterProfile:62   ] - Exception occurred while calling handler: java.lang.NullPointerExceptionjava.util.concurrent.ExecutionException: java.lang.NullPointerException
	at org.eclipse.smarthome.core.common.SafeMethodCaller.executeDirectly(SafeMethodCaller.java:220)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:189)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67)
	at org.eclipse.smarthome.core.thing.internal.profiles.DefaultMasterProfile.onCommand(DefaultMasterProfile.java:51)
	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.lambda$2(CommunicationManager.java:223)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
Caused by: java.lang.NullPointerException: null
	at org.eclipse.smarthome.binding.tradfri.handler.TradfriThingHandler.set(TradfriThingHandler.java:119)
	at org.eclipse.smarthome.binding.tradfri.handler.TradfriThingHandler.set(TradfriThingHandler.java:123)
	at org.eclipse.smarthome.binding.tradfri.handler.TradfriLightHandler.setBrightness(TradfriLightHandler.java:94)
	at org.eclipse.smarthome.binding.tradfri.handler.TradfriLightHandler.handleBrightnessCommand(TradfriLightHandler.java:140)
	at org.eclipse.smarthome.binding.tradfri.handler.TradfriLightHandler.handleCommand(TradfriLightHandler.java:125)
	at org.eclipse.smarthome.core.thing.internal.profiles.DefaultMasterProfile$1.call(DefaultMasterProfile.java:54)
	at org.eclipse.smarthome.core.thing.internal.profiles.DefaultMasterProfile$1.call(DefaultMasterProfile.java:1)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.executeDirectly(SafeMethodCaller.java:218)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:189)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67)

2017-11-15 13:47:14.602 [INFO ] [arthome.event.ItemCommandEvent:47   ] - Item 'tradfri_0220_a7caxXxX_65540_brightness' received command 3
2017-11-15 13:47:14.605 [INFO ] [smarthome.event.ItemStateEvent:47   ] - tradfri_0220_a7caxXxX_65540_brightness updated to 3
2017-11-15 13:47:14.605 [INFO ] [s.event.ItemStateChangedEvent :47   ] - tradfri_0220_a7caxXxX_65540_brightness changed from 2 to 3
2017-11-15 13:47:15.038 [ERROR] [s.c.t.i.p.DefaultMasterProfile:62   ] - Exception occurred while calling handler: java.lang.NullPointerExceptionjava.util.concurrent.ExecutionException: java.lang.NullPointerException
	at org.eclipse.smarthome.core.common.SafeMethodCaller.executeDirectly(SafeMethodCaller.java:220)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:189)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67)
	at org.eclipse.smarthome.core.thing.internal.profiles.DefaultMasterProfile.onCommand(DefaultMasterProfile.java:51)
	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.lambda$2(CommunicationManager.java:223)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
Caused by: java.lang.NullPointerException: null
	at org.eclipse.smarthome.binding.tradfri.handler.TradfriThingHandler.set(TradfriThingHandler.java:119)
	at org.eclipse.smarthome.binding.tradfri.handler.TradfriThingHandler.set(TradfriThingHandler.java:123)
	at org.eclipse.smarthome.binding.tradfri.handler.TradfriLightHandler.setBrightness(TradfriLightHandler.java:94)
	at org.eclipse.smarthome.binding.tradfri.handler.TradfriLightHandler.handleBrightnessCommand(TradfriLightHandler.java:140)
	at org.eclipse.smarthome.binding.tradfri.handler.TradfriLightHandler.handleCommand(TradfriLightHandler.java:125)
	at org.eclipse.smarthome.core.thing.internal.profiles.DefaultMasterProfile$1.call(DefaultMasterProfile.java:54)
	at org.eclipse.smarthome.core.thing.internal.profiles.DefaultMasterProfile$1.call(DefaultMasterProfile.java:1)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.executeDirectly(SafeMethodCaller.java:218)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:189)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67)

2017-11-15 13:47:15.038 [INFO ] [arthome.event.ItemCommandEvent:47   ] - Item 'tradfri_0220_a7caxXxX_65540_brightness' received command 9
2017-11-15 13:47:15.040 [INFO ] [smarthome.event.ItemStateEvent:47   ] - tradfri_0220_a7caxXxX_65540_brightness updated to 9
2017-11-15 13:47:15.041 [INFO ] [s.event.ItemStateChangedEvent :47   ] - tradfri_0220_a7caxXxX_65540_brightness changed from 3 to 9

removing the panel_01

2017-11-15 13:56:19.210 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: REMOVING
2017-11-15 13:56:19.210 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' changed from ONLINE to REMOVING
2017-11-15 13:56:19.214 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: REMOVED
2017-11-15 13:56:19.217 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' changed from REMOVING to REMOVED
2017-11-15 13:56:19.230 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: UNINITIALIZED
2017-11-15 13:56:19.235 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' changed from REMOVED to UNINITIALIZED
2017-11-15 13:56:19.239 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: UNINITIALIZED (HANDLER_MISSING_ERROR)
2017-11-15 13:56:19.240 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' changed from REMOVED to UNINITIALIZED (HANDLER_MISSING_ERROR)
2017-11-15 13:56:19.241 [INFO ] [rthome.event.ThingRemovedEvent:47   ] - Thing 'tradfri:0220:a7caxXxX:65540' has been removed.
2017-11-15 13:56:19.242 [INFO ] [arthome.event.ItemRemovedEvent:47   ] - Item 'tradfri_0220_a7caxXxX_65540_brightness' has been removed.
2017-11-15 13:56:19.243 [INFO ] [nt.ItemChannelLinkRemovedEvent:47   ] - Link 'tradfri_0220_a7caxXxX_65540_brightness => tradfri:0220:a7caxXxX:65540:brightness' has been removed.
2017-11-15 13:56:19.255 [INFO ] [arthome.event.ItemRemovedEvent:47   ] - Item 'tradfri_0220_a7caxXxX_65540_color_temperature' has been removed.
2017-11-15 13:56:19.256 [INFO ] [nt.ItemChannelLinkRemovedEvent:47   ] - Link 'tradfri_0220_a7caxXxX_65540_color_temperature => tradfri:0220:a7caxXxX:65540:color_temperature' has been removed.

It is automaticallay added to the inbox after a short time

2017-11-15 13:56:47.122 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: INITIALIZING
2017-11-15 13:56:47.127 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' changed from UNINITIALIZED to INITIALIZING
2017-11-15 13:56:47.129 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: UNKNOWN
2017-11-15 13:56:47.132 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' changed from INITIALIZING to UNKNOWN
2017-11-15 13:56:47.134 [INFO ] [smarthome.event.ItemAddedEvent:47   ] - Item 'tradfri_0220_a7caxXxX_65540_brightness' has been added.
2017-11-15 13:56:47.136 [INFO ] [vent.ItemChannelLinkAddedEvent:47   ] - Link 'tradfri_0220_a7caxXxX_65540_brightness-tradfri:0220:a7caxXxX:65540:brightness' has been added.
2017-11-15 13:56:47.137 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: ONLINE
2017-11-15 13:56:47.152 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' changed from UNKNOWN to ONLINE
2017-11-15 13:56:47.154 [INFO ] [smarthome.event.ItemStateEvent:47   ] - tradfri_0220_a7caxXxX_65540_brightness updated to 0
2017-11-15 13:56:47.155 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: ONLINE
2017-11-15 13:56:47.156 [INFO ] [smarthome.event.ItemStateEvent:47   ] - tradfri_0220_a7caxXxX_65540_brightness updated to 0
2017-11-15 13:56:47.157 [INFO ] [s.event.ItemStateChangedEvent :47   ] - tradfri_0220_a7caxXxX_65540_brightness changed from NULL to 0
2017-11-15 13:56:47.177 [INFO ] [smarthome.event.ItemAddedEvent:47   ] - Item 'tradfri_0220_a7caxXxX_65540_color_temperature' has been added.
2017-11-15 13:56:47.177 [INFO ] [vent.ItemChannelLinkAddedEvent:47   ] - Link 'tradfri_0220_a7caxXxX_65540_color_temperature-tradfri:0220:a7caxXxX:65540:color_temperature' has been added.
2017-11-15 13:56:47.179 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: ONLINE
2017-11-15 13:56:47.179 [INFO ] [smarthome.event.ItemStateEvent:47   ] - tradfri_0220_a7caxXxX_65540_brightness updated to 0
2017-11-15 13:56:50.123 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: ONLINE
2017-11-15 13:56:50.123 [INFO ] [smarthome.event.ItemStateEvent:47   ] - tradfri_0220_a7caxXxX_65540_brightness updated to 0

added panel_01 from inbox:

2017-11-15 15:01:51.559 [INFO ] [rthome.event.InboxUpdatedEvent:47   ] - Discovery Result with UID 'tradfri:0220:a7caxXxX:65540' has been updated.
2017-11-15 15:01:58.015 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:gateway:a7caxXxX' updated: ONLINE
2017-11-15 15:01:58.020 [INFO ] [rthome.event.InboxUpdatedEvent:47   ] - Discovery Result with UID 'tradfri:0220:a7caxXxX:65540' has been updated.
2017-11-15 15:02:06.653 [INFO ] [rthome.event.InboxRemovedEvent:47   ] - Discovery Result with UID 'tradfri:0220:a7caxXxX:65540' has been removed.
2017-11-15 15:02:06.654 [INFO ] [marthome.event.ThingAddedEvent:47   ] - Thing 'tradfri:0220:a7caxXxX:65540' has been added.
2017-11-15 15:02:06.668 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: INITIALIZING
2017-11-15 15:02:06.670 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' changed from UNINITIALIZED to INITIALIZING
2017-11-15 15:02:06.670 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: UNKNOWN
2017-11-15 15:02:06.672 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' changed from INITIALIZING to UNKNOWN
2017-11-15 15:02:06.672 [INFO ] [smarthome.event.ItemAddedEvent:47   ] - Item 'tradfri_0220_a7caxXxX_65540_brightness' has been added.
2017-11-15 15:02:06.673 [INFO ] [vent.ItemChannelLinkAddedEvent:47   ] - Link 'tradfri_0220_a7caxXxX_65540_brightness-tradfri:0220:a7caxXxX:65540:brightness' has been added.
2017-11-15 15:02:06.675 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: ONLINE
2017-11-15 15:02:06.678 [INFO ] [nt.ThingStatusInfoChangedEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' changed from UNKNOWN to ONLINE
2017-11-15 15:02:06.680 [INFO ] [smarthome.event.ItemStateEvent:47   ] - tradfri_0220_a7caxXxX_65540_brightness updated to 0
2017-11-15 15:02:06.681 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: ONLINE
2017-11-15 15:02:06.682 [INFO ] [smarthome.event.ItemStateEvent:47   ] - tradfri_0220_a7caxXxX_65540_brightness updated to 0
2017-11-15 15:02:06.682 [INFO ] [s.event.ItemStateChangedEvent :47   ] - tradfri_0220_a7caxXxX_65540_brightness changed from NULL to 0
2017-11-15 15:02:06.710 [INFO ] [smarthome.event.ItemAddedEvent:47   ] - Item 'tradfri_0220_a7caxXxX_65540_color_temperature' has been added.
2017-11-15 15:02:06.711 [INFO ] [vent.ItemChannelLinkAddedEvent:47   ] - Link 'tradfri_0220_a7caxXxX_65540_color_temperature-tradfri:0220:a7caxXxX:65540:color_temperature' has been added.
2017-11-15 15:02:06.713 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: ONLINE
2017-11-15 15:02:06.713 [INFO ] [smarthome.event.ItemStateEvent:47   ] - tradfri_0220_a7caxXxX_65540_brightness updated to 0
2017-11-15 15:02:09.660 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: ONLINE
2017-11-15 15:02:09.662 [INFO ] [smarthome.event.ItemStateEvent:47   ] - tradfri_0220_a7caxXxX_65540_brightness updated to 0
2017-11-15 15:02:13.712 [INFO ] [rg.quartz.core.QuartzScheduler:575  ] - Scheduler openHAB-job-scheduler_$_NON_CLUSTERED started.
2017-11-15 15:02:19.763 [INFO ] [arthome.event.ItemCommandEvent:47   ] - Item 'tradfri_0220_a7caxXxX_65540_brightness' received command ON
2017-11-15 15:02:19.764 [INFO ] [smarthome.event.ItemStateEvent:47   ] - tradfri_0220_a7caxXxX_65540_brightness updated to ON
2017-11-15 15:02:19.764 [INFO ] [s.event.ItemStateChangedEvent :47   ] - tradfri_0220_a7caxXxX_65540_brightness changed from 0 to 100
2017-11-15 15:02:19.767 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: ONLINE
2017-11-15 15:02:19.769 [INFO ] [smarthome.event.ItemStateEvent:47   ] - tradfri_0220_a7caxXxX_65540_brightness updated to 100
2017-11-15 15:02:19.769 [INFO ] [smarthome.event.ItemStateEvent:47   ] - tradfri_0220_a7caxXxX_65540_color_temperature updated to 0
2017-11-15 15:02:19.770 [INFO ] [s.event.ItemStateChangedEvent :47   ] - tradfri_0220_a7caxXxX_65540_color_temperature changed from NULL to 0
2017-11-15 15:02:21.481 [INFO ] [arthome.event.ItemCommandEvent:47   ] - Item 'tradfri_0220_a7caxXxX_65540_brightness' received command OFF
2017-11-15 15:02:21.482 [INFO ] [smarthome.event.ItemStateEvent:47   ] - tradfri_0220_a7caxXxX_65540_brightness updated to OFF
2017-11-15 15:02:21.483 [INFO ] [s.event.ItemStateChangedEvent :47   ] - tradfri_0220_a7caxXxX_65540_brightness changed from 100 to 0
2017-11-15 15:02:21.485 [INFO ] [ome.event.ThingStatusInfoEvent:47   ] - 'tradfri:0220:a7caxXxX:65540' updated: ONLINE
2017-11-15 15:02:21.486 [INFO ] [smarthome.event.ItemStateEvent:47   ] - tradfri_0220_a7caxXxX_65540_brightness updated to 0

new control on Control
and I have a on/off switch for the Panel_01 and it works

I needed some time to think about your observed problems.

I guess we have a race condition between the initialization of the TradfriLightHandlers (TLH) and the ThingLinkManager (TLM) in this case - especially at the start-up of the system. The TLH initialization creates the coapClient instance. This is needed to sent requests to the Tradfri gateway. The TLM links every channels of the thing to the specific items. After the link is established the TLM sends a refresh command to the channel. That refresh tries to request the current data from the Tradfri gateway but fails because the coapClient is not created yet. This causes the NPE. The NPE itself leads to the situation that you cannot change your values of the bulb after a restart. This doesn’t happen if you add the devices after discovery. I will provide a bugfix which takes care of this situation. @Kai do you think this race condition only occurs in the Tradfri binding? Or can you imagine that this is a general problem in the start-up of the ESH framework?

Sry for my very technically answer. I hope you can understand it. Thank you very much for reporting this issue and help to solve it.

Thank you for the detailed answer Nice to read
I made some additionnal NPE checks to prevent the log gets filled.
I run the start sequence again and again and got a log with about 900 lines for each try.

2017-11-16 11:38:11.329 [DEBUG] [c.x.o.XmlDocumentBundleTracker:342  ] - Reading the XML document '/ESH-INF/thing/thing-types.xml' in module 'org.eclipse.smarthome.binding.tradfri'...
2017-11-16 11:38:11.331 [DEBUG] [c.x.o.XmlDocumentBundleTracker:342  ] - Reading the XML document '/ESH-INF/config/config.xml' in module 'org.eclipse.smarthome.binding.tradfri'...
2017-11-16 11:38:11.333 [DEBUG] [s.c.i.service.ReadyServiceImpl:49   ] - Added ready marker esh.xmlConfig=org.eclipse.smarthome.binding.tradfri
2017-11-16 11:38:11.334 [DEBUG] [c.x.o.XmlDocumentBundleTracker:342  ] - Reading the XML document '/ESH-INF/binding/binding.xml' in module 'org.eclipse.smarthome.binding.tradfri'...
2017-11-16 11:38:11.334 [DEBUG] [s.c.i.service.ReadyServiceImpl:49   ] - Added ready marker esh.xmlBindingInfo=org.eclipse.smarthome.binding.tradfri
2017-11-16 11:38:11.338 [INFO ] [.s.u.c.i.servlet.WebAppServlet:87   ] - Started Classic UI at /classicui/app
2017-11-16 11:38:11.341 [DEBUG] [.c.thing.internal.ThingManager:502  ] - Calling 'TradfriHandlerFactory.registerHandler()' for thing 'tradfri:gateway:a7cabab9'.
2017-11-16 11:38:11.348 [INFO ] [.s.u.b.i.servlet.WebAppServlet:84   ] - Started Basic UI at /basicui/app
2017-11-16 11:38:11.408 [DEBUG] [.c.thing.internal.ThingManager:603  ] - Configuration of thing tradfri:gateway:a7cabab9 needs [host], has [host, preSharedKey, code, port, identity].
2017-11-16 11:38:11.409 [DEBUG] [.c.thing.internal.ThingManager:630  ] - Calling initialize handler for thing 'tradfri:gateway:a7cabab9' at 'org.eclipse.smarthome.binding.tradfri.handler.TradfriGatewayHandler@4b3a6757'.
2017-11-16 11:38:11.587 [WARN ] [.d.TradfriDiscoveryParticipant:91   ] - Discovered Tradfri gateway doesn't have an IP address: [ServiceInfoImpl@524612020 name: 'gw-dcefcaba5307._coap._udp.local.' address: '(null):0' status: 'DNS: JmDNS-IP-2 [/xxx.xxxx.xxx.126] state: probing 1 task: null', has NO data
	gw-dcefcaba5307._coap._udp.local.: ]
2017-11-16 11:38:11.589 [DEBUG] [.d.TradfriDiscoveryParticipant:79   ] - Discovered Tradfri gateway: [ServiceInfoImpl@293805100 name: 'gw-dcefcaba5307._coap._udp.local.' address: '/xxx.xxx.xxx.142:5684 /fe80:0:0:0:deef:caff:feba:5307:5684 ' status: 'DNS: JmDNS-IP-2 [/xxx.xxx.xxx.126] state: probing 1 task: null' is persistent, has data
	version: 1.2.42]

The gateway takes a long time to setup

2017-11-16 11:38:16.412 [DEBUG] [s.core.common.SafeMethodCaller:205  ] - Timeout of 5000ms exceeded, thread safeCall-2 (131) in state RUNNABLE is at org.eclipse.smarthome.binding.tradfri.handler.TradfriGatewayHandler.initialize(TradfriGatewayHandler.java:87).
2017-11-16 11:38:16.413 [WARN ] [.c.thing.internal.ThingManager:641  ] - Initializing handler for thing 'tradfri:gateway:a7cabab9' takes more than 5000ms.

You will see that the refresh of the data is done, but the thing is not added to the inbox, as it is already present in the registry
I do not understand why the gateway gets remains not being online until the udp discovery has finished. The IP and secret is read .

2017-11-16 11:38:16.416 [DEBUG] [s.c.i.service.ReadyServiceImpl:49   ] - Added ready marker esh.xmlThingTypes=org.eclipse.smarthome.binding.tradfri
2017-11-16 11:38:23.293 [DEBUG] [.e.s.config.core.Configuration:99   ] - Setting value (String) xxx.xxx.xxx.142 to field 'host' in configuration class org.eclipse.smarthome.binding.tradfri.internal.config.TradfriGatewayConfig
2017-11-16 11:38:23.294 [DEBUG] [.e.s.config.core.Configuration:99   ] - Setting value (int) 5684 to field 'port' in configuration class org.eclipse.smarthome.binding.tradfri.internal.config.TradfriGatewayConfig
2017-11-16 11:38:23.294 [DEBUG] [.e.s.config.core.Configuration:99   ] - Setting value (String) xxxxxxxxx to field 'code' in configuration class org.eclipse.smarthome.binding.tradfri.internal.config.TradfriGatewayConfig
2017-11-16 11:38:23.295 [DEBUG] [.e.s.config.core.Configuration:99   ] - Setting value (String)  to field 'identity' in configuration class org.eclipse.smarthome.binding.tradfri.internal.config.TradfriGatewayConfig
2017-11-16 11:38:23.296 [DEBUG] [.e.s.config.core.Configuration:99   ] - Setting value (String) xxxxxxxxxx to field 'preSharedKey' in configuration class org.eclipse.smarthome.binding.tradfri.internal.config.TradfriGatewayConfig
2017-11-16 11:38:23.296 [WARN ] [.s.b.t.h.TradfriGatewayHandler:108  ] - Gateway with old firmware - please consider upgrading to the latest version.
2017-11-16 11:38:23.301 [DEBUG] [.c.c.r.AbstractManagedProvider:128  ] - Updated element tradfri:gateway:a7caxxxx in ManagedThingProvider.

2017-11-16 11:38:25.269 [DEBUG] [s.c.d.internal.PersistentInbox:190  ] - Updated discovery result for 'homematic:HM-TC-IT-WM-W-EU:32b21339:LEQ0997044'.
2017-11-16 11:38:25.294 [DEBUG] [s.c.d.internal.PersistentInbox:190  ] - Updated discovery result for 'homematic:HM-WDS40-TH-I-2:32b21339:LEQ0228393'.
2017-11-16 11:38:25.601 [DEBUG] [s.c.d.internal.PersistentInbox:190  ] - Updated discovery result for 'homematic:HM-LC-Sw1PBU-FM:32b21339:LEQ0493990'.
2017-11-16 11:38:26.151 [DEBUG] [s.c.d.internal.PersistentInbox:190  ] - Updated discovery result for 'homematic:HM-CC-RT-DN:32b21339:LEQ0846743'.
2017-11-16 11:38:26.164 [DEBUG] [o.e.s.b.t.i.TradfriCoapHandler:56   ] - CoAP response
options: {"Content-Format":"application/json", "Max-Age":604800}
payload: {"9023":"0.tradfri.pool.ntp.org","9074":0,"9059":1510828705,"9080":0,"9072":0,"9060":"2017-11-16T10:38:25.059032Z","9062":0,"9061":0,"9083":"795-75-672","9029":"1.2.42","9081":"7e18215204400185","9082":true,"9092":0,"9054":0,"9073":0,"9055":0,"9066":5,"9069":1509650840,"9079":0,"9071":1,"9075":0,"9076":0,"9093":0,"9077":0,"9078":0,"9106":0} 
2017-11-16 11:38:26.511 [DEBUG] [o.e.s.b.t.i.TradfriCoapHandler:56   ] - CoAP response
options: {"Content-Format":"application/json", "Max-Age":604800}
payload: [65537,65536,65539,65540,65538] 
2017-11-16 11:38:26.511 [DEBUG] [.s.b.t.h.TradfriGatewayHandler:263  ] - onUpdate response: [65537,65536,65539,65540,65538]
2017-11-16 11:38:26.519 [DEBUG] [o.e.s.b.t.i.TradfriCoapHandler:56   ] - CoAP response
options: {"Content-Format":"application/json", "Max-Age":604800}
payload: {"9019":1,"9001":"RGB_Lampe_01","9002":1509652759,"3":{"0":"IKEA of Sweden","6":1,"1":"TRADFRI bulb E27 CWS opal 600lm","2":"","3":"1.3.002"},"9020":1510744144,"9003":65537,"9054":0,"5750":2,"3311":[{"5850":1,"5851":254,"5707":47324,"5708":51774,"5709":13107,"5710":6554,"5706":"6c83ba","9003":0}]} 
2017-11-16 11:38:26.520 [DEBUG] [.s.b.t.h.TradfriGatewayHandler:294  ] - requestDeviceDetails response: {"9019":1,"9001":"RGB_Lampe_01","9002":1509652759,"3":{"0":"IKEA of Sweden","6":1,"1":"TRADFRI bulb E27 CWS opal 600lm","2":"","3":"1.3.002"},"9020":1510744144,"9003":65537,"9054":0,"5750":2,"3311":[{"5850":1,"5851":254,"5707":47324,"5708":51774,"5709":13107,"5710":6554,"5706":"6c83ba","9003":0}]}
2017-11-16 11:38:26.526 [DEBUG] [.t.i.d.TradfriDiscoveryService:144  ] - Adding device tradfri:0210:a7caxxx:65537 to inbox
2017-11-16 11:38:26.526 [DEBUG] [s.c.d.internal.PersistentInbox:198  ] - Discovery result with thing 'tradfri:0210:a7caxxxx:65537' not added as inbox entry. It is already present as thing in the ThingRegistry.
.....

so a later call to this item sees the coapClient empty.

The update every minute as sheduled ends with : "It is already present as thing in the ThingRegistry"
So it seems that his a tradfri problem, my homematic things work without this issue.

The log is too long to be presented in the community.
Do you want to get the complete file?

P.S I did my first debuging in fortran 1966, so now I have enough time to test and check

Thank you for your help. The DEBUG information are very much appreciated. I opened a PR in the ESH repo. We started a discussion about this over there. If you like to follow, here is the link.

Do you have time to do some more debugging? I can provide you a modified version of the binding containing additional logging outputs at the time the coapClient gets modified. We are currently not sure if the error is located in the ESH framework or if it is a Tradfri specific problem.

1 Like

I will try and test on openhabian and within eclipse.

I will be back on Thursday

Where do I find the modified version with additional logging?