No value for scaled item in sitemap

  • Platform information:
    • OS: Linux/4.4.180+ (amd64)
    • Java Runtime Environment: 11.0.13 (Zulu11.52+13-CA)
    • openHAB version: openHAB 3.2.0 Release Build

I installed and configured the Netatmo Binding. I added an item for the WindAngle channel of the anemometer and added the item to my sitemap.
Everything worked fine. The item showd a number value in degrees and did so on my sitemap. But because this is difficult to read I wanted to scale the vaule to the typical terms (N, S, W, etc.). So I installed the Scale Transformation Service an followed this german guide OpenHAB Windrichtung von Grad in Himmelsrichtungen konvertieren.

So I created a windDir.scale file, changed the item type to string and changed the channel link profile to SCALE.

windDir.scale file:

[0..11.25] = N
]11.25..33.75] = NNE
]33.75..56.25] = NE
]56.25..78.75] = ENE
]78.75..101.25] = E
]101.25..123.75] = ESE
]123.75..146.25] = SE
]146.25..168.75] = SSE
]168.75..191.25] = S
]191.25..213.75] = SSW
]213.75..236.25] = SW
]236.25..258.75] = WSW
]258.75..281.25] = W
]281.25..303.75] = WNW
]303.75..326.25] = NW
]326.25..348.75] = NNW
]348.75..360] = N
[..] = Unknown Value
NaN="N/A"

Still everything worked fine. My item now looks like this:


You can see the transformation works and the item value is now “SW and no longer a number”.

My only problem is now no value is shown on my sitemap:


My sitemap file looks like this:

Default item=WindmesserZuhauseWetterstationMaxim_Windrichtung

Any idea what is wrong and how to fix this?

Most likely your Item still has a state presentation ‘pattern’ suitable for a number, not a string. Check its metadata.

That was a good hint:
Old metadata:

{
  "link": "http://<openhab>/rest/items/WindmesserZuhauseWetterstationXXXX_Windrichtung",
  "state": "SW",
  "stateDescription": {
    "minimum": 0,
    "maximum": 360,
    "step": 1,
    "pattern": "%d %unit%", ### OLD
    "readOnly": true,
    "options": []
}

These stateDescription are getting set when i link the channel. So even creating a new string item does not help because as soon as I link the channel the stateDescription for an angle are getting set.

I am mostly using the UI, where I can’t see this pre set Metadata so I looked via REST API to confirm the wrong Metadata. I was then able to change the stateDescription:pattern via UI by “Add Metadata” → State Description → Pattern → “%s”. That did not delete the other unnecessary stateDescription minimum, maximum and step but was enough to get my sitemap working.

New metadata:

{
  "link": "http://<openhab>/rest/items/WindmesserZuhauseWetterstationXXXX_Windrichtung",
  "state": "SW",
  "stateDescription": {
    "minimum": 0,
    "maximum": 360,
    "step": 1,
    "pattern": "%s", ### NEW
    "readOnly": true,
    "options": []
}

@rossko57 Thank you very much for your quick and helpfull response!

Yes, personally I think that is a design mistake.

I did think however that you can edit the metadata after you linked a channel i.e. it was a one-time effect, and that’s what you seem to have found.

I think you’ve overlooked it