Home » Archived » Eclipse SmartHome » Dynamically created channels are not shown
| | | | | | | |
Re: Dynamically created channels are not shown [message #1715349 is a reply to message #1714805] |
Sun, 22 November 2015 16:09 |
Osman Basha Messages: 9 Registered: November 2015 Location: Kassel, Germany |
Junior Member |
|
|
Since I've updated the core I see the Inbox is not working like before.
I'm not really sure if this is the cause:
Dennis Nobel wrote on Mon, 16 November 2015 21:20The channel builder now has a method "withType" (see https://github.com/eclipse/smarthome/blob/master/bundles/core/org.eclipse.smarthome.core.thing/src/main/java/org/eclipse/smarthome/core/thing/binding/builder/ChannelBuilder.java#L63).
An approved thing from the inbox appears in the group. But after restarting openHAB the thing is not usable anymore. It's shown in the UI but not in the Configuration -> Things menu. It also cannot be removed from the UI.
This is what I've found in the log file:
2015-11-22 16:42:59 [WARN ] [e.s.storage.mapdb.MapDbStorage:156 ] - Couldn't deserialize value 'org.eclipse.smarthome.core.thing.internal.ThingImpl@@@{"channels":[{"acceptedItemType":"Number","uid":{"segments":["smaenergymeter","energymeter","9999999999","powerIn"]},"channelTypeUID":{"segments":["smaenergymeter","powerInType"]},"configuration":{"properties":{}},"properties":{},"defaultTags":[]},{"acceptedItemType":"Number","uid":{"segments":["smaenergymeter","energymeter","9999999999","powerOut"]},"channelTypeUID":{"segments":["smaenergymeter","powerOutType"]},"configuration":{"properties":{}},"properties":{},"defaultTags":[]},{"acceptedItemType":"Number","uid":{"segments":["smaenergymeter","energymeter","9999999999","energyIn"]},"channelTypeUID":{"segments":["smaenergymeter","energyInType"]},"configuration":{"properties":{}},"properties":{},"defaultTags":[]},{"acceptedItemType":"Number","uid":{"segments":["smaenergymeter","energymeter","9999999999","energyOut"]},"channelTypeUID":{"segments":["smaenergymeter","energyOutType"]},"configuration":{"properties":{}},"properties":{},"defaultTags":[]}],"configuration":{"properties":{"vendor":"SMA","serialNumber":"9999999999","mcastGroup":"239.12.255.254","port":9522,"pollingPeriod":30}},"properties":{"serialNumber":"Serial Number","vendor":"Vendor"},"uid":{"segments":["smaenergymeter","energymeter","9999999999"]},"thingTypeUID":{"segments":["smaenergymeter","energymeter"]}}'. Root cause is: Failed to invoke org.eclipse.smarthome.core.thing.type.ChannelTypeUID() with no args
2015-11-22 16:42:59 [WARN ] [.c.c.r.AbstractManagedProvider:138 ] - Could not update element with key smaenergymeter:energymeter:9999999999 in ManagedThingProvider, because it does not exists.
The behaviour can also be reproduced with other bindings.
|
|
| | |
Re: Dynamically created channels are not shown [message #1715464 is a reply to message #1715386] |
Mon, 23 November 2015 20:55 |
Osman Basha Messages: 9 Registered: November 2015 Location: Kassel, Germany |
Junior Member |
|
|
Thank you for the PR.
I just pulled from master and rebuilt the solution - the bug seems to be still there... or the successor of that bug
Exception: java.lang.RuntimeException: Failed to invoke org.eclipse.smarthome.core.thing.type.ChannelTypeUID() with no args
Root cause: java.lang.IllegalArgumentException: UID must have at least 2 segments.
The line from the Log file:
2015-11-23 21:54:58 [WARN ] [e.s.storage.mapdb.MapDbStorage:156 ] - Couldn't deserialize value 'org.eclipse.smarthome.core.thing.internal.ThingImpl@@@{"bridgeUID":{"segments":["beckhoff","bridge","a94f2935"]},"channels":[{"acceptedItemType":"Rollershutter","uid":{"segments":["beckhoff","rollershutter","a94f2935","MAIN_fbEg_fbShutter1","channel"]},"channelTypeUID":{"segments":["beckhoff","rollershutter"]},"configuration":{"properties":{}},"properties":{},"defaultTags":[]}],"configuration":{"properties":{"symbolName":"MAIN.fbEg.fbShutter1","forcePolling":false,"pollingPeriod":10}},"properties":{},"uid":{"segments":["beckhoff","rollershutter","a94f2935","MAIN_fbEg_fbShutter1"]},"thingTypeUID":{"segments":["beckhoff","rollershutter"]}}'. Root cause is: Failed to invoke org.eclipse.smarthome.core.thing.type.ChannelTypeUID() with no args
-
Attachment: s.png
(Size: 118.09KB, Downloaded 1425 times)
|
|
| | | | | | | | |
Re: Dynamically created channels are not shown [message #1734789 is a reply to message #1719315] |
Sun, 12 June 2016 15:08 |
Juergen Messmer Messages: 4 Registered: June 2016 |
Junior Member |
|
|
Hi,
I have a similar, but slightly different problem.
I am doing a similar thing as Osman:
public void initialize() {
logger.debug("Initializing FileRegexParser handler.");
super.initialize();
Configuration config = getThing().getConfiguration();
try {
fileName = (String) config.get("fileName");
} catch (Exception e) {
logger.debug("Cannot set fileName parameter.", e);
}
try {
regEx = (String) config.get("regEx");
pattern = Pattern.compile(regEx);
} catch (Exception e) {
logger.debug("Cannot set regEx parameter.", e);
}
matcher = pattern.matcher("");
groupCount = matcher.groupCount();
updateState(new ChannelUID(getThing().getUID(), CHANNEL_GROUPCOUNT), new DecimalType(matcher.groupCount()));
updateStatus(ThingStatus.ONLINE);
this.thingStructureChanged();
}
protected void thingStructureChanged() {
ThingBuilder thingBuilder = editThing();
Channel channel = ChannelBuilder.create(new ChannelUID(getThing().getUID(), "test1"), "String").build();
thingBuilder.withChannel(channel);
updateThing(thingBuilder.build());
}
This works and adds the channel "test1" when the thing is created via PaperUI.
If the thing is defined in a .thing file:
fileregexparser:filetoparse:jmefp [fileName="d:\\tmp\\test.txt", regEx="^\\s*(INFO:\\s)test\\s(.*)"]
Then the channel is not added and I get the following error message:
2016-06-12 17:05:34.327 [WARN ] [.c.c.r.AbstractManagedProvider:138 ] - Could not update element with key fileregexparser:filetoparse:jmefp in ManagedThingProvider, because it does not exists.
2016-06-12 17:05:34.331 [ERROR] [.c.thing.internal.ThingManager:699 ] - Exception occured while initializing handler of thing 'fileregexparser:filetoparse:jmefp': java.lang.IllegalStateException: Could not update thing fileregexparser:filetoparse:jmefp. Most likely because it is read-only.java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Could not update thing fileregexparser:filetoparse:jmefp. Most likely because it is read-only.
at java.util.concurrent.FutureTask.report(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:179)
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$7.run(ThingManager.java:684)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
Caused by: java.lang.IllegalStateException: Could not update thing fileregexparser:filetoparse:jmefp. Most likely because it is read-only.
at org.eclipse.smarthome.core.thing.internal.ThingManager$1.thingUpdated(ThingManager.java:235)
at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.updateThing(BaseThingHandler.java:384)
at org.openhab.binding.fileregexparser.handler.FileRegexParserHandler.thingStructureChanged(FileRegexParserHandler.java:97)
at org.openhab.binding.fileregexparser.handler.FileRegexParserHandler.initialize(FileRegexParserHandler.java:72)
at org.eclipse.smarthome.core.thing.internal.ThingManager$7$1.call(ThingManager.java:687)
at org.eclipse.smarthome.core.thing.internal.ThingManager$7$1.call(ThingManager.java:1)
at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:170)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
How is creating the a thing different via PaperUI from creating it via the .items file?
Any idea where the problem is?
Thx, Juergen
|
|
| |
Re: Dynamically created channels are not shown [message #1735410 is a reply to message #1735246] |
Sat, 18 June 2016 16:37 |
Karel Goderis Messages: 198 Registered: March 2014 |
Senior Member |
|
|
Kai,
Despite all the discussion in the past, I still fail to see why it is not possible to have dynamic channels, configurations and properties for Things that are defined through the DSL. The same question/demand is coming back several times, and every time it is channels/properties/configuration elements that are the result of querying devices and so forth, and that we are all OK with that these are not persisted, and built up after a restart of the runtime.
The counter-arguments are always driven by the presence of a user interface, paperUI notably. Now, not everyone needs or wants paperUI to configure their installation, it is after all an optional component, but it heavily weighs in on other parts of the architecture. That is not logical.
K
|
|
|
Re: Dynamically created channels are not shown [message #1735745 is a reply to message #1735410] |
Wed, 22 June 2016 11:50 |
Kai Kreuzer Messages: 673 Registered: December 2011 |
Senior Member |
|
|
> I still fail to see why it is not possible to have dynamic channels, configurations and properties for Things
Well, we already made the step to allow (non-persisted) property updates. So yes, we can extend the discussion to configurations and channels and the "whole" Thing.
> that we are all OK with that these are not persisted, and built up after a restart of the runtime.
I do not recall this having been discussed. Right, if we all agree that we are only talking about not-persisted changes done through the binding, this can be applied to Things from the DSL in the same way.
> The counter-arguments are always driven by the presence of a user interface, paperUI notably.
Do you have a reference to this argument (sorry if I tend to forget my own arguments of past discussions)? For me, the main argument is that you never know what features your Thing actually provides, how it is configured and setup. You need to have this information when you want to link channels to your items, work with it in rules, etc. And you might want to be able to do so, even when you are "offline" (i.e. your environment is not fully up and operational). For thisto work, the persisted Thing is important, because it still exists, even if the binding might not be installed. How you get your Thing displayed, be it through the Paper UI or by console output, does not matter at all. So this is definitely not about the Paper UI - rather the contrary: About the (very desirable) reliability of the content of textual configuration - what we all want to keep from the OH1 world.
|
|
|
Goto Forum:
Current Time: Tue Apr 16 12:15:18 GMT 2024
Powered by FUDForum. Page generated in 1.08780 seconds
|