Skip to content
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

Closed
jlaur opened this issue Sep 6, 2023 · 3 comments
Closed

[hue] New channels are not added automatically #15554

jlaur opened this issue Sep 6, 2023 · 3 comments
Labels
enhancement An enhancement or new feature for an existing add-on

Comments

@jlaur
Copy link
Contributor

jlaur commented Sep 6, 2023

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:

2023-09-06 20:44:24.139 [WARN ] [e.internal.handler.Clip2ThingHandler] - Thing 'hue:device:0000000000000000:00000000-0000-0000-0000-000000000000' is missing required channel 'temperature-last-updated'. Please recreate the thing!

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

  • Version used: 4.1 current snapshot
@jlaur jlaur added the enhancement An enhancement or new feature for an existing add-on label Sep 6, 2023
@andrewfg
Copy link
Contributor

andrewfg commented Sep 6, 2023

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.

@jlaur
Copy link
Contributor Author

jlaur commented Sep 6, 2023

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 motion-last-updated to all Things, even those for which this is not relevant (like bulbs). But the binding would then remove it again, and all would be fine? In this case this issue can be closed.

@jlaur
Copy link
Contributor Author

jlaur commented Sep 6, 2023

Actually, considering what you just wrote with the "subtractive" model, I think we can simply use static update instructions.

That works.

@jlaur jlaur closed this as completed Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

No branches or pull requests

2 participants