Battery Level not showing the actual value on sitemap just an icon

Sitemap showing battery %.

All I have been able to get the battery percentage of a solar battery through the use of the HTTP Binding combined with a JSON Regular Expression. When I look at the item in the item menu I can see the current value (Currently 85). All good so far.
Now when add this item to a sitemap all I am getting is the icon and no actual value being displayed.

This is the sitemap code relevant to this section.

Group icon="solarplant" label="Solar" {
    Text icon="batterylevel" item=HTTPURLThing_Battery label="Battery Charge"

I recall on the older version of Openhab you needed to add another statement to this line but I cant for the life of me recall what it was.

Can anyone help?

You probably need to ask for state display
label="Battery Charge [%s]"

1 Like

Thanks mate that worked perfectly, Appreciated as always

I have a similar issue with my sitemap not showing what I would like the battery display to be. I receive a MQTT string value that represents the 12v battery charge from a Generac generator. The basic sitemap of:

Frame label="Generac Generator" 
      Text item=GeneracGenerator_BatteryVoltage icon="batterylevel"
     // Group item=GeneracGenerator

gives me this:
GeneracBattery Voltage

I created a rule to convert the string into a number and use this to set the icon’s value to reflect the battery’s charge.

rule "Generac Battery Voltage"
    Item GeneracGenerator_BatteryVoltage changed
var String battVoltage = GeneracGenerator_BatteryVoltage.state.toString.split(' ').get(0).trim
var Number conversion
conversion = Double.parseDouble(battVoltage);
//logInfo("Battery Voltage ", battVoltage)
if (conversion >= 12.70 && conversion <=15)
     //GeneracGenerator_BatteryVoltage.postUpdate(GeneracGenerator_BatteryVoltage as Number)
  else if (conversion >= 12.64 && conversion < 12.70)
   else if (conversion >= 12.58 && conversion < 12.64)

And this is what I get
GeneracBattery Percent

I would like to either display the percent charge with the “%” symbol added. Or, preferably, display the icon with the correct charge and the label displaying the actual voltage. I’m not sure how to accomplish either.
Also, I have a map file that maps battery voltage to charge percentages, but I’m unsure how to use that instead of all of the if… else if statements in my rule.
Any help would be appreciated!!