Hi guy’s,
In the documentation is said that it is possible to change the structure of a thing by adding, or removing channels. I tried the example in the documentation
public void thingStructureChanged() {
ThingBuilder thingBuilder = editThing();
Channel channel = ChannelBuilder.create(new ChannelUID(getThing().getUID().toString() + ":test"), "Switch")
.build();
thingBuilder.withChannel(channel);
updateThing(thingBuilder.build());
}
but I am getting the following error:
2015-09-11 18:19:54 [ERROR] [.c.thing.internal.ThingManager:300 ] - Exception occured while calling handler: java.lang.UnsupportedOperationExceptionjava.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:206)
at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:157)
at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:72)
at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:56)
at org.eclipse.smarthome.core.thing.internal.ThingManager.receiveCommand(ThingManager.java:289)
at org.eclipse.smarthome.core.items.events.AbstractItemEventSubscriber.receive(AbstractItemEventSubscriber.java:46)
at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:168)
at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
Caused by: java.lang.UnsupportedOperationException: null
at com.google.common.collect.ImmutableCollection.add(ImmutableCollection.java:91)
at org.eclipse.smarthome.core.thing.binding.builder.GenericThingBuilder.withChannel(GenericThingBuilder.java:31)
at org.openhab.binding.lirc.handler.lircHandler.thingStructureChanged(lircHandler.java:65)
at org.openhab.binding.lirc.handler.lircHandler.handleCommand(lircHandler.java:40)
at org.eclipse.smarthome.core.thing.internal.ThingManager$2.call(ThingManager.java:292)
at org.eclipse.smarthome.core.thing.internal.ThingManager$2.call(ThingManager.java:1)
… 4 common frames omitted
Has anyone of you tried to add channels dynamically?
Best regards, Haris.