Strange Behavior with a sitemap - Getting 400 Errors from the rest api

I have a strange behavior with a sitemap on opanHAB 3.2.0

The Item that makes a problem is a Number:temperature item which is linked through a Remote Openhab Thing to an item on an openhab 2.5 instance. It’s a setpoint for a thermostat. I configured it both as setpoint and slider in the sitemap, both showing the same behavior. When I click on up/down or move the slider nothing happens. Looking in the developer console of chrome, I see:

smarthome.js:1 POST http://jarvis:8080/rest/items/heizungSchlafzimmerEco 400 (Bad Request)
l @ smarthome.js:1
C @ smarthome.js:1
t @ smarthome.js:1
smarthome.js:1 XHR failed loading: POST "http://jarvis:8080/rest/items/heizungSchlafzimmerEco".
l @ smarthome.js:1
C @ smarthome.js:1
t @ smarthome.js:1

Now the strange thing. I go to the API Explorer and send post request to that item. It updates in the sitemap and now it works - for the setpoint, not for the slider. The slider still gives 400 Erros, while the setpoint works. When I press F5 nothing works again.

The unit is Celcius, what I noticed when I created the item it was shown as 16.0 ?, so changed the state description to %.1f °C. I tried also a state description without units and either %d and %.1f - same behaviour.

I logged the requests and the failed request had:
14 %unit%
while the working request has
14 °C

so it is something with the units. Any idea what I can do?

Thank you for being my Rubber duck debugging: Rubber duck debugging - Wikipedia

Once I added the Unit in the sitemap label description, it worked. I thought I tested that already, but I added it to another a item in the sitemap.

Lesson learned: Be explicit with the units in the sitemap to make it work.

1 Like