|
|
Re: list of channels [message #1746925 is a reply to message #1746878] |
Mon, 07 November 2016 17:58 |
Bernhard Boser Messages: 2 Registered: November 2016 |
Junior Member |
|
|
Hi Kai,
Many thanks for the quick response. It's incredible how you manage to personally respond to these questions.
Kai Kreuzer wrote on Mon, 07 November 2016 08:30The channelLinked() method is the right place to be informed about newly linked channels - it definitely is called by the framework!
This method is never called in my OH2 binding (the IDE marks it correctly as overloaded).
Quote:The full list of channels that are defined on the Thing (independent of whether they are coming through the thing type definition or through a user configuration) is available through "getThing().getChannels()".
"getThing().getChannels().size()" is always zero, no matter when I call it (I've even added a special "switch" that let's me call it from the gui).
But the links are definitely created. In the log, just after startup, I first see the links (from my items file), e.g.
09:34:23.297 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'doorStairs-nx584:security:creston:zone18#status' has been added.
and a bit later the thing (from my thing file):
09:34:28.919 [INFO ] [smarthome.event.ThingAddedEvent ] - Thing 'nx584:security:creston' has been added.
The binding sends updates to these links (or channels, are they the same?) and the sitemap is updated as expected.
I did not define the channels in the thing_types.xml file, just in the items file.
Quote:Regarding channel parameters, you need to note that those are configured in the Thing definition, e.g. within the *.things files. The *.items file that you refer to above only hold a reference to a channel, but no further details. You might also want to read http://docs.openhab.org/tutorials/migration#understanding-things to better understand this change from OH1 syntax to OH2 syntax.
Regards,
Kai
I've read the tutorial and though it does make sense for the weather binding, I to see how to best deal with the following case: The ISY binding (currently unresolved PR, OH1) identifies lights with 2 addresses (has to do with Insteon - I can go into details). Per the tutorial, these should be parameters and specified in the .things file. Since each address combination represents a single light (precisely, scene), there is now a 1-to-1 correspondence between things and items! While possible, this would add significant redundancy to the user configuration.
Regards,
Bernhard
|
|
|
|
Powered by
FUDForum. Page generated in 0.05246 seconds