Design question: searching for things (getThingByUID) [message #1768281] |
Sun, 16 July 2017 20:20 |
Massi Ti Messages: 3 Registered: June 2017 |
Junior Member |
|
|
Hallo,
In the new binding I am writing for OH2, devices are identified as:
mybinding:deviceType:bridgeID:deviceID
where deviceID is the unique ID used to identify devices in the network protocol I am integrating, while deviceType is set during Thing discovery phase.
Then when a new device event arrives from the network protocol I need to associate the event to the Thing/ThingHandler, so I need to use getThingByUID() in the bridge handler.
However, I cannot search for the Thing as the network protocol event does not bring any info on the device type, only the deviceID.
So I cannot associate network protocol events coming from a specific deviceID with the corresponding Thing in ESH.
What is the right design approach to be used?
OPTIONS:
1) I could avoid using deviceType in the ThingUID:
mybinding:bridgeID:deviceID
but this way the UI/user will miss the info that this device is of that specific deviceType.
2) Another option would be to have a more flexible method getThingByUID capable of finding Things also with "*" search, for example:
getThingByUID("mybinding:*:bridgeID:deviceID")
to find the Thing with ID=deviceID, regardless of its specific type.
Any other suggestion?
Thanks a lot,
Massi
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06092 seconds