Home » Archived » Eclipse SmartHome » Overriding channel labels
| | | | | |
Re: Overriding channel labels [message #1702679 is a reply to message #1702192] |
Fri, 24 July 2015 06:22 |
Chris Jackson Messages: 256 Registered: December 2013 |
Senior Member |
|
|
This is mostly done, but there's an issue with the way channel enable/disable is implemented (I think I've raised this before but can't find the reference now).
When you enable / disable a channel, what you're really doing is adding and removing items. To me, this doesn't seem the right thing to do - it means that sitemaps will get messed up when I disable a channel. I think the channel should remain until things are deleted (or the item is explicitly deleted) and the channel should be marked as disabled...
The reason I raise this again here is that it causes a problem with the implementation of the labels. When creating a thing, and it's channels and items, we have access to the channelType and the channel. However, when enabling/disabling a channel through the REST interface, that's not the case. So, I've implemented the label override, and it works when you create a thing - the information in the GUI for both label and description is correct. However, it's not possible to make this work if you re-enable a channel.
I would like to propose that channels should have a flag to say they are disabled, and items should remain.
Cheers
Chris
|
|
|
Re: Overriding channel labels [message #1702799 is a reply to message #1702679] |
Fri, 24 July 2015 16:57 |
gael lhopital Messages: 6 Registered: May 2014 |
Junior Member |
|
|
In the line of this subject (well, I think so) - how should I manage the following case :
My chanel-type "temperature" holds an attribute pattern="Indoor temp [%.1f °C"]
In the binding, it is likely that the user has opportunity to have switched to american unit system, then the value will be expressed in °F, how to change the chanel-type associated with the chanel ?
[Updated on: Fri, 24 July 2015 16:58] Report message to a moderator
|
|
|
Re: Overriding channel labels [message #1702901 is a reply to message #1702799] |
Mon, 27 July 2015 10:12 |
Kai Kreuzer Messages: 673 Registered: December 2011 |
Senior Member |
|
|
Quote:what you're really doing is adding and removing items. To me, this doesn't seem the right thing to do - it means that sitemaps will get messed up when I disable a channel.
I agree. Creation of items is a "quick win" feature for easy setup, but editing Things should not mess around with existing items.
Quote:I would like to propose that channels should have a flag to say they are disabled, and items should remain.
I don't think we need a flag - the "sign" whether a channel is enabled or not is actually the link to an item. So disabling a channel simply means removing the link. Additionally, what should be done is to remove the item from the "thing" group item, so that this group reflects the right set of channels. But the item should not be deleted automatically (or rather only optional through a config admin property, if a solution always wants to delete items automatically).
Quote:My chanel-type "temperature" holds an attribute pattern="Indoor temp [%.1f °C"]
From this, only "Indoor temp" is the label, the rest is the state description, which should not be transferred to the label at all, right?
Quote:how to change the chanel-type associated with the chanel ?
With the introduction of the ChannelTypeRegistry, the channels will refer to a channel type and thus it should be possible to change the type (my guess without looking deeper into it right now).
Regards,
Kai
|
|
| | |
Re: Overriding channel labels [message #1702979 is a reply to message #1702905] |
Mon, 27 July 2015 16:37 |
Chris Jackson Messages: 256 Registered: December 2013 |
Senior Member |
|
|
I'm happy to have a look at it - probably as a separate PR though to keep it clean.
However, I think it needs a bit more thought. I agree that removing the link between channels and items will fix the problem, but, it raises another issue - how to reinstate the links when the channel is re-enabled. If there was only ever 1 item associated with a channel, then the answer is simple as the name is directly derived from the channel (if I remember correctly), but as the system supports multiple items for each channel, in which case, once the link if broken, there's no way to reinstate it...
The easy answer is not to support multiple items for a channel. I think this was the original implementation, but I recall reading a post to say that this was changed... I'm not sure I completely understand why you'd want multiple items for a channel, but I'm sure someone has a reason that I've not thought of yet
|
|
|
Re: Overriding channel labels [message #1703055 is a reply to message #1702979] |
Tue, 28 July 2015 11:26 |
Kai Kreuzer Messages: 673 Registered: December 2011 |
Senior Member |
|
|
Let me try to explain this with a wider view: My vision for advanced (i.e. current openHAB 1) users is to have an editor which lists things with its channels left and items right and allows to easily drag channels onto items, which creates a link between them, meaning that the item is "fed" through this channel (in openHAB 1 speak: There is a binding config like { channel="" } added to the item). Deleting these links is then the same as disabling a channel (for a certain item).
Now the current implementation of the ThingSetupManager was heavily influenced by the short-term needs of the Paper UI at that time. As the Paper UI has no way to edit items and no way to administrate the links between channels and items, it simply creates the items+links automatically through the ThingSetupManager. I do not consider this to be the "best practice", but it makes sense to provide an easy start for beginners (as they do not have to know at all about items and links). So the enable/disable functionality in the ThingSetupManager assumes a fixed (the derived) item name for the link. If this item does not yet exist, it will create it, otherwise only the link is created.
To answer why you can link multiple items to a channel: Allowing just one quickly came up as an issue, because the one linked item was always the one created by the SetupManager. If you know wanted to define your own items in an item file and you added { channel="xyz" } to it, this item never received events, because it was the second item linked to the channel, which was not supported. And since in openHAB 1 you can also have the same binding configuration on multiple items, the same is done here.
I hope this explains it and it makes sense to you!
|
|
|
Re: Overriding channel labels [message #1703067 is a reply to message #1703055] |
Tue, 28 July 2015 12:22 |
Chris Jackson Messages: 256 Registered: December 2013 |
Senior Member |
|
|
Kai Kreuzer wrote on Tue, 28 July 2015 12:26Let me try to explain this with a wider view: My vision for advanced (i.e. current openHAB 1) users is to have an editor which lists things with its channels left and items right and allows to easily drag channels onto items, which creates a link between them
That's fair.... For current OH1 users, this sort of thing would seem fine... But...
What about people who really don't wanna bother with all that complex linking stuff - it's all just a bit too much hard work sometimes
How about the following use case -:
I have a channel, which is linked to a couple of items. This channel has become unreliable, so I decide to disable it. Once I've fixed the sensor, I want to re-enable it... Now I've got to remind myself what all the items were that were linked to the channel. If I have a few hundred items, then it's a little messy at best. If we've unlinked the channels and the items, there's no automatic way to get this link back (short of storing it somewhere else). It just seems that I've made a lot of work for something that seems like it ought to be simple (ie enable/disable a channel for a short period of time).
I could set up some sort of 'removed link store' in HABmin to allow recreating the links between the items and but I kind of thing the framework should do this? Based on the above use case, which I think should be quite common (??) I would think a simple 'channel enabled' flag might still be worth considering? Or (and you'll probably have this more ) adding a link enabled flag into the link?
We could say that for a simple, user oriented system, that we only support a single channel-item link, then the problem goes away. I just fear that since the system doesn't limit this, that some time soon someone will come up with a really good use case for multiple items, and then this single item concept will not be possible...
What do you think? I'm really coming at this from the simplistic perspective - ie trying to make this presentable to someone who doesn't care about links, barely cares about channels, items, things and widgets, but just wants to make the lights come on reliably (eg my girlfriend!)
|
|
| |
Re: Overriding channel labels [message #1703074 is a reply to message #1703073] |
Tue, 28 July 2015 13:26 |
Chris Jackson Messages: 256 Registered: December 2013 |
Senior Member |
|
|
Kai Kreuzer wrote on Tue, 28 July 2015 14:01
Telling a channel to keep quiet ALTHOUGH it is linked to items is a completely different requirement to me and one that I didn't come across yet. Do you really see a need for this?
I would think that either at the channel, or thing level that there should be a way to temporarily disable the data stream without having to delete things/channels/items. Maybe the channel isn't the best place to do it, but I had thought that this is what enable/disable was there for.
Is there already a way to take a thing offline (ie for the user to force it to be offline)? If so, this would be a possible way to do this.
Kai Kreuzer wrote on Tue, 28 July 2015 14:01
Wrt the simple view (your girlfriend): These people will be fine with the default items and will never have any other items and links to the same channel, so there is no problem. But this won't be enough for advanced users and especially, it would be very much incompatible to openHAB 1 and thus hinder the users to migrate.
Yes - you're probably right, but as I said earlier, when some bright spark comes up with a really cool use case for having multiple items linked to a channel, if we make the assumption that this isn't possible for 'simple users' (who I suspect should make up a large user base - not just my girlfriend ) then we are in trouble. Maybe we deal with that situation if/when it occurs?
Chris
|
|
| | | | | | | | |
Re: Overriding channel labels [message #1710936 is a reply to message #1702084] |
Sun, 11 October 2015 12:41 |
|
To point to the first topic of this thread, what is the current solution for using a device / thing with multiple switches?
What is the use case for set a thing offline if the device is online or to disable a channel / link to an item?
IMHO if we are using items in rules, the only use case I see is to disable an item, so it does not handle any received event.
|
|
| |
Re: Overriding channel labels [message #1711033 is a reply to message #1703074] |
Mon, 12 October 2015 13:38 |
|
Chris Jackson wrote on Tue, 28 July 2015 13:26
I would think that either at the channel, or thing level that there should be a way to temporarily disable the data stream without having to delete things/channels/items. Maybe the channel isn't the best place to do it, but I had thought that this is what enable/disable was there for.
Is there already a way to take a thing offline (ie for the user to force it to be offline)? If so, this would be a possible way to do this.
What is the use case for set a thing offline, if the device is online?
What is the use case to remove a channel-item link temporarily?
|
|
| | | | |
Re: Overriding channel labels [message #1711302 is a reply to message #1711132] |
Wed, 14 October 2015 17:16 |
Chris Jackson Messages: 256 Registered: December 2013 |
Senior Member |
|
|
Jaime Vaz wrote on Tue, 13 October 2015 12:14HI!!
The relay board has 8 outputs, and I want to label it with name of the device that is connected to output. (Example: Floor Lamp, Lamp, Washer Machine, Heater, ...)
Then just name the items Floor Lamp, Lamp, etc... Items and channels don't have to have the same name.
So, you can have a channel called, Relay 1, Relay 2 etc, but the items connected to these channels can have different names (as above).
|
|
|
Goto Forum:
Current Time: Tue Sep 24 06:50:22 GMT 2024
Powered by FUDForum. Page generated in 0.07369 seconds
|