Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse SmartHome » Optional channels in thing-type (xml;static thing description)
Optional channels in thing-type (xml;static thing description) [message #1737460] Fri, 08 July 2016 12:32 Go to next message
David Graeff is currently offline David GraeffFriend
Messages: 15
Registered: April 2016
Junior Member
Hello,

i feel the need that a <thing-type> described in the ESH-INF directory of an addon should allow to define channels, which are optional (may be created dynamically or may be absent). At the moment you can do this:

<thing-type>
  <channels>
    <channel id="0" typeId="0"/>
  </channels>
</thing-type>


and I propose to allow something like this:

<thing-type>
  <channels>
    <channel id="0" typeId="0" optional="true" />
  </channels>
</thing-type>


A usecase:
I'm about to commit an addon for integrating LwM2M devices into ESH. LwM2M (usually) uses UDP/CoAP to communicate with client devices and the Open Mobile Alliance operates a registry for LwM2M device "objects" and "resources" (like light/switch/generic input/output objects etc). A lwm2m client provides some mandatory objects and an arbitrary number of additional objects which each of them consisting of one or multiple resources. Those object/resource descriptions are hosted in xml and can automatically be converted to ESH thing describtions. There is a rough equivalent meaning of lwm2m objects to ESH things and lwm2m resources to ESH channels.

But there is one difference, hard to describe in ESH with the current schema (http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd):

lwm2m resources can be optional, ESH channels cannot. If I add those optional resources as channels, the framework will automatically create those channels on thing creation time. If I do not add them (or only add them as xml comments), they do not appear in the UI, although they can be part of that thing.

Alternative:

Allow to explicitly define a cardinality for a channel, for example:

<thing-type>
  <channels>
    <channel id="known_channel" typeId="0" />
    <channel id="foo%" typeId="1" cardinality="0..3" />
    <channel id="bar%" typeId="2" cardinality="1..n" />
  </channels>
</thing-type>


The channel id has to be unique among the channels. One idea is to use the "%" character, for example, to make the framework aware that depending on the cardinality an incrementing number has to be added to the id.

What do you thing? In my opinion a way to mainly make the UI aware of optional channels is missing right now.
Re: Optional channels in thing-type (xml;static thing description) [message #1737531 is a reply to message #1737460] Sat, 09 July 2016 09:27 Go to previous messageGo to next message
Markus Rathgeb is currently offline Markus RathgebFriend
Messages: 100
Registered: August 2014
Senior Member

There is (at least for me) also another one: Perhaps not exactly the same issue as yours but also about more dynamic channel / thing types.

Let's assume you have different temperature sensor, so the thing type consists of one channel "temperature".
The different temperature sensor have different ranges, so I would like to use different min / max / stepSize of the channel state description.
At the moment I have to add a different thing type for every range.
Re: Optional channels in thing-type (xml;static thing description) [message #1737614 is a reply to message #1737531] Mon, 11 July 2016 09:47 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 648
Registered: December 2011
Senior Member
Are you aware that you can add any channel to your thing without the need to have it declared in a thing type? This imho already allows you adding optional channels without any constraint.

What exactly do you mean by the UI not being aware of those channels?
Re: Optional channels in thing-type (xml;static thing description) [message #1737622 is a reply to message #1737614] Mon, 11 July 2016 11:07 Go to previous messageGo to next message
Markus Rathgeb is currently offline Markus RathgebFriend
Messages: 100
Registered: August 2014
Senior Member

Perhaps I am wrong, but the minimum, maximum and step size information for the state (that is used at least by the Paper UI) is part of the channel type and not of the channel.
So, if I would like to provide such information, I have also to add a channel-type dynamically.
Or I am missing something?
Re: Optional channels in thing-type (xml;static thing description) [message #1738123 is a reply to message #1737622] Fri, 15 July 2016 20:48 Go to previous messageGo to next message
Lukasz Dywicki is currently offline Lukasz DywickiFriend
Messages: 31
Registered: July 2009
Member
I can add one more usecase for that. In some cases there are sensors which are supported by controller but not installed at device. For example my AHU unit have controller which supports retrieval of exhaust air temperature, however my device does not have such sensor. In this case it is purely optional channel.
Re: Optional channels in thing-type (xml;static thing description) [message #1738165 is a reply to message #1738123] Sat, 16 July 2016 18:15 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Lukasz Dywicki wrote on Fri, 15 July 2016 21:48
I can add one more usecase for that. In some cases there are sensors which are supported by controller but not installed at device.


What do you want the options channel to do though? ie what would the system do with the <optional> attribute?

Currently, all channels are 'optional' in some sense in that the user doesn't have to instantiate and link an item to the channel, in which case it's not available in the UI.

Re: Optional channels in thing-type (xml;static thing description) [message #1738256 is a reply to message #1738165] Mon, 18 July 2016 13:37 Go to previous message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 648
Registered: December 2011
Senior Member
> So, if I would like to provide such information, I have also to add a channel-type dynamically.

Right, but here we are talking about thing types. And I assume that the optional channels would have a clearly specified type.
Previous Topic:Auto created items are not managed
Next Topic:Persistence method to store historical data
Goto Forum:
  


Current Time: Thu Jun 21 01:09:22 GMT 2018

Powered by FUDForum. Page generated in 0.01818 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top