Cannot control a Switch Thing through corresponding Item (using REST APIs)

Hi everyone, I ran into a frustrating issue while setting up an Osram Smart+ switchable plug into my OpenHAB configuration.
After adding it as a Thing, I created a new Item and linked it to the plug’s only channel (a switch type), all through the documented REST APIs ( http://demo.openhab.org:8080/doc/index.html#/ ). It all seemed fine, until I tried sending a command to my Switch Item to turn ON the plug.
The POST call resulted in a 200 OK response and inspecting the ITEM’s state it was actually updated to ON; unfortunately, the switch THING stayed OFF. I then assessed that turning the plug ON or OFF would not change the Item state accordingly.
Furthermore, I checked in Control section of PaperUI if a link was generated, and it was, functioning the same as the Send Command API (that is, it only changes the Item status with no real-life effect on the plug).
Am I missing something? I have OpenHAB running on a Raspberry Pi 4 with OpenHABian, and the smart plug is bridged to OpenHAB through a Conbee II dongle. Any help is appreciated.

Who can say.
If you cannot show us the mystery REST you used to create this Item, may we at lesst see the suspect Item? The channel links you think it should have? The Thing in question?

Are you really doing on the demo.openhab.org, that is not the address of YOUR system!

@opus No, I am using those REST APIs with the address of myOpenHAB’s cloud, as a matter of fact creating an Item and linking it to a Thing are both operations that have results on my Raspberry.

@rossko57 the REST calls in question are:

  • PUT address/items, successfully creating an Item in OpenHAB (I can see it in PaperUI);
  • PUT address/links/itemName/channelUID, successfully creating a link between Item and Thing exposing the channel (also a visible effect on PaperUI);
  • GET/POST address/item/itemName: THESE calls do not have any effect on the THING, just on the Item.

Hope I’ve made myself clearer, It seems I am experiencing the same issue with other sensors too.

What affect are you expecting commands and updates to an Item to have on a Thing? Things generally sit there and say “Online”.

Well, I was under the impression that Items were the entry point for controlling Things or reading sensor values, is that not the case?

Ye-es, but what were you expecting your Thing to “do” that it doesn’t do?

I general, a Thing is a model of a device - a wall switch, say. You can command the wall switch on and off, but it’s still just a wall switch, The Thing modelling it says “here I am, I’m fine” … or ‘online’.

The on/off state comes out of the Thing on a channel to an Item. The Item reflects the on/off changes.

You can command the wall switch on and off

Except in my case I can’t.
As I said, the Thing and the Item seem like separate entities instead of cooperating ones. PaperUI shows the Thing being online, the Item existing and a Link between them being created. It should be the sufficient setup to control the Thing, yet I cannot do anything from REST calls nor from PaperUI’s Control panel.

I apologize if I presented the issue in a confusing manner, but please don’t treat me like a total noob. I get what’s a Thing and what’s an Item, what I don’t get is why I can’t make them work as the guide says they should, and I need assistance.

It’s still not clear what you are expecting the Thing to do. It cannot assume state ON. What status does your Thing have? What status does it have after you command your Item?

What guide are you referring to?

In the beginning here, you referred to an Osram bulb - is your problem that the commands do not appear to arrive at the bulb? Then we’ll need to look at the binding (which one?) and your Thing parameters (which are still secret)

We can only work with what you tell us.

What status does your Thing have? What status does it have after you command your Item?

The Thing is ONLINE, as it should. It stays online after sending a command to the Item, as it should.
The Item’s state (a Switch) can be set from ON to OFF, and viceversa, with no effect on the plug (i.e. if the plug was on, it stays on).

What guide are you referring to?

This one → Getting Started - Introduction | openHAB

is your problem that the commands do not appear to arrive at the bulb?

Yes.

Then we’ll need to look at the binding (which one?)

The Hue Binding, recognizing an ON/OFF Plug-in Unit Thing, which is the one in question.

and your Thing parameters (which are still secret)

And will remain secret since I switched my setup and I cannot collect them at the moment.

Alright, let’s start over.

“My Hue bulb does not work”
Okay - we would like to see your Item, channel and Thing settings. You are not using files to configure, so screenshots please.
Also snips from your events.log and openhab.log showing a failed command.

2 Likes