I am currently migrating from OH2 to OH3 and have major problems with the HTTP binding.
This is a working item-configuration from OH2: Switch vu_ok { http=">[ON:POST:http://192.168.130.180/web/remotecontrol?command=352]" }
I migrated it to this things-file:
Thing http:url:vu "vu" [ baseURL="http://192.168.130.180/web/", commandMethod="POST" ]
{
Channels:
Type switch : ok "OK" [ commandExtension="remotecontrol?command=352", mode="WRITEONLY", onValue="ON" ]
}
… and this item-file: Switch vu_ok "OK" (grpVu) [ "Point" ] { channel="http:url:vu:ok" }
It does not matter whether I configure this with files or with the UI, the behaviour is the same!
After finishing the configuration mentioned above, the thing is listed as online. When triggering the switch vu_ok in the UI the http-POST is done and working. So far so good.
But when restarting OpenHAB, the thing is hanging in state UNINITIALIZED with the message " HANDLER_CONFIGURATION_PENDING".
Deleting and recreating everyhing leads to a working thing until the next reboot.
I cannot find anything in the logs, even in log level TRACE.
When adding offValue="OFF" the thing initializes correctly. But I don’t know why that is not relevant when creating the thing initially.
I explicitly left out “offValue”, because I want to perform the POST-request only once (when the switch is switched on and not again when switched off).
When configuring the channel with an invalid offValue, like Type switch : ok "OK" [ commandExtension="%2$s", mode="WRITEONLY", onValue="remotecontrol?command=352", offValue="-" ]
…it actually works. But this leads to invalid requests done in OFF-state and lots of logging-entries for those (Requesting … failed: 404 Not Found). Not really nice.
Is there maybe a better solution I don’t see right now?