Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse SmartHome » Multiple channels versus multiple channel types?
Multiple channels versus multiple channel types? [message #1690579] Sun, 29 March 2015 11:20 Go to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
I'm currently designing the updated zwave database (as per the other thread) and am wondering how best to handle the case where I have multiple switches in a thing...

I see there's two options -:
Specify two channels, each with the same channel-type, and then a single channel-type, or, specify two different thing-types...

To me, it should be the first - specify a single thing-type, but customise this in the channel definition -:

eg -:
	<channels>
		<channel id="dimmer1" typeId="dimmer">
			<properties>
				<property name="endpoint">1</property>
			</properties>
		</channel>
		<channel id="dimmer2" typeId="dimmer">
			<properties>
				<property name="endpoint">2</property>
			</properties>
		</channel>
	</channels>

	<channel-type id="dimmer">
		<item-type>Dimmer</item-type>
		<label>Dimmer</label>
		<description>Set the light level</description>
		<category>Light</category>
	</channel-type>


Is this how it's intended? I don't think the system currently supports the parameterisation of the channels? I see properties were recently added to things but I'm unclear it if covers channels? Also, while most of the configuration of the channel-type is the same for the two channels, it would be nice to provide a different label... Ideally, in my binding, I'd then see a combined list of properties for the channel, including information from the channel definition, and the channel-type, and if the same property existed in both places (eg label) it would be overridden by the channel definition.

The other option is to have two different channel-types, but then why are we separating the channel and channel-type if they are linked 1 to 1.

Have I missed something (probably Smile), or how are others handling this situation?

Re: Multiple channels versus multiple channel types? [message #1690608 is a reply to message #1690579] Sun, 29 March 2015 22:05 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Yes, the idea is clearly to use 1 channel-type and have multiple channels of this type.
Let us leave the properties aside for the moment (since they do not exist for channels right now), then I understand that the problem is that label and descriptions are always the same for all channels, right? This is indeed right, the only visible distinction is the channel id, which might not always be enough. Most obvious solution to me would be to add an optional label and description to the channel definition itself:

	<channels>
		<channel id="dimmer1" typeId="dimmer">
			<label>Dimmer 1</label>
		</channel>
		<channel id="dimmer2" typeId="dimmer">
			<label>Dimmer 1</label>
		</channel>
	</channels>

	<channel-type id="dimmer">
		<item-type>Dimmer</item-type>
		<label>Dimmer</label>
		<description>Set the light level</description>
		<category>Light</category>
	</channel-type>


Would this address the problem?
Re: Multiple channels versus multiple channel types? [message #1690610 is a reply to message #1690608] Sun, 29 March 2015 22:28 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Hi Kai,
I agree with your idea about adding the label, but really the label is the least of my concerns. I'm not sure how to tell the binding what the difference is between the different channels if there's no way to parameterise them....

In zwave, each thing can have quite a few channels - dual switches are quite common, 4 button controllers are also readily available, and without some way to differentiate them I'm not sure how this can be used. This seems quite a fundamental ommision - is this something that's planned? I think otherwise I'll have to think of some nasty hack, (which I'm not sure is possible given the number of configuration options in zwave devices) or adding other information somewhere else to supplement the channel configuration (which seems wrong?)...

Cheers
Chris
Re: Multiple channels versus multiple channel types? [message #1690648 is a reply to message #1690610] Mon, 30 March 2015 11:41 Go to previous messageGo to next message
Dennis Nobel is currently offline Dennis NobelFriend
Messages: 166
Registered: September 2014
Senior Member
Hi Chris,

what about the channel ID? Can´t you use the channel ID to distinguish between the different channels? If you receive a command in the ThingHandler you also get the channel ID. Most of the bindings use the channel ID to decide what to do in the handler.

Can you explain a litte bit more, why you need to parametrize channels? If they are of the same channel type, why does the binding need specific details?

In general the XML was designed in a way, that it tells the framework how the the thing is structured. It was not meant to be to contain binding specific logic or properties , even it would make sense (as we discussed in the other topic).

Regards

Dennis
Re: Multiple channels versus multiple channel types? [message #1690714 is a reply to message #1690648] Mon, 30 March 2015 18:21 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Hi Dennis,
In the old items system, we had the ability to add options to an item definition. In zwave, this might be things like the command class that this item is linked to, and the endpoint number, and possibly some other options like the sensor type or alarm level. I'm effectively looking for a way to add similar parameters to the channels...

Otherwise, I'd need to hard code this into the binding. Every zwave device is different (ok, not every one, but there's a lot of different implementations). I could maybe use the parameterisation at thing level to provide the information on the channel configuration, but this seems very wrong. The other way to do it might be to encode a string into the channel id to code in all this information, but again, this feels very wrong!

Again, this isn't binding specific information, or even thing specific - this is how the binding needs to be configured to talk to this single channel. Am I missing something maybe? How do you envisage that item configuration is done? Is it just mean to be that the binding knows the channel type 'switch1' uses command class=X, with endpoint 1, and 'switch 2' uses command class=Y with endpoint 2 - if so, I might need 20 different switch 'channel-types' which are all the same except for 2 parameters. There might be 5 different temperature 'channel-types' - again, all the same except the endpoint number changes. Then when a new device comes out, instead of updating the thing, I have to update the thing to add the new 'switch xx' with command class=A and endpoint 4 hardcoded into the code...

Is that how you see it's meant to be or do I miss something with how it's designed?

Chris
Re: Multiple channels versus multiple channel types? [message #1690727 is a reply to message #1690714] Mon, 30 March 2015 20:39 Go to previous messageGo to next message
Dennis Nobel is currently offline Dennis NobelFriend
Messages: 166
Registered: September 2014
Senior Member
Hi Chris,

thanks for the explanation. Other bindings like hue, Wemo or LIFX just have a limited set of devices and therefore you can easily "hard-code" the mapping of channels to binding specific logic in the Java classes. The configuration of the thing is comparable to the item configuration in OH1. For example the hue bridge has a configuration parameter "ipAddress", that the user has to fill. The hue lights have an "lightId" config parameter, which again is needed to determine which bulb should be controlled. But for these bindings there was no need to have a declarative way of mapping channels to device-specific structures.

AFAIK you are one of the first developers, which develop a protocol-binding with a huge device database. I think it will be interesting how other protocol-bindings like HomeMatic or ZigBee solve this problem. I´m not sure if KNX also has similar problems.

For the moment we don´t have a solution with the current XML schema. But please don´t encode the information in the channel ID string, this would be indeed very ugly. If we allow to put binding specific content to the XML file (as discussed in https://www.eclipse.org/forums/index.php/t/1015656/), we could also allow to add arbitrary data to the channel definition as well as for the channel type.

Regards

Dennis
Re: Multiple channels versus multiple channel types? [message #1690729 is a reply to message #1690727] Mon, 30 March 2015 21:17 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Hi Dennis,
Yes - I've also hardcoded the channel definitions in the ZigBee binding and it's fine in this cases, but with zwave, there number of options with devices is enormous... ZigBee isn't (as yet) an issue as there is a much more defined relationship between the clusters/devices/things that is simply not there with zwave. With zwave, the interfaces are well defined, but implementation and link with endpoints isn't defined at all with the protocol...

Do you think the channel parameters will be something that could to be added soon? I don't really think I will be able to code the zwave without some parameters and I think it would be good to get zwave running under OH2 - it's one of the bigger bindings and would be a good test of the system (as we're finding Smile).

Chris
Re: Multiple channels versus multiple channel types? [message #1690818 is a reply to message #1690729] Tue, 31 March 2015 13:29 Go to previous messageGo to next message
Dennis Nobel is currently offline Dennis NobelFriend
Messages: 166
Registered: September 2014
Senior Member
Hi Chris,

I don´t know when it can be added. It is a matter of prioritization and I need to discuss it with Kai. But in general you can also create a Pull Request. But the XML parser stuff is a little bit complicated and we need to agree the API extensions first.

Dennis
Re: Multiple channels versus multiple channel types? [message #1690827 is a reply to message #1690818] Tue, 31 March 2015 14:05 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Hi Dennis,
Understood. I did take a look at the parser - not a good look admittedly, but noticed it wasn't as straight forward as I was expecting from the xstream parser...

It would be good if you can let me know if/when you think this can be done. I'd really like to get the ZWave binding written, and I think this would be a good test for the ESH system as it is pushing the bounds a little more than other bindings...

However, I understand priorities aren't always that simple, but I'd really appreciate it if you can let me know if it's something that can be done 'soon' or not. If not, then I'll think about hacking something together instead (which I don't like, but if there's no option, then I think it's better to have a zwave binding than not).

Cheers
Chris
Re: Multiple channels versus multiple channel types? [message #1690979 is a reply to message #1690827] Wed, 01 April 2015 11:59 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Hi Chris, hi Dennis,

Channel configuration parameters were planned from the very beginning - you will notice that the Channel class already has a configuration field. Due to time pressure, this feature has not been implemented for the XML parsing infrastructure as part of the DT contributions, but I think everybody agrees that we cannot do without it.
Please note that there is also a related feature still to be done: Parametrization of item channel links. Please also see this discussion for it: https://www.eclipse.org/forums/index.php?t=msg&th=1063144&goto=1688358&#msg_1688358
I agree that the XML parser is not easy to get into, so asking you for implementing these missing features does not sound fair to me Smile I'll see together with Dennis what can be done within DT regarding the priority of it - you should definitely not go for any ugly hacks or workarounds, that should not be the goal of anybody.

Cheers,
Kai
Re: Multiple channels versus multiple channel types? [message #1691050 is a reply to message #1690979] Wed, 01 April 2015 20:54 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Hi Kai,
thanks for the quick response and your thoughts - all sounds good to me.

Cheers
Chris
Re: Multiple channels versus multiple channel types? [message #1691152 is a reply to message #1691050] Thu, 02 April 2015 14:57 Go to previous messageGo to next message
Dennis Nobel is currently offline Dennis NobelFriend
Messages: 166
Registered: September 2014
Senior Member
Hi Chris,

we just checked the actual state of channel configuration and found out that it should be "fully" supported. You can specify a config description as part of the channel type XML definition and also define the configuration values inside the DSL. I think no one used so it far, so maybe there are some problems.

But I still don´t understand, if you really need the channel configuration. Again the configuration is something, which should be changed by a user (through DSL or UI). If it is more like a static property which belongs to the concrete device, you should not define it as configuration parameter. Then you have to wait for the implementation of the arbitrary content in the XML file.

Regards

Dennis
Re: Multiple channels versus multiple channel types? [message #1691164 is a reply to message #1691152] Thu, 02 April 2015 16:45 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Hi Dennis,
So, I can already have parameters inside channels? Great. So I can do something like this -:
		<channel id="switch" typeId="switch">
			<properties>
				<property name="endpoint">1</property>
				<property name="command_class">BINARY_SWITCH</property>
			</properties>
		</channel>


And then do I end up with a list or something in the channel?

Again, these parameters are not something a user will change. It is the parameterisation of the channel - it tells the BINDING what the configuration is and isn't something the user cares about at all. I've already given an example, so I'm not sure what else to do (obviously my example is not good?). It's also not associated with the device - the device might have 5 endpoints, and I need to link these to the channels somehow. As I think I said earlier, I could possibly add some sort of device level parameters that somehow link the device configuration back to the channels, but this seems the wrong way around. In the device configuration, we should configure the device (node ID, device type, manufacturer etc), and in the channel configuration, we should configure the channel (endpoint number etc) - at least that's what I think, but maybe I'm wrong?

Maybe I'm missing something, so I'll turn the question around - can you can tell me how the binding knows the difference between two light switches inside a device that has individually addressable endpoints without some sort of parameterisation to tell it what the endpoint is, and without hard coding the endpoint somehow? With zwave, there are literally hundreds of devices and I can't hard code all possible options into the binding, but maybe I'm missing how it's meant to work?

Chris

Re: Multiple channels versus multiple channel types? [message #1691172 is a reply to message #1691164] Thu, 02 April 2015 19:12 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Hi Chris,

Ok, actually Dennis was right and what I suggested above was the wrong answer to your requirement. We are currently talking about different things, because we do not use the same vocabulary. When I referred to "parameters", I meant configuration parameters as in https://github.com/eclipse/smarthome/blob/master/docs/sources/architecture/configuration.md#example. These are meant to be changeable by the user in order to configure his personal instance of a thing, i.e. it means that these must be options that can be set on a device in order to behave differently. This is obviously not what you are after. The other thing are "properties" as in your XML example above. This is what we recently added on thing level, but which does NOT exist for channels (yet?). This is more or less static information that you can put in your thing descriptions and which is automatically added to the things. It is not meant to be changed by users and thus not evented.

> can you can tell me how the binding knows the difference between two light switches inside a device that has individually addressable endpoints
I would simply answer as Dennis: The channel id should be the clear identification. If you have device X with 2 switches with endpoints a and b, you would model Thing X with channel a and channel b.
What this answer probably misses is what you mean with "individually addressable endpoints" - could you help us understanding this bit? (sorry if we appear stupid and you explain it for the xth time, but that's life Wink)

Cheers,
Kai
Re: Multiple channels versus multiple channel types? [message #1691181 is a reply to message #1691172] Thu, 02 April 2015 21:58 Go to previous message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Hi Kai,
A zwave device can have a number of 'endpoints'. This is like internal addresses - like a port in TCP - another instance of an internal 'thing'. There's no standardisation on these - so, a device might have a switch that uses endpoint 0, or a switch might use endpoint 1 and endpoint 2 (and/or 3 and 4 if we have a multi scene controller). Likewise for meters - we might have a switch that has 3 or 4 meters over different endpoints. Sensors are even worse - the multi_level_sensor class can employ multiple sensors in different endpoints, but each endpoint can support different, or the same sensor, so we end up with having to specify the endpoint, command class, and sensor type.......

If we don't have some sort of property to say what this configuration is for each channel, then I have to have some other way to tell the binding what the endpoint number is (along with other information such as the command_class, and sensor type etc).

Since there's no standardisation as such on how this all works in zwave - I need some way to link this information to the channel. If I use your concept that we just use the channel type, then I would need a huge number of channel types in zwave to link the different combination of endpoints, command class, sensor type etc. I think that with 180+ devices, I can't hardcode lots of channel options into the binding and then try and link them with the channel-type. Well, yes, it's technically possible, but I think really messy as there would be a lot of different options and it would be prone to error.

The other possibility is that I put the channel definitions into a different place in the database/thing definition, but that seems like a bodge to me (but the best of a number of other less desirable bodges).

Again, this is not user configurable information - I want to be able to specify this in the channel definitions and not have the user have to look at it (or adjust it!). If you've looked at the huge number of confused emails on the OH1 group list about these channel configurations (which are currently done in the binding strings) you'll understand why Sad

Chris
Previous Topic:Actions
Next Topic:Player Type
Goto Forum:
  


Current Time: Sat Apr 27 00:26:05 GMT 2024

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

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

Back to the top