Can't find and add tradfri bulbs

My setup first: Openhab 2.2.0 on a openhabianpi with the binding-tradfri - 2.2.0: I have had 3 tradfri dimmable white bulbs running with a dimmer and a motions sensor for some time and just now bought a gateway. I was able to add and controll the motion sensor/dimmer/bulbs via the tradfri app and the gateway.
Afterwards I installed the openhab tradfri binding and added the gateway (which worked). Scanning for new devices via the paper UI only returns the gateway/dimmer/motion sensor though. Those have been added to my things/items files and work well. After not finding any bulbs I tried to guess the ID and add them… and they are offline. Any idea how to add them?

I do have some repeating errors in my log from the tradfri binding:

2018-04-22 22:43:08.324 [ERROR] [alifornium.core.network.CoapEndpoint] - Exception in protocol stage thread: null

java.lang.NullPointerException: null
	at org.eclipse.smarthome.binding.tradfri.internal.model.TradfriDeviceData.<init>(TradfriDeviceData.java:54) [234:org.eclipse.smarthome.binding.tradfri:0.10.0.b1]
	at org.eclipse.smarthome.binding.tradfri.internal.model.TradfriLightData.<init>(TradfriLightData.java:42) [234:org.eclipse.smarthome.binding.tradfri:0.10.0.b1]
	at org.eclipse.smarthome.binding.tradfri.handler.TradfriLightHandler.onUpdate(TradfriLightHandler.java:56) [234:org.eclipse.smarthome.binding.tradfri:0.10.0.b1]
	at org.eclipse.smarthome.binding.tradfri.internal.TradfriCoapHandler.onLoad(TradfriCoapHandler.java:65) [234:org.eclipse.smarthome.binding.tradfri:0.10.0.b1]
	at org.eclipse.californium.core.CoapClient$ObserveMessageObserverImpl.deliver(CoapClient.java:1067) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.CoapClient$MessageObserverImpl.succeeded(CoapClient.java:995) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.CoapClient$MessageObserverImpl.onResponse(CoapClient.java:974) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.coap.Request.setResponse(Request.java:509) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.network.EndpointManager$ClientMessageDeliverer.deliverResponse(EndpointManager.java:267) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.network.stack.CoapStack$StackTopAdapter.receiveResponse(CoapStack.java:193) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.network.stack.AbstractLayer.receiveResponse(AbstractLayer.java:98) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.network.stack.ObserveLayer.receiveResponse(ObserveLayer.java:137) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.network.stack.AbstractLayer.receiveResponse(AbstractLayer.java:98) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.network.stack.BlockwiseLayer.receiveResponse(BlockwiseLayer.java:321) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.network.stack.AbstractLayer.receiveResponse(AbstractLayer.java:98) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.network.stack.ReliabilityLayer.receiveResponse(ReliabilityLayer.java:269) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.network.stack.AbstractLayer.receiveResponse(AbstractLayer.java:98) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.network.stack.CoapStack.receiveResponse(CoapStack.java:135) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.network.CoapEndpoint$InboxImpl.receiveMessage(CoapEndpoint.java:656) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.network.CoapEndpoint$InboxImpl.access$700(CoapEndpoint.java:562) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.network.CoapEndpoint$InboxImpl$1.run(CoapEndpoint.java:574) [231:californium-osgi:1.0.6]
	at org.eclipse.californium.core.network.CoapEndpoint$5.run(CoapEndpoint.java:721) [231:californium-osgi:1.0.6]
	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) [?:?]

The only reference I found to this error was a github issue: https://github.com/eclipse/smarthome/issues/3683. As far as I understand it this should have been fixed by now though? Not sure if this is even the cause of my problems… Or do I need to use some newer version of the binding?

Hi Oliver,

How did you try to add the missing bulbs? Did you use PaperUI or did you configure them manually in your things file? Do you have an example? At which time in this process did the referenced exception occur? Before entering the id or afterwards. Was the id correct?

My first guess is that the id was wrong. And we discovered a new issue which is not related to the one you found.

Hey,
I used the PaperUI to search for them (and did not find them, while the dimmer and motion sensor showed up). I am not 100% sure when in the process the error message showed up. After finding the 2 items I started to set them all in my things file like this:

Bridge tradfri:gateway:tradfriGateway [ host="192.168.2.xxx", code="xxxxxxxxx" ] {
0820 dimmerKitchen [ id=65542 ]
0107 motionHallway [ id=65539 ]
}

and it worked just fine. Today I removed the dimmer and one bulb from the tradfri app and readded them and suddenly the bulb showed up in the PaperUI where I was able to control it.
The brightness channel looks like this:
tradfri:0100:tradfriGateway:65543:brightness
So I took the id and added it to my things/items file:

Bridge tradfri:gateway:tradfriGateway [ host="192.168.2.xxx", code="xxxxxxxxx" ] {
    0100 bulbKitchen [ id=65543 ]
    0820 dimmerKitchen [ id=65542 ]
    0107 motionHallway [ id=65539 ]
}

Dimmer KitchenBulb { channel="tradfri:0100:tradfriGateway:65543:brightness" }
Slider item=KitchenBulb label="Lampe Küche"
… and it does not react to any changes and does not even show up in my logs.

Earlier I tried to guess the other bulbs’ ids because they are most likely between 39 id and the 42. I will try to remove and readd those bulbs too tomorrow. Maybe they show up then. I will also watch for the error.
Is there any mistake in my definitions? Is that new issue related to this? If more information is needed I would be glad to provide it

One step into the right direction. The things file looks good but the item definition has to be changed. Auto discovery named the thing for the bulbs with the TRADFRI bulb id (e.g. tradfri:0100:tradfriGateway:65543). You gave the bulb the name bulbKitchen. Meaning your item has to be linked to this channel: tradfri:0100:tradfriGateway:bulbSitchen:brightness. I’m pretty sure you will have added your remaining bulbs successfully by the end of the day.

If you can find any information in the exception it will be appreciated if you share them. Thanks.

I finally found the time to get the rest of the lights working. I re-added all of them via the IKEA app and now they are showing up in the paperUI. Strange thing though: I added them to my things file like shown above (with updated ids) and they were shown as online but not working. The strange thing seems to be that some items now show up via their id and some via the name I gave them
tradfri:0100:tradfriGateway:65543:brightness
tradfri:0100:tradfriGateway:65545:brightness

When I use the right names for the links to my items everything seems to be working now but I am still not sure if the setup works without the paperUI directly from a things file. The error message from my first post did not show up again though

Sounds good. I use a text-only configuration for the binding. Therefore it should be possible for you too. But it is not a good idea to split it up. Do it in the one way or the other. Not both.

Hi,

I am new and got the Trafri gateway online. However the bulbs are not visible in the inbox. I added one manually, linked it to the gateway. Filled in quite some id’s like 0100 and also 30-45 just to try.

What am I doing wring here ?

Walter