Hi!
I’ve been experimenting with the Alexa skill 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” (or any other) percentage, e.g. of an AirQualityMonitor
device, such as a thermometer.
- OpenHab expects a range between 0 and 1 (matching 0% to 100%) to display a percentage properly (e.g. in a sitemap), but …
- 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…:
...
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…
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
Addition: another fix avoiding a breaking change might involve the introduction of a new Number:Percentage as a special variant of Number:Dimensionless ?