Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse SmartHome » Base Item / Function of Group item(Can base item / function be changed?)
Base Item / Function of Group item [message #1708048] Fri, 11 September 2015 17:40 Go to next message
Smart Home is currently offline Smart HomeFriend
Messages: 109
Registered: February 2015
Senior Member
Hi,

Is it possible to change the base item of a group item? The function?

I want to be able to define a group but not to define it's base item / function. Only when first item is added I want to define it. I also want to be able to change the group function.

Currently the only solution I see is to delete the group and create a new one. Am I right?

Thx

Re: Base Item / Function of Group item [message #1708151 is a reply to message #1708048] Mon, 14 September 2015 09:50 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Correct, currently a GroupItem gets its base type and function through the constructor, so there is no way to change it afterwards again.
I don't think this should be changed as it might be pretty surprising for clients if a group type and behavior suddenly changes (and we would have to introduce new kinds of events for that).

So yes, the suggested way would be to delete the group and create a new one with the same name; the member items should hopefully be automatically re-added.
Re: Base Item / Function of Group item [message #1708188 is a reply to message #1708151] Mon, 14 September 2015 12:36 Go to previous messageGo to next message
Smart Home is currently offline Smart HomeFriend
Messages: 109
Registered: February 2015
Senior Member
I thought of the following scenario:

I have a group of temperature sensors which based on the group value (= temperature) I want to start / stop a device. I want to give the user the option to decide how to sum the sensors temperature e.g., Avg / Min / Max.

Isn't it a valid scenario? Why for this scenario I need to recreate the group again? Note the the base item remains Number, only the function changed.

Creating a new group here seems to be overhead ...


Re: Base Item / Function of Group item [message #1708191 is a reply to message #1708188] Mon, 14 September 2015 12:47 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
> only the function changed

No, actually the semantic changed. The items represent a "piece of information" of your system, and "the average temperature" and "the maximum temperature" are obviously two different pieces of information - hence there should be two different items for them.
Re: Base Item / Function of Group item [message #1708193 is a reply to message #1708191] Mon, 14 September 2015 12:58 Go to previous messageGo to next message
Smart Home is currently offline Smart HomeFriend
Messages: 109
Registered: February 2015
Senior Member
If I understand you correctly, what you mean is that I need to create different groups just for functionality. IMHO it is overkill for the user. I agree that for base functionality (= changing the base item) new group is needed, but changing the functionality shouldn't force changing the group.

Re: Base Item / Function of Group item [message #1710446 is a reply to message #1708193] Tue, 06 October 2015 17:04 Go to previous messageGo to next message
Smart Home is currently offline Smart HomeFriend
Messages: 109
Registered: February 2015
Senior Member
How can I create base item and add it to a group? I need an access to the item factories but currently AFAIK there is no way to access the factories directly as there is no ItemFactoryRegistry.

ThingSetupManager has method getItemFactoryForItemType but it is a private method.

Thx
Re: Base Item / Function of Group item [message #1711366 is a reply to message #1710446] Thu, 15 October 2015 11:28 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Well, you can directly use the CoreItemFactory or the constructor of GroupItem.
Re: Base Item / Function of Group item [message #1711371 is a reply to message #1711366] Thu, 15 October 2015 11:52 Go to previous messageGo to next message
Smart Home is currently offline Smart HomeFriend
Messages: 109
Registered: February 2015
Senior Member
But what if there is more than one item factory?

Note that ThingSetupManager & ManagedItemProvider have:

private List<ItemFactory> itemFactories = new CopyOnWriteArrayList<>();


Why there is no ItemFactoryRegistry? This would have solve the issue.
Re: Base Item / Function of Group item [message #1711384 is a reply to message #1711371] Thu, 15 October 2015 12:51 Go to previous message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
You can have the itemFactories injected and iterate through them yourself.
But in fact there is only the one CoreItemFactory. We are actually moving away from the extensibility of item types as this concept was hardly used over the years and rather caused problems. So it should be ok just to fall back to the CoreItemFactory for you.
Previous Topic:Adding Dynamic channels to a thing type
Next Topic:org.eclipse.smarthome.core.scriptengine 0.0.0' but it could not be found
Goto Forum:
  


Current Time: Thu Apr 25 03:42:41 GMT 2024

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

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

Back to the top