Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse SmartHome » How can I remove the Thing in Binding?
How can I remove the Thing in Binding? [message #1511803] Mon, 15 December 2014 07:10 Go to next message
keven d is currently offline keven dFriend
Messages: 2
Registered: December 2014
Junior Member
Hi,
I want to create my binding having one bridge, and many things.

I reference the Hue Binding, so I can add discovered bridge and things.
But I want to remove the things in BridgeHandler when I push the button (receive command)

In this way,
Is it right flow in Binding?

1. reference ManagedThingProvider in HandlerFactory
2. when BridgeHandler receive command,
3. call ThingHandler function(ex, onThingRemoved)

4. in ThingHandler function onThingRemoved()
-> managedThingProvider.remove(getThing().getUID())

or is another way to remove the thing in Binding BridgeHandler?

I think this is not smooth, so could you explain the right way for me?

regards,
Keven.
Re: How can I remove the Thing in Binding? [message #1512388 is a reply to message #1511803] Mon, 15 December 2014 18:06 Go to previous messageGo to next message
Dennis Nobel is currently offline Dennis NobelFriend
Messages: 166
Registered: September 2014
Senior Member
Hi Keven,

a binding should not delete things on its own. Things are deleted by the user from a UI. You can react on deletion inside the ThingHandlerFactory.

What is your use case, that you want to delete things inside a BridgeHandler? What kind of binding are you developing?

Regards

Dennis
Re: How can I remove the Thing in Binding? [message #1512704 is a reply to message #1512388] Tue, 16 December 2014 00:19 Go to previous messageGo to next message
keven d is currently offline keven dFriend
Messages: 2
Registered: December 2014
Junior Member
Hi, Dennis
But like z-wave,
controller can delete or add the node, so I think bridge have to remove the thing.
What do you think about this?

Regards,
Keven

Re: How can I remove the Thing in Binding? [message #1513159 is a reply to message #1512704] Tue, 16 December 2014 09:17 Go to previous messageGo to next message
Dennis Nobel is currently offline Dennis NobelFriend
Messages: 166
Registered: September 2014
Senior Member
Hi Keven,

actually I don´t know the z-wave binding. And I think it is an OH1 binding, so it does not use the new APIs. In the new APIs, if a binding finds a new device it should be put into the inbox through a DiscoveryService. After this, the user can accept the device and it will be available as a thing. If a device should be deleted, it should be triggered by the user, not by the binding. But the binding can react on it.

Does this help you? Otherwise could you explain your use cases for adding and removing devices a little bit deeper, please? So in which situations exactly do you want to add ore remove a thing?

Regards

Dennis

Re: How can I remove the Thing in Binding? [message #1513191 is a reply to message #1513159] Tue, 16 December 2014 09:52 Go to previous messageGo to next message
Karel Goderis is currently offline Karel GoderisFriend
Messages: 198
Registered: March 2014
Senior Member
Denis,

I think Kevin wants to keep the real world in sync with the abstract ESH world. Since discovery is about adding devices, logically, you would also expect the runtime to be able to deal with the disappearance of devices.

btw, this is something we are also struggling with in the Sonos 2.0 UPNP based binding, where there is a requirement to detect the removal of a Sonos device, but for which we now have to implement a separate polling/is-alive process.

I understand we keep track of disappeared devices as we set the status to OFFLINE, but changing the state to OFFLINE implies a detection mechanism. So, do we keep track of a device and flag it OFFLINE (and a user is aware that a device existed/was online at a given point in time), or do we remove disappeared devices altogether? I am not sure that either scenario is perfect, e.g. environments with lots of things, or fast changing networks (for example, part of zigbee/zwave/... mesh disappearing suddenly,...)

K
Re: How can I remove the Thing in Binding? [message #1513480 is a reply to message #1513191] Tue, 16 December 2014 15:20 Go to previous messageGo to next message
Dennis Nobel is currently offline Dennis NobelFriend
Messages: 166
Registered: September 2014
Senior Member
Hi Karel,

Thanks for the help. Yes keeping the real world in synch would mean in that case to mark the thing as OFFLINE. Because assuming a thing should be removed permanently, just because its not present any more, is wrong from my perspective.

Lets take the HUE bridge for example. If I just plug-out the cable, the thing should still remain and it also still exists, but the runtime can give me a hint that it is not accessible any more. If the user really removed the device permanently (maybe because he sold his hue), he can in that case remove on its own. So only the user knows when a device is removed and added, but the runtime can indicate if its accessible.

Regards

Dennis
Re: How can I remove the Thing in Binding? [message #1519777 is a reply to message #1513480] Sat, 20 December 2014 21:59 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Dennis, Your example is valid for the Hue bridge, but what about the devices on the bridge? As the bridge manages the Zigbee network, only devices that are known to the bridge make sense to be available as "Things" in ESH. It is the same situation for a "managed" network such as Z-Wave. So I indeed wonder whether we should allow a kind of "negative discovery", which would at least suggest the removal of things to the user (or similar to the auto-approve an auto-removal)?
Re: How can I remove the Thing in Binding? [message #1521225 is a reply to message #1519777] Sun, 21 December 2014 17:43 Go to previous messageGo to next message
Dennis Nobel is currently offline Dennis NobelFriend
Messages: 166
Registered: September 2014
Senior Member
Maybe this can solved with a new thing status "REMOVED"? So the user does at least know, that something is no longer available. I don´t see a real need for removing devices automatically. If the system is not managed by ESH or openHAB and things are deleted permanently in the external system, the effort to remove a thing from ESH is not that big.
Re: How can I remove the Thing in Binding? [message #1521415 is a reply to message #1521225] Sun, 21 December 2014 20:16 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
A REMOVED status sounds like a possible solution. What do others think?
Re: How can I remove the Thing in Binding? [message #1523154 is a reply to message #1521415] Mon, 22 December 2014 19:23 Go to previous messageGo to next message
Karel Goderis is currently offline Karel GoderisFriend
Messages: 198
Registered: March 2014
Senior Member
Well, that is a good suggestion but should the REMOVED status not be on a different axis than ONLINE and OFFLINE? My guess is that we have another dimension with an AVAILABLE and UNAVAILABLE state. You most likely will then argue that a UNAVAILABLE device should be OFFLINE, but that does not hold true perse. Just think about caching events for ONLINE devices in a queue, and then play back those events when a device come AVAILABLE again, or.... also, you can have devices that are AVAILABLE, e.g. physically alive, but that you want to put in an OFFLINE state because you want to cut it off events or control....

err... things are getting complicated here Wink

K
Re: How can I remove the Thing in Binding? [message #1523358 is a reply to message #1523154] Mon, 22 December 2014 22:06 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
AVAILABLE/UNAVAILABLE is the same to me as ONLINE/OFFLINE. Making subtle further distinctions indeed complicates things here too much and I would refrain from this.
Re: How can I remove the Thing in Binding? [message #1691140 is a reply to message #1523358] Thu, 02 April 2015 14:09 Go to previous messageGo to next message
Lars Blumberg is currently offline Lars BlumbergFriend
Messages: 1
Registered: April 2015
Junior Member
As far as I can see ESH doesn't support unpairing devices yet. However using a Z-Wave binding we are already able to pair Z-Wave devices ("nodes") with the Z-Wave controller in ESH discovery mode. This pairing is physical and the controller and the node therefor need to be unpaired. Otherwise this node cannot eventually be used with another controller as it will remain paired. This said, simply removing things from ESH isn't enough. How is your opinion about such a "removal" mode that could be understood as the opposite to the existing discovery mode? As we need that feature I would like to implement it. Are their any resources/starting points available that describe such a feature or do I need to add it from scratch?
Re: How can I remove the Thing in Binding? [message #1717114 is a reply to message #1691140] Thu, 10 December 2015 02:48 Go to previous messageGo to next message
Jongmin Kim is currently offline Jongmin KimFriend
Messages: 11
Registered: May 2015
Junior Member
I agree to the comments of Lars Blumberg.
So, an implemention can be like below:
1) The "startScan() method" will be seperated with "startScanAdd() method" and "startScanRemove() method".
2) The "startScanAdd() method" will be used to the inclusion of device(like zwave, zigbee...).
3) The "startScanRemove() method" will be used to the exclusion of device(like zwave, zigbee...).
Re: How can I remove the Thing in Binding? [message #1717545 is a reply to message #1717114] Mon, 14 December 2015 16:23 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Sorry Lars, I lost to follow up on this thread.
We have meanwhile implemented a thing removal mechanism (see https://www.eclipse.org/smarthome/documentation/development/bindings/thing-handler.html#handling-thing-removal), where the thing handler can actively handle a thing removal. So if the user "deletes" the thing in the UI, the handler can unpair the devices from the controller, so that they are in a clean state afterwards and not part of the network anymore.

[Updated on: Mon, 14 December 2015 16:23]

Report message to a moderator

Re: How can I remove the Thing in Binding? [message #1717578 is a reply to message #1717545] Tue, 15 December 2015 02:50 Go to previous messageGo to next message
Jongmin Kim is currently offline Jongmin KimFriend
Messages: 11
Registered: May 2015
Junior Member
Hello, Kai.
I have one question, about your answer.
A zwave device requires the "device deletion request" API.(startscan is the "device addition request" API)
But at your reply, I can't understand about zwave device deletion API.
So, Can you tell me, about zwave device deletion API?

[Updated on: Tue, 15 December 2015 02:51]

Report message to a moderator

Re: How can I remove the Thing in Binding? [message #1718023 is a reply to message #1717578] Fri, 18 December 2015 15:40 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
You are right, my answer did not fit well on how ZWave works, where you need to set the controller to an exclusion mode in order to unpair devices.
I think this behavior is pretty specific for ZWave, hence I would not want to add it as a general concept in the API. The easiest solution is probably to have a "mode" channel on the controller, where the user can manually set the exclusion mode - while in this mode, he can unlearn his devices.
Re: How can I remove the Thing in Binding? [message #1718124 is a reply to message #1718023] Sun, 20 December 2015 08:56 Go to previous message
Jongmin Kim is currently offline Jongmin KimFriend
Messages: 11
Registered: May 2015
Junior Member
Hello, Kai.

I understand you explain, and I agree your answer.
At Zwave exclusion, I will consider your answer.

Thank you, for your relpy.
Previous Topic:writeOnly channel
Next Topic:ClassNotFoundException when running ESH tests
Goto Forum:
  


Current Time: Fri Apr 19 10:05:08 GMT 2024

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

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

Back to the top