-
-
Notifications
You must be signed in to change notification settings - Fork 432
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
Added 'ChannelDescriptionChangedEvent' #1505
Conversation
I so far always considered those descriptions rather static and the "dynamic" providers mainly being a means to have the list defined at runtime and not at compile time (as with the xml files) - thus I never expected UIs to react upon changes. If you think this is worthwhile to have, it should be fine to add it. You should just be clear of the implications: You should convince all UI devs to react to those events sooner or later and this includes Basic UI, the new Default UI as well as Android, iOS and Windows apps... |
51042b5
to
6d9d9bb
Compare
Most of the implementations in bindings I am aware of use it to transfer "really" dynamic, user-defined data (e.g. favorites, playlists, scenes or template s) including a frequently polling for it. So from my POV it could be a useful feature - even if a binding developer has to dispatch these events on his own if he does not use the abstract dynamic providers. I considered this to be a draft so everyone is invited to leave feedback on it. I am happy to ask @openhab/webui-maintainers, @openhab/android-maintainers, @openhab/ios-maintainers, @openhab/windows-maintainers and everyone else for their opinion. |
I think this is a useful feature - even if UIs don't implement it, we are no worse off than now. If UIs were to implement this event (which should be be recommended of course), then it's definitely an improvement. |
I agree with @cdjackson that it's good to have the info no matter what's done with it. A few notes however:
In this case, since the options are not displayed until the user clicks on the widget, it would be safer just to make a quick call to |
Thanks for you useful input. The pointer to SSE events was a good hint. It obviously makes a lot of sense to emit the |
Ideally a SSE will be sent to all affected sitemap elements as well. /cc @maniac103 |
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
For the remote openHAB binding, an event on the topic openhab/items/*/xxx would be ideal for me. But if I have to listen to another topic, why not. Do you plan to rework and finish this enhancement ? Before OH3 is released ? |
I added it to the openHAB 3 issue tracking. So yes, I am planning to do further work on it. |
Any progress on this enhancement? |
26d6069
to
13269c9
Compare
Does it mean that any binding state options provider should then be updated to set the references to ItemChannelLinkRegistry and EventPublisher? |
AFAIR yes. At least when we want to use constructor injection. I did not test if field injection is working when using abstract base classes. Method injection did not work for it in the past. There are other services in the OH framework which have to be implemented in a similar way e.g. |
Isn't it possible to provide the new state description in the new event? This would avoid additional request(s) to get it. Rather a "field" to tell what kind of information was changed, I would prefer the new state description in the event. |
Sounds like a reasonable idea. |
…ts to update dynamic state/command options Also handle dynamic command options Depends on openhab/openhab-core#1505 Signed-off-by: Laurent Garnier <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks!
Very good. Regarding impact on UI (sitemap), I know how to handle that. First a little change is needed in the IO REST sitemap bundle: my idea is to add a boolean field to the widget SSE event to indicate if the item description was changed. This will have no impact on UIs not reading this field. In Basic UI, I will read this field and when set to true, I will trigger the reload of the current page. Nothing very difficult I believe, I just need to validate that it works as I imagine. |
@lolodomo I had triggered a build right after merging this PR: https://ci.openhab.org/job/openHAB-Core/793/ |
Perfect. Note that we have already 3 PRs for addons ready to be merged that enhance bindings with this new feature. |
@cweitkamp : what is smarthome/j ? |
A third party repository for OHC based add-ons. |
…ts to update dynamic state/command options Also handle dynamic command options Depends on openhab/openhab-core#1505 Signed-off-by: Laurent Garnier <[email protected]>
For the bindings homeconnect, lgwebos, netatmo, remoteopenhab, rotel, somfytahoma, sonos and sonyprojector Depends on openhab/openhab-core#1505 Signed-off-by: Laurent Garnier <[email protected]>
I identified 3 bindings implementing a state description provider extending BaseDynamicStateDescriptionProvider in an unusual way: spotify, bticinosmarther and heos. These bindings require a special look. All the other (except hue) are now updated. And for the 3 bindings implementing a command description provider extending BaseDynamicCommandDescriptionProvider, only the nanoleaf binding is not yet enhanced. As a summary, we have still 5 bindings to check/enhance. |
@cweitkamp : I just discovered we have many bindings directly implementing DynamicStateDescriptionProvider. Those ones will not benefit this enhancement? |
Yes, that is correct. They have to take care on their own. |
…#10884) For the bindings homeconnect, lgwebos, netatmo, remoteopenhab, rotel, somfytahoma, sonos and sonyprojector Depends on openhab/openhab-core#1505 Signed-off-by: Laurent Garnier <[email protected]>
…#10884) For the bindings homeconnect, lgwebos, netatmo, remoteopenhab, rotel, somfytahoma, sonos and sonyprojector Depends on openhab/openhab-core#1505 Signed-off-by: Laurent Garnier <[email protected]> Signed-off-by: Luca Calcaterra <[email protected]>
…#10884) For the bindings homeconnect, lgwebos, netatmo, remoteopenhab, rotel, somfytahoma, sonos and sonyprojector Depends on openhab/openhab-core#1505 Signed-off-by: Laurent Garnier <[email protected]> Signed-off-by: Luca Calcaterra <[email protected]>
…#10884) For the bindings homeconnect, lgwebos, netatmo, remoteopenhab, rotel, somfytahoma, sonos and sonyprojector Depends on openhab/openhab-core#1505 Signed-off-by: Laurent Garnier <[email protected]> Signed-off-by: Luca Calcaterra <[email protected]>
Signed-off-by: Christoph Weitkamp <[email protected]>
…#10884) For the bindings homeconnect, lgwebos, netatmo, remoteopenhab, rotel, somfytahoma, sonos and sonyprojector Depends on openhab/openhab-core#1505 Signed-off-by: Laurent Garnier <[email protected]>
…#10884) For the bindings homeconnect, lgwebos, netatmo, remoteopenhab, rotel, somfytahoma, sonos and sonyprojector Depends on openhab/openhab-core#1505 Signed-off-by: Laurent Garnier <[email protected]>
For the bindings homeconnect, lgwebos, netatmo, remoteopenhab, rotel, somfytahoma, sonos and sonyprojector Depends on openhab/openhab-core#1505 Signed-off-by: Laurent Garnier <[email protected]>
Signed-off-by: Christoph Weitkamp <[email protected]> GitOrigin-RevId: 556d349
ChannelDescriptionChangedEvent
Problem statement:
OHC framework supports dynamic
StateDescription
s and dynamicCommandDescription
s which are set by bindings and may change during runtime. When the state options / command options are changed the UI doesn't update automatically. You need to do a page refresh to pick up the changes. This approach introduces a new event (ChannelDescriptionChangedEvent
) which UIs can subscribe to and reload related widgets. The event payload contains theChannelUID
, a field identifier to give a hint which field has changed and a list of linked item names.See e.g. openhab/openhab-addons#7396 (comment)
Closes #1753
Signed-off-by: Christoph Weitkamp [email protected]