Optional channels in thing-type (xml;static thing description) [message #1737460] |
Fri, 08 July 2016 12:32 |
David Graeff Messages: 17 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 |
|
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.
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03243 seconds