-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[hue] New channels are not added automatically #15554
Comments
Indeed. Currently channels of a particular device are determined ‘subtractively’. Any new thing is created initially with all possible channels in it, and then depending on the initial GET DTO contents, those channels which are NOT supported, are deleted from the list. In this model the initial full list of channels can be fully defined via the thing xml description, which means that all channel attributes and localisation are coded in advance. An alternative model would be to determine the channels ‘additively’. That would mean that any channel which is supported in the initial GET DTO will be dynamically added to an initially empty list. In this model the channels, their attributes, and their localisation are not in the xml description, and would have to be coded on the fly. This is more difficult, (which is the reason why I did not take this approach). But @jlaur if you are looking for a challenge :) then you are welcome to modify the binding from the subtractive to the additive approach. However I think it would probably be a lot of work, and advising the user to recreate the thing, is probably a much simpler solution. |
Thanks for adding this context, @andrewfg. This reminded me of another advantage of the current approach: No initial runtime dependency on making channels available: https://community.openhab.org/t/openhab-marketing-is-lacking/149280/47. Perhaps this dynamic approach can be combined with the thing migration. For example, the Netatmo binding does something like this (and it also backfired a bit - #15463). I'm not sure if there would be any advantage in this, but it's worth taking into the equation. I will need to think about this. Actually, considering what you just wrote with the "subtractive" model, I think we can simply use static update instructions. I somehow assumed channels being created dynamically for whatever reason. This would add for example |
That works. |
While working on #15552 I noticed that a newly added channel did not appear for my managed thing which was created before adding the channel in the binding. In the log I found:
If it is really needed to recreate the Thing as the binding evolves and new channels appear, that would be a setback from openhab/openhab-core#3330
I cannot rule out that I have made a mistake in my tests.
Your Environment
The text was updated successfully, but these errors were encountered: