API state changes not reflected in the real world

  • Platform information:
    • Hardware:
      LattePanda Alpha 864s
      CPU:Intel 8th m3–8100y
      Core:1.1-3.4GHz Dual-Core,Four-Thread
      Graphics:Intel HD Graphics 615, 300-900MHz
      RAM:8G LPDDR3
      External Memory: 1x M.2 M Key, PCIe 4x, NVMe SSD
      Connectivity:WIFI 802.11 AC, 2.4G & 5G, Dual Band Bluetooth 4.2, Gigabyte Ethernet
      USB Ports:3x USB 3.0 Type A / 1x USB Type C, supports PD, DP, USB 3.0
      Display:HDMI Output / Type-C DP Support / Extendable eDP touch displays
      Co-processor:Arduino Leonardo
      GPIO & Other Features:2x 50p GPIOs including I2C, I2S, USB, RS232, UART, RTC,Power Management,Extendable power button

    • OS: Ubuntu 20.04LTS

    • Java Runtime Environment: JDK 11 Zulu

    • openHAB version: 3.02

  • Issue of the topic:
    • I am using Postman to send API calls to the OH REST API
    • GET works fine e.g. GET htp://latte01:8080/rest/items/DLight02_Color/state (proper state is returned)
    • POST command also good e.g. POST http://latte01:8080/rest/items/DLight02 (with a body of “ON” in text/plain) Light turns on in the real world.
    • State changes using PUT are not working as expected
      • I can send a PUT e.g. PUT http://latte01:8080/rest/items/DLight02_Color/state (with a body of 0.0,0,100 in text/plain) to an Item to change state of a light and the state is changed (GET state returns the changed value)
      • When this PUT is sent I can also see the relevant item state change correctly in the OH Admin UI (The Brightness slider in the UI moves to the 100 position)
      • The problem is that the state change sent using the PUT does not actually change the state of the light in the real world. In my example I expect the light to turn on with a brightness of 100% but nothing actually happens
      • Subsequent manual movement of the UI slider causes the light to come on
    • I suspect I am being a real noobie here and would really appreciate some pointers as to what I am missing

Thanks Guys

That’s the expected behsviour

This sends a command to the Item, which gets passed to the binding as well so it can send it to the real device.

This is equivalent to a postUpdate in rules, it only updates the item’s state internally: the binding is not notified of this, so the real device isn’t updated.


Thanks Anders that certainly explains what I am seeing.

I’ve just twigged that state is readonly and if I want to change the brightness through the API I have to POST to DLight02_Color. :slightly_smiling_face: