Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse SmartHome » Protocol/binding specific information in Thing descriptions?
Protocol/binding specific information in Thing descriptions? [message #1638625] Fri, 27 February 2015 07:57 Go to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
When discussing the openHAB 2 Zigbee binding (https://github.com/openhab/openhab2/issues/142#issuecomment-76250552), we came across the question whether it is possible to have protocol specific information being added to the Thing descriptions. This might be a very useful thing to do in order to have generic ThingHandlers being able to deal with some specifics.
I wonder how others think about this and how such information could best fit into the existing thing description schema?

Regards,
Kai

[Updated on: Fri, 27 February 2015 07:58]

Report message to a moderator

Re: Protocol/binding specific information in Thing descriptions? [message #1638640 is a reply to message #1638625] Fri, 27 February 2015 08:10 Go to previous messageGo to next message
Dennis Nobel is currently offline Dennis NobelFriend
Messages: 166
Registered: September 2014
Senior Member
In general it might be good to have the possibility to add a map of properties to a thing. We could extend the XML to something like this:

<thing:thing-descriptions bindingId="lifx">
<thing-type id="light">
<label>LIFX Light</label>
<!-- ... -->
<properties>
<property key="specificProperty">specific value</property>
<property key="specificProperty2">specific value2</property>
</properties>
</thing-type>
</thing:thing-descriptions>

On the API level we could add a method "Map<String, String> getProperties()" to the Thing Type.

Regards

Dennis
Re: Protocol/binding specific information in Thing descriptions? [message #1639575 is a reply to message #1638640] Fri, 27 February 2015 18:15 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Kai - I just move our discussion over here and answer your questions -:


Quote:
On 27 Feb 2015, at 08:03, Kai Kreuzer <notifications@github.com> wrote:

Quote:
but I also fear this can become a maintenance nightmare and we'll end up trying to support a 'database' of devices

Isn't this what you have done with Z-Wave as well?


Yes - so I speak with some experience Smile
However, for zwave, there is no alternative - we have to have a database to hold information about the items configuration or we can't get the devices to work correctly. There are hundreds of zwave devices, and every one is different so we can't infer anything from the device (hence the need for the database). This probably isn't the case for most other devices, and for example ZigBee is more prescriptive with its cluster definitions, so it's possible to eliminate the database and have generic devices whose features are discovered - does it really matter if a device is called "Phillips Hue L1234" or "Dimmable Color Bulb"?

I do agree that it's nice to have a real device name - but from experience I've spent a LOT of time doing the database for zwave and I just question if it's necessary in all cases.

Quote:
And again: Yes, the idea of the ThingTypes is that they reflect a certain product/model. This is what you will find in most other bindings as well and I think all bindings should follow the same guidelines.

Ok - then we come back to your problem about multiple bindings supporting the same devices. In this case, the hue bulbs are supported by both the zigbee and hue bindings. Somehow, if the devices are meant to be the same, they should use the same definition?

Quote:
Quote:
can bindings add their own information into the XML files for device specific stuff?


Do you have a concrete example?


Yes - I'll use zwave. For zwave devices we need to hold information on association links, and command class configuration. I could see that it might be possible to merge binding dependant information into the thing database if we could support such a structure. eg-:
<thing-type id="Device">
<label>Device type</label>
<description></description>
<channels>
<channel id="switch" typeId="switch" />
<channel id="brightness" typeId="brightness" />
</channels>
<device-specific>
<binding specific stuff goes in here>
</device-specific>
</thing-type>

This would allow bindings to put information that is specific to their devices into the 'database'.

I don't think Dennis' example will work - it's too flat. It needs to be multi-level which might start to make it difficult and messy to construct as we're creating a multi-level structure from a flat file... Currently in the zwave binding I think there are 3 levels of configuration and trying to flatten this would be messy.

For information, we have around 170 devices in the zwave database at the moment - it's structured into sub folders based on manufacturers as it would be an unwieldy mess if we had to put them into a single folder...

For zwave, it would be great to combine the device database and the thing files, but we need to solve these issues first as there's a lot of information in the zwave database, and more will be added in future.

Another related question is what does SmartHome do with XML files in the ESH folder - ie if it finds a file that it doesn't know about, does it throw an exception? In the zwave database, I have a file that provides the link between device information that is returned from the devices, and the device types in the database. This was put in a separate file to the device information files to avoid having to recursively iterate through hundreds of files to find the one we want, but - it would be good if these were ignored?

Anyway - some food for thought. I know zwave is probably the extreme end of the spectrum for this sort of thing, but it would be good if we can find a way that allows this sort of thing to be integrated......

Chris
Re: Protocol/binding specific information in Thing descriptions? [message #1658396 is a reply to message #1639575] Sun, 08 March 2015 10:14 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Hi Chris,

Thanks for sharing your experiences. I agree that it would be nice to merge the Z-Wave db together with the thing XMLs - after all, they serve the same purpose. From your input, I see the need for the following features:
1. Add the possibility to have specific content in the XML files in a structured way. I am not sure what this means to the XML parsing and its schema - it is probably the most difficult part to implement.
2. Allow sub-directories inside the ESH-INF/thing folder - all of them should be scanned. This would allow to structure large databases such as for Z-Wave.
3. Ignore any other (XML-)file that is found in the thing folder in order to allow the binding to maintain its very own files along with the thing XMLs.

Btw, do you have any experience what the parsing of such a huge DB means at startup, e.g. on a Raspberry Pi 1? Can we get into performance issues with such a setup?

Regards,
Kai
Re: Protocol/binding specific information in Thing descriptions? [message #1658414 is a reply to message #1658396] Sun, 08 March 2015 10:21 Go to previous messageGo to next message
Dennis Nobel is currently offline Dennis NobelFriend
Messages: 166
Registered: September 2014
Senior Member
Hi,

1) the schema extension is easy, the parser may put in the complete XML Node into the thing type or transform it into a generic map. Both should be possible
2) possible
3) Problem is, that you need to begin parsing to find out if it is a thing type definition or not. Maybe it is better to put such files into a different folder

I also fear that the parsing might slow done the system. I think we measured a parsing time for 100-200 ms for 100 lines of XML file on a QIVICON Homebase (which is comparable to Rasperry Pi 1).

Regards

Dennis
Re: Protocol/binding specific information in Thing descriptions? [message #1658431 is a reply to message #1658414] Sun, 08 March 2015 10:32 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
1) But this would make the "XML Node" a part of the Java-API as well as the bindings do not have direct access to the XML thing type provider, right?
3) Maybe we could restrict it to allow only other file extensions. As I understand Chris, having the files colocated is an important requirement.
Re: Protocol/binding specific information in Thing descriptions? [message #1658489 is a reply to message #1658431] Sun, 08 March 2015 11:05 Go to previous messageGo to next message
Dennis Nobel is currently offline Dennis NobelFriend
Messages: 166
Registered: September 2014
Senior Member
1) The API could have Object as return type and the binding must cast it to the XML specific class. But I guess a transformation into a generic map would be better. Right, bindings don´t have access to the XMLThingTypeProvider yet.
3) Yes, of course we can restrict the parser to parse only files, that have the ".xml" extension. If the specific files are not XMLs, I don´t see a problem.
Re: Protocol/binding specific information in Thing descriptions? [message #1661048 is a reply to message #1658489] Mon, 09 March 2015 13:05 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
The question of speed is an interesting one. In zwave, we have maybe 200 files (last time I counted it was around 180) but we don't scan through them - there's an index which contains the references for the different devices. When I designed the zwave database, this index file was added for exactly this reason...

I can offer a couple of suggestions -:

I keep the zwave database, but add a 'things' section into each device file. The devices are detected as usual by the binding, and the binding then reads the 'thing' part and passes it to 'something' in the ESH core to register the thing? This means that we don't end up having to scan through hundreds of XML files when the binding starts. This was my initial assumption - effectively dynamic generation of things, but handled within the core by passing in a structure to make it a standard interface.

Or, maybe the thing definition 'system' ought to do something similar to zwave anyway, and have an index? ZWave might be at the extreme end of the spectrum with respect to the number of devices out there, but for sure there must be others that over time will build up enough devices to have the same issue. There could be a 'thing index file' with some sort of reference information, and only things that are called up by the system get loaded?

I don't necessarily think collocating the files is a prime requirement - it's just that it would be nice to make use of 'standard' infrastructure where possible, and if the standard system can handle the larger number of things that some bindings may ultimately have. As I said, it's currently split into sub folders to make it more manageable anyway (split by manufacturer).

Cheers
Chris
Re: Protocol/binding specific information in Thing descriptions? [message #1690100 is a reply to message #1661048] Wed, 25 March 2015 09:18 Go to previous messageGo to next message
Karel Goderis is currently offline Karel GoderisFriend
Messages: 198
Registered: March 2014
Senior Member
err.... did I miss something here but how would this differ/compare to the <parameter> in <config-description> ?
Re: Protocol/binding specific information in Thing descriptions? [message #1690229 is a reply to message #1690100] Wed, 25 March 2015 20:40 Go to previous messageGo to next message
Dennis Nobel is currently offline Dennis NobelFriend
Messages: 166
Registered: September 2014
Senior Member
I answered in the new topic: https://www.eclipse.org/forums/index.php/t/1065112/
Re: Protocol/binding specific information in Thing descriptions? [message #1690235 is a reply to message #1690100] Wed, 25 March 2015 22:59 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Quote:
err.... did I miss something here but how would this differ/compare to the <parameter> in <config-description> ?


The issue here (for me anyway) is how to handle additional data that is not what's specified in the ESH file, but is specific to a binding. The example is ZWave where we have a very large database of devices, and there's a lot of configuration that goes into making devices work correctly - it would be difficult to force this into a flat format as currently defined in the ESH metadata (not impossible of course, but extremely messy).

The second issue is how to handle very large numbers of things - again in the zwave database there's getting on toward 200 devices (or things!) and this could be an issue if ESH needs to load all these files (maybe?).

I'm quite keen to work out a solution to this as I'd like to start to play with a version of zwave for OH2, but we need to agree on how to handle this issue first...

Chris
Re: Protocol/binding specific information in Thing descriptions? [message #1690506 is a reply to message #1690235] Fri, 27 March 2015 16:36 Go to previous messageGo to next message
Karel Goderis is currently offline Karel GoderisFriend
Messages: 198
Registered: March 2014
Senior Member
Already thought of developing a custom ThingTypeProvider that encapsulates the access to your current/actual XML based database?
Re: Protocol/binding specific information in Thing descriptions? [message #1690536 is a reply to message #1690506] Sat, 28 March 2015 11:36 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
This is what I've been looking at, but before I jumped in and did that I wanted to have a discussion on this as it's a problem that Kai has already identified. I don't want to spend lots of time doing something that is zwave specific if the concept is going to change.
Re: Protocol/binding specific information in Thing descriptions? [message #1690582 is a reply to message #1690536] Sun, 29 March 2015 12:11 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Hi Kai,
Any further thoughts on this? My current thinking is to use a custom ThingTypeProvider - this works ok with the current database (I have an OH2 version of the zwave binding now), but I'm thinking of changing it to bring it a little more inline with the ESH thing format...

My thinking is to use the ESH format as much as possible , and either write my own custom thing provider, or possibly to start with the code for the XML provider (although I've not tried to dig that out yet). I'd change the existing zwave database format for the config parameters to be the same as ESH - I have one small concern with this and that is I need an index to go with the parameters. I am currently using the name attribute, but this feels slightly wrong - still - as long as ESH doesn't mess with it I should be able to use this.

Another small issue (at the moment) is I have a need for write-only parameters. Some devices use an option to send a fixed value to a device to reset some functionality - you can't read these parameters and doing so is bad (it causes bus timeouts) so I'll need to handle these at some stage. Ideally it would provide a button or something - it's not an issue now though as there's only a small number of these...

I also have an issue with parameterising channels, but I've posted a separate topic on this...

Then there's the more specific zwave device 'stuff' - more detailed device configuration. This is where I don't think I can force the "current" system into the format I need (I say "current" as this thread has been static for 3 weeks and things may have changed? I've seen some movement in commits in this area I think?). However, maybe with a "small" tweek it's possible... Currently, I have a 3 tiered system - I could flatten this to two levels if we could modify the current parameters concept to allow grouping...

At the moment, I think we just have (for example) -:
<thing-type>
  <parameter id="1">value</parameter>
  <parameter id="2">value</parameter>
</thing-type>


what I'd need is a grouping of parameters -:
<thing-type>
  <parameter-group>
    <parameter name="endpoint">0</parameter>
    <parameter name="class">BINARY_SENSOR</parameter>
    <parameter name="setting">getEnabled</parameter>
    <parameter name="value">true</parameter>
  </parameter-group>
  <parameter-group>
    <parameter name="endpoint">1</parameter>
    <parameter name="class">MULTI_LEVEL_SENSOR</parameter>
    <parameter name="setting">getEnabled</parameter>
    <parameter name="value">false</parameter>
  </parameter-group>
</thing-type>

If this was in the pipeline, then we could probably shoehorn the zwave database into this format. It's not as nice as a more custom system that's nicely structured to meet the zwave device structure, but I could probably use it, and the advantage of sticking with a common format would (probably) outweigh the additional coding to support this.

What do you think? I think I've seen some discussion about the parameterisation and some code has been merged recently - maybe you can update us on your thoughts...

I'm quite keen to get the zwave binding working under OH2... I've currently got it running, but can't do too much more until this is resolved as it's so heavily linked to the configuration of the zwave devices. If the decision is that OH2 isn't planning on adding this sort of parameter system in the near future, then I'll continue with my custom thing provider - I'd just be interested in your thoughts as I don't want to have to keep changing the format of 180 config files if I can avoid it Very Happy ...

Thanks
Chris

(sorry - this ended up being a little longer than planned Smile )
Re: Protocol/binding specific information in Thing descriptions? [message #1690588 is a reply to message #1690582] Sun, 29 March 2015 14:55 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Hi Chris,

Sorry for not being responsive on this topic. I actually think it is pretty important and I would very much like to to integrate your ideas as much as possible into ESH.
1. Regarding the original question: I think Z-Wave won't be the only binding to have some custom content in XML, so it imho makes sense to allow such custom sections within the thing XMLs. I so far only briefly discussed this with Dennis, but he felt it should be somehow feasible to do with the current XML parser and thing provider. We will still need to find a way to do it, though.
2. I am also concerned about the number of XMLs we have to parse in the end. So if this can be avoided at startup and we rather maintain an index (maybe this could even be done dynamically?), this might be a good thing in general and not just for Z-Wave. What information would be required in such an index? Only the list of available thing types?
3. Yes, there had been a few PRs in the last weeks around thing types. But they were merely about adding "properties" as a flat list to things - this is nothing that will really help you any further, I guess.
4. Parameter grouping: No, this is not planned and I am not sure, if it makes sense. It rather looks as if these parameter groups are relevant for certain channels or channel-groups - hence I would rather look into adding parameters to those (which has been the idea from the start, it just hasn't been implemented out in detail).
5. write-only functionality: Would you consider these to be device configuration (=parameters) or functionality (=channels)? If they are channels, I think this would simply be a channel that only accepts commands, but which simply keeps the state as undefined. Would that work?

Best regards,
Kai

Re: Protocol/binding specific information in Thing descriptions? [message #1690589 is a reply to message #1690588] Sun, 29 March 2015 15:45 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Hi Kai,
Kai Kreuzer wrote on Sun, 29 March 2015 10:55

1. Regarding the original question: I think Z-Wave won't be the only binding to have some custom content in XML, so it imho makes sense to allow such custom sections within the thing XMLs. I so far only briefly discussed this with Dennis, but he felt it should be somehow feasible to do with the current XML parser and thing provider. We will still need to find a way to do it, though.

I agree - that's great news... If we go down this route it will negate the need for some other bits below.


Kai Kreuzer wrote on Sun, 29 March 2015 10:55

2. I am also concerned about the number of XMLs we have to parse in the end. So if this can be avoided at startup and we rather maintain an index (maybe this could even be done dynamically?), this might be a good thing in general and not just for Z-Wave. What information would be required in such an index? Only the list of available thing types?

I guess this might be binding specific as well - but maybe that's ok - any binding big enough to need an index probably has specific requirements here, but this is an example what I've got for zwave -:

	</manufacturer>
		<!-- FDG211: Dimmer -->
		<product>
			<reference type="0100" id="0104"></reference>
			<reference type="0100" id="0106"></reference>
			<reference type="0100" id="0107"></reference>
			<reference type="0100" id="0109"></reference>
			<reference type="0100" id="100A"></reference>
			<reference type="0100" id="300A"></reference>

			<uid versionMax="1.8">fibaro_fgd211_14</uid>					<!-- VersionMin="1.4" -->
			<uid versionMin="1.9" versionMax="1.11">fibaro_fgd211_19</uid>
			<uid versionMin="2.1">fibaro_fgd211_21</uid>					<!-- VersionMax="2.3" -->
		</product>
	</manufacturer>


I'm still thinking about this though - I wanted to put the uid as an attribute of the product, but the version makes this problematic as it's a separate dimension... Different manufacturers treat these three things differently, but Fibaro use a lot of IDs (for things like different regions) and then each ID can have 'any' version, so it's not straight forward.

Most devices don't use the version information, but there's one (popular) manufacturer who is making prolific use of different identifiers and firmware versions. This is similar to what I have in the OH1 database, except instead of uids, I refer to the filenames...

However, I'm not sure this would eliminate the need to scan all the files - unless the parser had a method to only load requested things rather than all of them, and then there'd need to be some method for naming so it knows what files to load... I've not tried to load all 182 files in the database - what it does mean is you don't have to scan though all the files to find the right references
In my custom thinghandler the loading of the reference file takes no time - but then that's a reasonably well spec'd mac - I suspect it might be different on a Pi level machine...


Kai Kreuzer wrote on Sun, 29 March 2015 10:55

3. Yes, there had been a few PRs in the last weeks around thing types. But they were merely about adding "properties" as a flat list to things - this is nothing that will really help you any further, I guess.

We - it's useful, but not the full solution. I think the properties is a good move, but maybe we cover the main purpose for that in the other thread I started on parameterising things...


Kai Kreuzer wrote on Sun, 29 March 2015 10:55

4. Parameter grouping: No, this is not planned and I am not sure, if it makes sense. It rather looks as if these parameter groups are relevant for certain channels or channel-groups - hence I would rather look into adding parameters to those (which has been the idea from the start, it just hasn't been implemented out in detail).

Yes, and no...
Yes, it's relevant to certain channels - and that's the purpose of my other thread. I definately think we need parameters in channels...
But, no... It's (potentially) also needed for the overall thing definition. We need some way of configuring the device itself - it's not channel specific. In the original example I need to set a bunch of config in the device, and it needs multiple bits of information to do this (eg command class = 1, endpoint = 2, setting = 3 value = 4)...
However, if you think binding specific config data is a possibility, then that's a cleaner solution. The grouping was a way I could see to effectively provide what I want in a simple (but a little messy) way, but it's not really ideal.

Kai Kreuzer wrote on Sun, 29 March 2015 10:55

5. write-only functionality: Would you consider these to be device configuration (=parameters) or functionality (=channels)? If they are channels, I think this would simply be a channel that only accepts commands, but which simply keeps the state as undefined. Would that work?

Yes - that would work fine. Maybe we need to set a context or something as it's not a standard functionality (maybe this is what the channel-type.advanced is for?).

One other point I think I forgot - I need to know the size of the parameter - ie number of bytes to send to the device. Maybe there should be custom parameters in the config descriptions to allow troublesome people like myself to add these sorts of things. Of course I'd be happy to have them added as part of the base definition, but there'll probably be another trouble make come along with more options later Very Happy ...

Cheers
Chris
Re: Protocol/binding specific information in Thing descriptions? [message #1694877 is a reply to message #1690589] Fri, 08 May 2015 15:58 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Eventually I am back on this thread Smile

Just to tick off things that have been or currently are discussed:

5. This is our discussion about actions, right? https://www.eclipse.org/forums/index.php/t/1066252/

4. This is implemented in https://github.com/eclipse/smarthome/pull/272

3. Is available by now

So what is left is:

1. So what are our options here? I see:
a) Let bindings implement their custom parser, which can be helped with by exposing the internals of the current parser. This might result in many incompatible XML schemas and different places to put the files, i.e. the idea of having a common approach would suffer a lot
b) Add a generic element to the schema, which allows a storing additional information. It is not clear to me where we could add that best and how the information would be mapped to the Java model. Having a Map<String,String> in the result is probably not enough as it does not provide any structure (and is thus similar to using the Thing properties).
c) Include structured data within the XML, e.g. a CDATA section where anything could be put - e.g. another custom XML or JSON structure. This would be made available as a String and could be parsed by the binding individually. The downside of this is that the data is not interlinked with the other information in the Thing. It is rather similar as adding an additional file for the custom data.

Are there any other solutions that you can think of?

2. I think we will definitely need an index on the long run. Very often you only want to have a list of available thing types with their label and description, but not all their structural data (channels). We should also have the REST endpoint to only offer this information, unless the client specifically asks for more.
So the question is what data needs to be in such an index and how the link to certain files is done (actually the content might not even be in a file, but being constructed by a dynamic ThingTypeProvider). Would an index entry per thing type be enough? Or would you also see the need for more detailed information like "thing-type=z-wave-motion, vendor=fibaro, fw=1.23"? It seems that your current z-wave index is very detailed, but probably because you have as many thing types available (as every device has a different structure).

Best regards,
Kai
Re: Protocol/binding specific information in Thing descriptions? [message #1694901 is a reply to message #1694877] Fri, 08 May 2015 21:26 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Hey Kai,
Thanks for getting back to this one... As discussed on the other thread, I've spent some time on this with a view to working through what I think I need to zwave, and have derived a schema...

Anyway, let's cover your thoughts first Smile

Kai Kreuzer wrote on Fri, 08 May 2015 16:58

a) Let bindings implement their custom parser, which can be helped with by exposing the internals of the current parser. This might result in many incompatible XML schemas and different places to put the files, i.e. the idea of having a common approach would suffer a lot

As per my comments elsewhere - I think this is still a good option - even if we solve the issue for my use case. On a number of threads you've said that it's always an option to produce a custom reader - in my opinion, I think it's better to have something that is an extension of the XML than something that is totally different. It could still fullfill your idea of autogenerating docs from the XML (so long as the parser ignored bits it didn't know about!), and I think it's a lot better to have something that's (say) 90% common to the standard XML, than 0%! Again, the example here is that I might make a modified XML for the zwave that adds a few extra elements, but that's better than me using the old database format that is just totally different.


Kai Kreuzer wrote on Fri, 08 May 2015 16:58

b) Add a generic element to the schema, which allows a storing additional information. It is not clear to me where we could add that best and how the information would be mapped to the Java model. Having a Map<String,String> in the result is probably not enough as it does not provide any structure (and is thus similar to using the Thing properties).

This could work, but is slightly messy - or could be slightly messy. For example, I really want custom information linked to a) the thing itself, and b) the channels. We could put this all into a custom tag in the thing level, but it just doesn't feel right (but it would work).


Kai Kreuzer wrote on Fri, 08 May 2015 16:58

c) Include structured data within the XML, e.g. a CDATA section where anything could be put - e.g. another custom XML or JSON structure. This would be made available as a String and could be parsed by the binding individually. The downside of this is that the data is not interlinked with the other information in the

I definitely don't like this - too messy - too difficult to get right - we can't use an schema check or anything. Yes, it's simple, but not nice I think.


It might be possible to do something between a and b - allow the specific extensions in a few places. Instead of providing a custom reader, we provide an API that allows elements to be added at specific places.
eg something like

buildThingReader.addChannelExtension(aClass).addThingExtension(anotherClass).build();

And we just add custom readers for the extension classes. This allows the extension in a custom way, but we know exactly where it is. This would also mean that the base reader could be extended to ignore these extensions...

I'd have to look further to see if this would work as I've just thought of this! Smile It might be a reasonable way forward though - if it's something that you might be keen on, I'd be happy to look into it.



Kai Kreuzer wrote on Fri, 08 May 2015 16:58

So the question is what data needs to be in such an index and how the link to certain files is done (actually the content might not even be in a file, but being constructed by a dynamic ThingTypeProvider). Would an index entry per thing type be enough? Or would you also see the need for more detailed information like "thing-type=z-wave-motion, vendor=fibaro, fw=1.23"? It seems that your current z-wave index is very detailed, but probably because you have as many thing types available (as every device has a different structure).

The index might be harder to standardise than the thing files... The primary purpose of the zwave index is to map the metadata that we read from the devices into database entries (and in OH2 we'll map them to things instead of database files). Here we have the 3 bits of information (type, id and version) that are required to uniquely identify a device - or map to a thing.

The problem here is that different systems are likely to have different ways to identify devices and therefore the index needs will be different, so handling this in a system independant way might be difficult. Maybe with some sort of list or something it might be able to be done, but it would need at least 4 bits of information for zwave (since version is actually a range). Or, maybe the index could use a custom class to hold this...

For the first version of zwave binding in OH2 I'm ignoring the index, but it is something I'll want to move back to...

...

Back to my requirements for the extra 'stuff' in the thing file...

I really want to be able to add bits of information into the channel definitions (lets say a list of parameter:value) so that we can parameterise the channels - ideally I'd like to put this in with the channels.

The other thing I want to be able to do is to add a set of 'properties' into the thing since I also need to provide some parameters at device level. The issue here is it needs multiple bits of information, so we either have a three part property, or my thought was to add property groups -:
<a-group>
 <a-property name="class">A<a-property/>
 <a-property name="endpoint">B<a-property/>
 <a-property name="cmd">C<a-property/>
</a-group>


One 'caveat' on this is I now understand that my understanding of properties is wrong - I originally thought that they were not visible to the user, so this might have cause some of the confusion earlier in this thread. I'm not bothered by he name so apologies if I confused things - this information is really not needed to be read/seen by the user - it's solely for the purpose of configuring the binding to work with the thing.

The other way to do this, and it's really horrible, is that I hardcode this information into the binding so that we use the thing uid and some sort of table in the binding. I really don't like this though as we're then defining the thing into multiple places - both the XML, and hardcoded data in the binding. This might be ok where there's only a few different devices being handled, but we've got nearly 200 zwave devices at the moment, and it's increasing nearly daily...

If this doesn't make too much sense, I can provide the schema and example XML - just shout.

Cheers
Chris

(sorry - this is quite a long post - posting the schema and example might be better...)
Re: Protocol/binding specific information in Thing descriptions? [message #1695054 is a reply to message #1694901] Mon, 11 May 2015 15:52 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Hi Chris,

ok, instead of discussing the options for custom XMLs, I would first like to see whether we find a way to adapt the "standard" XML in a way that you get everything in there that you need.

Regarding properties on Things: No, I don't think your understanding was wrong. The properties are really meant as a place for specific information about the thing and they WILL NOT be displayed by the UI in general. Properties can only be used as a mean to have commonly used properties and also have the UI make use of them - but this is imho VERY limited and currently only the case for VENDOR and MODEL_ID - I also talked to Dennis and he agreed that he would not display any other properties in the PaperUI. So this should be fine for you to use "binding internally". Wrt the 3-parts: Could you realize with with prefixes for the keys? E.g.
 <property name="a.class">A<property/>
 <property name="a.endpoint">B<property/>
 <property name="a.cmd">C<property/>


The only other requirement I now read above is to have the same feature on channels, too. So would it be enough if we introduced properties on Channels (that is: ChannelDefinitions)?

Regards,
Kai

P.S.: I'll for the moment postpone the index discussion and concentrate on the XML for now. But this does not mean that I don't want to follow up on it as well!
Re: Protocol/binding specific information in Thing descriptions? [message #1695060 is a reply to message #1695054] Mon, 11 May 2015 16:49 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Hi Kai,
I'll have a think about your suggestion re the prefixes - I think it's probably ok. I think groups is better (neater), but I understand you're trying to avoid feature bloat.

The channel element I want to add properties to is the <channels> element in a <thing-type>.

Something like...
  <thing-type ...>
    <channels>
      <channel id="s" typeId="system.system-channel">
          <property name="A">AAA</property>
          <property name="B">BBB</property>
      </channel>
      <channel id="t" typeId="system.system-channel">
          <property name="A">AAA</property>
          <property name="B">BBB</property>
      </channel>
    </channels>
  </thing-type>


I'd be happy to look at implementing this if you agree...

Cheers
Chris

P.S. I agree about the index - not top priority, but not to be forgotten...
Re: Protocol/binding specific information in Thing descriptions? [message #1695061 is a reply to message #1695060] Mon, 11 May 2015 16:59 Go to previous message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Chris Jackson wrote on Mon, 11 May 2015 18:49

Something like...
I'd be happy to look at implementing this if you agree...

Yeah, that's what I had in mind as well - so if this suits you, feel free to start implementing it!

Cheers,
Kai
Previous Topic:Configuration 'actions'
Next Topic:Smart Home Designer and place of new Bindings
Goto Forum:
  


Current Time: Sat Apr 27 00:24:58 GMT 2024

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

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

Back to the top