Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse SmartHome » Best way to implement Discovery without known thingtype
Best way to implement Discovery without known thingtype [message #1769416] Mon, 31 July 2017 12:14 Go to next message
Marcel Verpaalen is currently offline Marcel VerpaalenFriend
Messages: 59
Registered: September 2014
Member
I'm trying to improve discovery for miio.
The challenge is that the thingType is only known once a secret is provided. Only with the secret the thing can be queried for it's thingType.

I see 2 scenario's that could be possible
1) Discover the generic type, add ti to the inbox as a generic type, Let the user accept the discovery result and create the thing. Than the user can add the secret.
Once the secret is added, discovery the thingType. Change the thing to the proper thingType.

Challenge with this approach is that it is not directly eas/possible to change a thingType

2) Start the same as approach 1: Discover the generic type, add ti to the inbox as a generic type, Let the user accept the discovery result and create the thing. Than the user can add the secret.

Than add a new discovery result with the right thingType and the user can accept it as usual.

Challenge with this approach is that the user ends with 2 things, the now obsolete generic thing and the proper one.

In both cases, the additional challenge is how to prevent the discovery to discover the thing again as generic type once it is known with the proper thingType.
The way I currently envision is to use the ExtendedDiscoveryService and test for each possible thingType, and if all non-existent add it with the generic type.

Anyway, any suggestions on how to best handle this flow?
Is there a easy way to change the thingType for a thing?
Re: Best way to implement Discovery without known thingtype [message #1769427 is a reply to message #1769416] Mon, 31 July 2017 13:22 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Your first option is what the OH Zwave binding does - not because it has to exchange a secret, but because the information required to derive the thing type is not known initially.

There are methods to change the thing type from the handler once the thing is instanciated so this option should work fine.

Chris
Re: Best way to implement Discovery without known thingtype [message #1769645 is a reply to message #1769427] Wed, 02 August 2017 11:27 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 661
Registered: December 2011
Senior Member
Indeed, the method BaseThingHandler.changeThingType() has been specifically introduced for such use cases!
Re: Best way to implement Discovery without known thingtype [message #1769695 is a reply to message #1769645] Wed, 02 August 2017 17:54 Go to previous messageGo to next message
Marcel Verpaalen is currently offline Marcel VerpaalenFriend
Messages: 59
Registered: September 2014
Member
Thanks Kai&Chris.
Okay, thought something like that existed, but could not directly find it.

Got it to work, but still with bit of unexpected behaviour;
I assumed the thing uid would be changing, bit send the uid remained the same, and only thingtype changed, making the thingtype as indicated in the uid not match the true thing type.

It's that intended behaviour? It is not directly affecting the working, but I did find it confusing.
Re: Best way to implement Discovery without known thingtype [message #1769696 is a reply to message #1769695] Wed, 02 August 2017 17:57 Go to previous message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Yes - that's intended. The thing type UID changes - not the thing uid.

Originally the thing type was derived from the thing uid, but this was changed to support this functionality.

Chris
Previous Topic:lwm2m binding (Lightweight machine 2 machine protocol)
Next Topic:Build error
Goto Forum:
  


Current Time: Thu Nov 15 20:49:49 GMT 2018

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

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

Back to the top