Closed eikowagenknecht closed 2 years ago
This issue has been mentioned on openHAB Community. There might be relevant details there:
I just now discovered that random other devices (even from other bindings!) get ignored instead:
Maybe there is some ID getting mixed up?
Each binding makes its own decision about what to do with discovered things when the binding is shutting down. Some of them, like the Hue binding, decide to remove the discovered things from inbox. When the binding is restarted, things are then discovered again. https://github.com/openhab/openhab-addons/blob/main/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/discovery/HueDeviceDiscoveryService.java#L134
I already reported that few years ago. This was not considered as a bug. If I correctly remember, there were even arguments in favor of this behavior. At that time, I searched how many bindings were doing that and if I correctly remember, it was a minority. But the Hue binding is an example.
The only reason I can think of when removing items is a good idea is when they no longer exists (e.g. lamp has been removed from the hue bridge). But even then not all items would need to be removed and added again. There might be more technical reasons of course but that should not affect the user.
And even in the case of an item that has been removed and added again I'd argue that the OH system should still be able to track the "ignored" state.
An example of how it should work (imho):
Also see the comment from papaPhiL in the community thread and my observations that other items get ignored instead. So there seems to be something else going on or maybe a combination of different problems.
When a thing is removed from the inbox, it is removed and so the fact that it was previously marked as ignored is of course lost. It makes no sense to keep such info eternally.
I will try to identify the bindings removing the inbox entries at shutdown.
Maybe we could add an API for bindings to remove only the entries not marked as ignored. This will solve the problem.
I agree that it is not needed to keep this "eternally". But the usual case is like you said a reboot or like in my example a device that is sometimes available and sometimes not. So a shorter timespan (maybe a week) would be fine I think. Also only the ids would have to be saved on an "ignore list" and typically there are not too many items that are ignored (who will click ignore >1000 times? ;-)) so space usage for that information is almost non existent.
I have to add that I have no idea of the core and addons codebases yet, so I don't know where exactly all the inbox stuff is handled currently.
Maybe we could add an API for bindings to remove only the entries not marked as ignored. This will solve the problem.
This would leave devices that are not available anymore (and have previously been ignored) in the inbox, so they would be shown in the UI with "show ignored" filter on. The UI then would need to filter them out (because adding those at a time when they are not available any more doesn't make much sense).
The ignore property is not saved in a different file/DB, it is simply a field of the inbox entry. I am really curious how many bindings are concerned. Will see.
I had one annoying situation during testing. I was running PH2 & OH3 in Docker images on the same host and using the remoteopenhab
binding. I accessed the OH2 instance using the host ip address because the Docker network address gets reassigned after a reboot. The Inbox kept getting populated with the OH2 Docker address even after ignoring it.
Perhaps a binding should have an advanced option to disable automatic discovery? That would give advanced users fsome control and assume they know what they are doing.
That is a fully different story! Please open a new feature enhancement. With the remote openHAB binding, normally every inbox entry marked as ignored is still ignored after a server restart.
On this, as lolodomo mentioned this in a bug that I raised.
The behavior for the Hue Binding definatly has completely changed from OpenHAB 2.5.12 to OpenHAB 3.x. In 2.5.12, ignored Hue items would stay ignored persistently. Even after a restart.
In OpenHAB 3.x it discovers all devices, that aren't added on every reboot. For me, that's over 100 items, that I've got to ignore again, as I've no use for them (additional features of dimmer switches, like dimmer state, etc.)
AVM Fritz!Box items would rediscover on a regular basis even without a reboot. That applies both to OpenHAB2 and OpenHAB3.
/M
The behavior for the Hue Binding definatly has completely changed from OpenHAB 2.5.12 to OpenHAB 3.x. In 2.5.12, ignored Hue items would stay ignored persistently. Even after a restart.
The removal of inbox entries when this binding is stopped is triggered at this line: https://github.com/openhab/openhab-addons/blob/main/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/discovery/HueDeviceDiscoveryService.java#L134 Even if there was probably a change in the code at a time to now use ThingHandlerService, I am almost sure that the inbox entries were already removed in 2.5.x.
Edit: looking at the history of the file, we can see that this was changed in October 2020 and that the inbox was previously already cleared: https://github.com/openhab/openhab-addons/commit/25826854b4ff83537de9bcb73b68d0abc73ff8bf#diff-5b39ac82bff87cc02137047850c2f3a342379ae897db42db640c27dc7e33ed26
I get ignored items coming back for the following bindings:
This issue has been mentioned on openHAB Community. There might be relevant details there:
https://community.openhab.org/t/ignored-things-back-in-inbox-after-reboot/131955/10
Many of the ignored items (e.g. all hue binding items, most homematic binding items) show up again in the inbox after a reboot. Other users are also experiencing this: https://community.openhab.org/t/openhab3-ignored-items-in-inbox-after-reboot-available-again/112451
It's kind of annoying to have to "clean up" the inbox over and over again to be able to see the items that really are new.