Hi,
I am using OpenHAB v2.5.6 running in an docker container on my x86 NAS and just migrated from Darksky to Openweathermap. OWM provides the current wind direction in a Number:Angle format and I use a transformation scaling in the item definition file to translate the angle into “human readable” wind direction. But HABPanel does not recognize that.
How can I transform the angle value in HABPanel to show the wind direction word?
I already tried to put the SCALE(winddirection.scale) command into the format field and tried using the “server-side format” checkbox but the I only get whole transformation string + the untransformed angle value.
It must be working differently but I do not know how.
I kindly appreciate any idea or hint how to solve that
There is a discrepancy here, filename (s). Maybe it is only a typo, because you should have seen complaints in your logs.
There is weirdness in your [state presentation] part. You cannot have %unit% with a transform, the transform’s output is a string with no units. I would not have expected that to be terminal though.
Top tip; put a default “catchall” entry in your scale file so that you can see unexpected non-matches.
It’s in the docs
I played a bit around with setting some values from the transformation file winddirection.scale
I set the value 217, 138, 320 using the REST API UI and I see that the Basic UI is transforming but not HABPanel and getting the item state via REST API UI also shows the number not the translated winddirection???
By the way the sitemap entry for localCurrentWindDirection looks like this:
Text item=localCurrentHumidity
Text item=localCurrentWindSpeed
Text item=localCurrentWindDirection
Text item=localCurrentCloudiness
No transformation in the sitemap file …
I am curious … when using the transformation in the items definition:
Why did you have the unit in the format in the first place? Your scale takes the angle and transforms it into a cardinal direction, which has no unit anyway.
Hi @CrazyIvan359,
I have copied the items definition from the documentation and the added the transformation …
Looking back, of course the outcome after the transformation is a string and has no more unit. But I was mislead by the Basic UI where also this wrong item definition was displayed correctly. I needed the feedback of the community to discover my wrong definition and to correctly understand how the transformation works
Thanks to all for sharing your thoughts and giving me advise to find the solution.
You do not want that either. This is not “just a number”, it is a Quantity Type. It does have units, but the units have no real dimensions. Huh? Well, think of percentage - it’s a ratio, with units of %