# Percentage values interpreted inconsistently in OpenHAB sitemap and Alexa binding

**URL:** <https://community.openhab.org/t/percentage-values-interpreted-inconsistently-in-openhab-sitemap-and-alexa-binding/163250>\
**Category:** Bindings\
**Tags:** alexa\
**Created:** [March 22, 2025, 3:30pm UTC](https://community.openhab.org/t/percentage-values-interpreted-inconsistently-in-openhab-sitemap-and-alexa-binding/163250 "2025-03-22T15:30:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![heilbron](https://community.openhab.org/letter_avatar_proxy/v4/letter/h/9de0a6/32.png) [@heilbron](https://community.openhab.org/u/heilbron)\
**Post date:** [March 22, 2025, 3:30pm UTC](https://community.openhab.org/t/percentage-values-interpreted-inconsistently-in-openhab-sitemap-and-alexa-binding/163250/1 "2025-03-22T15:30:13Z")

</div>

Hi!  
I’ve been experimenting with the [Alexa skill](https://www.openhab.org/docs/ecosystem/alexa/) on 4.3.3 for MQTT relayed information quite happily.  
However, I seem to have hit an inconsistency in how the binding and OpenHAB itself deal with “Number:Dimensionless” or “Number” items that carry the “[CurrentHumidity](https://www.openhab.org/docs/ecosystem/alexa/#currenthumidity)” (or any other) percentage, e.g. of an `AirQualityMonitor` device, such as a thermometer.

1. OpenHab expects a range between 0 and 1 (matching 0% to 100%) to display a percentage properly (e.g. in a sitemap), but …
2. the Alexa binding expects it to be between 0 and 100 to be properly transmitted to Alexa.

As a workaround I had to create 2 disctinct items, but thats probably not the proper or best solution…:

```auto
...
Group gBresser1 "Bresser1" (gGarten) ["Thermometer"] {alexa="AirQualityMonitor" [name="Gartenseite", description="Thermometer am Küchenfenster"]}
Number:Temperature Bresser1_Outside_Temp "Bresser 1 Temperature [%.1f %unit%]" <temperature> (gBresser1,Outside_Temp_Avg) {alexa="CurrentTemperature", channel="mqtt:topic:openhab:bresser1:temp" [profile="transform:JS",toItemScript="significant.js"], expire="30m"}
Number:Dimensionless Bresser1_Outside_Humid "Bresser 1 Humidity [%.0f %%]" <humidity> (gBresser1,Outside_Humid) {channel="mqtt:topic:openhab:bresser1:humid" [profile="transform:JS",toItemScript="significant.js"], expire="30m" }
Number:Dimensionless Bresser1_Outside_Humid_Alexa "Bresser 1 Humidity A [%.0f %%]" <humidity> (gBresser1) {alexa="CurrentHumidity", channel="mqtt:topic:openhab:bresser1:humid" [profile="transform:JS",toItemScript="significant.js?div=0.01"], expire="30m" }

```

(N.B. my significant.js script only does rounding and multiplying/dividing)

So now in case of an humidity of, e.g., 44% this puts 0.44 in `Bresser1_Outside_Humid` (displaying 44% in a sitemap) and 44 in `Bresser1_Outside_Humid_Alexa `, thus making Alexa answer 44%.

I hope that for this to be fixed, there is no braking change required, but still I’d really suggest to have that fixed since the inconsistency is hard to find out about at first, when making percentages available through the Alexa skill…  
IMHO at least it should be immediately mentioned explicitly in the skill’s documentation in the section about [CurrentHumidity](https://www.openhab.org/docs/ecosystem/alexa/#currenthumidity)…  
Or a percentage should be between 0 and 100 throughout OpenHAB, but then the display of percentages might need to be changed (and it seems wrong to me)…

What do you think? I created issue 18426 for tracking this: [[alexa] Number:Dimensionless (percentage values) (from 0.0 to 1.0) should be multiplied by 100 before transmission to Alexa skill · Issue #18426 · openhab/openhab-addons · GitHub](https://github.com/openhab/openhab-addons/issues/18426#issue-2940707124)

Addition: another fix avoiding a breaking change might involve the introduction of a new _Number:Percentage_ as a special variant of _Number:Dimensionless_ ?

---

<div class="post-metadata">

**Author:** ![heilbron](https://community.openhab.org/letter_avatar_proxy/v4/letter/h/9de0a6/32.png) [@heilbron](https://community.openhab.org/u/heilbron)\
**Post date:** [March 22, 2025, 3:45pm UTC](https://community.openhab.org/t/percentage-values-interpreted-inconsistently-in-openhab-sitemap-and-alexa-binding/163250/2 "2025-03-22T15:45:33Z")

</div>

1. BTW: to duplicate the problem in a sitemap define these two items:

```auto
Text item=Bresser1_Outside_Humid label="Nordseite Humid" // displays 44% for a value of 0.44
Text item=Bresser1_Outside_Humid_Alexa // diplays 4400% for a value of 44

```

1. Another (non-breaking) fix that could be implemented within the Alexa binding:  
If the item is _Number:Dimensionless_ AND if it’s display unit is “%%” (indicating a percentage),  
then multiply the number by 100 before passing it on to the Alexa API…

2. The problem seems to hold for other Percentage types, too: E.g. _BatteryLevel_. The corresponding OpenHAB item (fed from MQTT in my case) must be 100 (instead of the given 1.0) to display 100% in Alexa.

3. Checked: Could it be that the problem arises because the MQTT binding doesn’t feed a unit of “%” into the item? (I noticed that humidity values coming in from a weather bindings actually have “%” as a unit.) → No, a **humidity value of 0,47 (from the weather binding) with a unit of “%” is also wrongly displayed as 0.47% in Alexa**.
