[hue] Apply status description if battery is low - #20758
Conversation
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
There was a problem hiding this comment.
Pull request overview
This PR enhances the Hue binding to surface a low-battery indication via the Thing status description (which triggers the "blue dot" badge in MainUI), analogous to the software-update status feature added in #20498. When a battery-powered Hue device reports low battery, the Thing's ONLINE status description is set to a translatable "Battery level is low." text; it is cleared again once the battery recovers, but only if no other description (e.g., firmware update) is already in place.
Changes:
- Add new i18n key
online.battery-lowand constantTEXT_ONLINE_BATTERY_LOW. - Call a new
updateOnlineStatusDescription()fromClip2ThingHandler.updateChannels()whenever aDEVICE_POWERresource update arrives. - Apply/clear the low-battery description only when the Thing is ONLINE, has the battery-low channel, and currently has no other description set.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| bundles/org.openhab.binding.hue/src/main/resources/OH-INF/i18n/hue.properties | Adds new online.battery-low translatable text. |
| bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/HueBindingConstants.java | Adds TEXT_ONLINE_BATTERY_LOW constant referencing the new i18n key. |
| bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java | Adds updateOnlineStatusDescription() and invokes it from the DEVICE_POWER channel update branch. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
|
To be honest, I’m not very keen on the overall blue dot feature. I wasn’t aware of the discussion before it was merged, but I would have shared my perspective if I had been. The meaning of the blue dot now feels ambiguous. For some entities, it means “has changed and can be saved”, like a configuration. For status-related things, it can mean firmware is available, and now also that the battery is empty. What comes next? How do we handle concurrent states, for example when both firmware is available and the battery is low? The openHAB domain models already allow alarm channels and/or trigger channels to signal these kinds of details. To me, that is sufficient. It allows users to subscribe to the events they are interested in by linking an item or rule to the channel. Not saying we have to revert, but we need to have clear definitions and be sure this is the best implementation to support the use case. If the meaning and purpose the blue dot is to get the user's attention, like "something needs your attention" i would have suggested more something like a light yellow/orange dot with an exclamation mark. |
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
|
@lsiepel I changed the title and description of this PR to reflect what the PR is actually doing -- namely adding a Thing status description text when the battery is low. To be clear this PR here is simply about adding a Thing status description text. This is an extra text that is displayed on the 3rd line of the Thing detail page in WebUI (see screenshot below). In other words, this PR is actually NOT directly related to applying a blue dot decorator to the Thing status badge in the WebUI Things overview list page (PR) so if you have objections to that function, or want to change its colour, you can of course open a separate issue in WebUI.
Referring to this screen shot above, this Hue PR would cause the following
|
|
Thanks for pointing out the implementation details, but I’m aware of how it works.
I agree up to some extent that these are three separate issues, but they are also connected as you described.
|
Yeah. There are about 20 bindings that do it. They generally use the status description to describe some particular nature or qualification of the actual Thing being "not quite perfectly online" such as 'online but still waiting for data', or 'online but via cloud connection' or 'online status limited due to pending software update' or as I now propose 'online status at risk due to low battery' etc. Honestly I don't understand why you want to enforce stricter regulation of the status description now. It has always been up to binding designers to design their bindings to either provide such qualifier information or not. (Indeed if you would forbid it now for software available or low battery, you would probably need to go back over other bindings and forbid it also for some other (in your eyes) mis-uses. .. But why? Are you seriously thinking of that? Personally I think it is a useful mechanism for binding designers to provide online qualifier information. And I see no reason why it should not be more commonly used. It is a fully confirmed and accepted capability of existing OH core and UI code.
Ok. The recent current approach was simply to display the decoration dot if there is a status description text, and not display it if there is none. Just a binary advice "more information is available". Yet if I understand you correctly you are suggesting that the style of the decorator dot should be settable at run time. For example by adding a 4th field to the |
|
@lsiepel moving the discussion from OH Addons to OH Core openhab/openhab-core#5587 |



This PR adds a Thing status description text when the thing has a low battery.
The consequence of a Thing status description text is as follows:
It follows the analogy of #20498 where a Thing status description text is added to indicate availability of a software update.
Signed-off-by: Andrew Fiddian-Green software@whitebear.ch