Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse SmartHome » Dynamically changing item-type category during discovery
Dynamically changing item-type category during discovery [message #1769910] Sat, 05 August 2017 11:43 Go to next message
Jabba Loon is currently offline Jabba LoonFriend
Messages: 11
Registered: August 2017
Junior Member
Hi All,

Just wondering if it is possible to dynamically change the item-type category at run-time, ideally during discovery? Have been looking through the documentation and code, but don't see a way to do it.

For an 'Alarm' zone, the zone could be (for example) a Door, Window, Fire etc...
In my case, all have a type of switch and a category (as defined in thing.xml) of 'Alarm'. When I am discovering the zones, I know which category they are so want to assign/change category at this stage.

Obviously, the alternative here could be to have different thing definitions for each of the types of zone (of which there are about 10 in my implementation!), so that would probably not be ideal.

I have also been looking at the possibility of using a ThingTypeProvider to dynamically generate the Thing's during discovery. However, struggling to figure out how to do this based on the documentation I can find and trawling through code to try to find an example! Could anyone point me at some code to give me an idea please!

Thanks
J
Re: Dynamically changing item-type category during discovery [message #1770249 is a reply to message #1769910] Wed, 09 August 2017 11:23 Go to previous messageGo to next message
Henning Treu is currently offline Henning TreuFriend
Messages: 37
Registered: April 2017
Member
Hi Jabba,

from what you are writing it seems the modelling of your things/channels may nit be ideal. The channels of a thing represent the actual functionality the thing provides. In case of an alarm system the different channel types might be "fire alarm", "window alarm" or "door alarm" but all from the same category "alarm". The functionality all these channels provide is of category "alarm". When the channels are linked to items they might be assigned to different locations like "front door", "kitchen window" or "fire alarm basement".
When you discover your thing(s) and want to distinguish between different alarm channels you must provide different channel types. With the "editThing()" method and the resulting ThingBuilder you may then dynamically add channels from different channel-types toi your thing. But channel-types (with categories) have to be defined up front.

I will update the documentation in https://eclipse.org/smarthome/documentation/concepts/things.html to make the modelling of channels a little more clear.

Let me know if you have further questions. Cheers.
Henning
Re: Dynamically changing item-type category during discovery [message #1772431 is a reply to message #1770249] Sat, 09 September 2017 15:05 Go to previous message
Jabba Loon is currently offline Jabba LoonFriend
Messages: 11
Registered: August 2017
Junior Member
Hi Henning,

Sorry for the delay in replying. Was away for a while. Thanks for info, think that makes sense to me! Will study a bit more and make some changes in my approach.

Cheers,
Jabba
Previous Topic:Can i deploy and run ESH in any server
Next Topic:Event driven binding - Implementation pattern advice
Goto Forum:
  


Current Time: Sat Sep 22 02:54:39 GMT 2018

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

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

Back to the top