Battery Level Status

Hey @rlkoshak , I’m probably dumb but… I’m having quite a bit of difficulty in getting this to work. Maybe it’s me not understanding how to use the mainUI? Can you give me a pointer or two?
This is what I see when I set up a battery item. And I don’t understand how I can add more battery items either… I added multiple battery level status widgets to try to work it out but it’s not working as I assume it should. I added four widgets at the top.
Can you recognize what I’m doing wrong? I read this message “ Required Group:Number:MIN Item that aggregates all the battery levels “ and I’m pretty sure that I’m not following this correctly, but on the other hand I don’t know what to do either… please help?

Edit: maybe I should get more sleep. XD I think I got it now :smiley:

1 Like

You define a Group Item of type Number in Settings → Items. Configure the Group with an aggregation function of MIN.

Add all of your battery Items as members of that Group.

Configure the widget to use the Group Item as the “Minimum Battery Item”. Any member of the Group that falls below the “Max Precent” will be shown.

Based on the configuration you provide, it will list all the members of the Group below the provided threshold.

One widget for all your batteries, not one widget per battery Item.

1 Like

EDIT: @rlkoshak, I can see this bug fix is still missing?

It seems that displayState is never available in the loop? I get too many decimals:

Even though the pattern is specified for item, and displayState is available as standalone:

Running openHAB 3.3.0 release

Feature request: ability to customize/localize title text

It looks like I applied it to the title but not inside the repeater loop. It’s now in both places and there is a property for the title text.

1 Like

@rlkoshak same issue as in Service Status Standalone Widget - #7 by ssalonendefault parameter seems to break the addon, should be defaultValue? The widget cannot be installed anymore.

That makes it even weirder because this widget has always used default for the Number fields.

Maybe there is a mismatch between the importer parser and the widget editor.

I only changed the new property above. I left the number properties using “default”.

Still fails

2022-11-28 18:48:34.384 [ERROR] [munity.CommunityUIWidgetAddonHan
dler] [org.openhab.core.addon.marketplace] - Unable to parse YAML
: Unrecognized field "default" (class org.openhab.core.config.cor
e.dto.ConfigDescriptionParameterDTO), not marked as ignorable (22
 known properties: "readOnly", "max", "limitToOptions", "groupNam
e", "name", "stepsize", "context", "defaultValue", "min", "label"
, "filterCriteria", "verify", "type", "description", "options", "
required", "advanced", "unit", "multipleLimit", "pattern", "multi
ple", "unitLabel"])                                              
 at [Source: (StringReader); line: 15, column: 21] (through refer
ence chain: org.openhab.core.ui.components.RootUIComponent["props
"]->org.openhab.core.config.core.dto.ConfigDescriptionDTO["parame
ters"]->java.util.ArrayList[1]->org.openhab.core.config.core.dto.
ConfigDescriptionParameterDTO["default"])                        
2022-11-28 18:48:34.385 [ERROR] [munity.CommunityUIWidgetAddonHan
dler] [org.openhab.core.addon.marketplace] - Widget from marketpl
ace is invalid: Unable to parse YAML                             
data: {"topic":"openhab/addons/marketplace:128043/failed","payloa
d":"[\"marketplace:128043\",\"Widget is not valid.\"]","type":"Ad
donEvent"}                                                       
data: {"topic":"openhab/addons/marketplace:128043/failed","payloa
d":"[\"marketplace:128043\",\"Widget is not valid.\"]","type":"Ad
donEvent"}  

Hmmm. This must be something that changed. I’ll update the Number fields too.

Done

1 Like

Thank you. Now it installs fine. I can also confirm that the bug with displayState is also resolved

Is there a way to sort the list ascending by battery level or since it’s not possible the Minimum Battery Level is displayed at the top?
It seems like the list is sorted descending by item name.

1 Like

The Minimum Battery Level is displayed at the top.

Not that I’m aware of.

Now that expressions support arrow functions, you can use the repeater map function to achieve pretty good sorting of objects on the basis of key values, but it will break the widget for anyone not at least using recent milestones.

1 Like

The marketplace now supports Maven like version number ranges. So I could publish a new version and put [3.4.0;4.0.0) in the title and those on 3.4 will see the new sortable version and those on older version will see this one.

2 Likes

Extra question : my batteries Items are defined with just the label “Battery”.
So in the widget, i have many “Battery” entries, without knowing which item it is refering to …

DateTime              HueChambreCapteurLuminositeLastUpdated         "Dernière mise à jour"                   <time>           (gDevice_HueCapteurPresenceChambre)                                      {channel="hue:0106:001788b3f442:motion_chambre_light:last_updated"}
Number                HueChambreCapteurLuminositeBatteryLevel        "Niveau batterie"                        <battery>        (gDevice_HueCapteurPresenceChambre, gBatteries)    ["Battery"]                       {channel="hue:0106:001788b3f442:motion_chambre_light:battery_level"}
Switch                HueChambreCapteurLuminositeBatteryLow          "Batterie faible"                        <battery>        (gDevice_HueCapteurPresenceChambre)    ["LowBattery"]                    {channel="hue:0106:001788b3f442:motion_chambre_light:battery_low"}

So, of course, i could rename all the corresponding labels (but i have a lot of them…) - but isnt’ there an easier way (like configuring something allowing to display for text the "Parent object name) ?

There is some metadata that gets added to an item that is part of the semantic model, but I don’t know if it’s available in an oh-repeater card. I know there is some access to metadata but I don’t know how far that extends.

Because the label is used in so many other places I recommend making each item’s label unique anyway so I’ve never looked into it.