Migration http1 -> http - Help needed

I really would like to start using the new Openhab version. Currently I do use the http1 binding to call a “light manager air” which controlls all my 433mhz devices.
I have been struggling to get this working with the (new) http Binding but was unable to do so.
what I have is items like this:
Switch Leinwand "Leinwand" (EG_Wohnzimmer) { alexa="Switchable", http=">[ON:POST:ip/on-post-url] >[OFF:POST:ip/off-post-url]" }
Rollershutter Rollos_Essecke_Links "Rollo Essecke Links" (EG_Wohnzimmer) { http=">[DOWN:POST:ip/down-post-url] >[UP:POST:ip/up-post-url] >[STOP:POST:ip/stop-post-url]" }
I get that I now need to create a thing for that and then use its channel defintion in my existing items. But I have no idea how to define the channels with the two or three different commands (are they in the same channel definition, or multiple channel defintions for the same item?).
If someone could help, this would be awsome. I read through the thread of the new binding, but there where no examples close to what i am trying to do.

What do you mean by „two commands“? Like ON and OFF? Use a switch channel, you can set values for both in the channel configuration. Same for other item-types

Yes, like ON and OFF, for each of them I need to use different suburls.
So for my example with a switch I then have one Thing defintion, within that one Channel definition, containing both urls (for ON and OFF)?
How can I then set those two urls/suburls? I find no matching parameter here: HTTP - Bindings | openHAB

commandExtension and use %2$s to insert the command in the URL. There is another post somewhere where I explained it on full detail.

1 Like

thx it is now working!
My solution (for future readers):
Switch Leinwand "Leinwand" (EG_Wohnzimmer) { alexa="Switchable", channel="http:url:leinwand:switch"}
Thing http:url:leinwand "Leinwand" [ baseURL="base-url", commandMethod="POST"] { Channels: Type switch : switch "Switch" [ commandExtension="%2$s", onValue="sub-url-on", offValue="sub-url-off"] }

*edit: sourcecode is so much more pretty now <3

I had a similar problem and solved it with:
(just as code example if somebody needs it)

Thing http:url:WeatherObserverReboot "WetterStationReboot" [ baseURL="", commandMethod="GET"] { 
		Type switch : LOCALWEATHER_observerreboot [ commandExtension="msgreboot.htm",  onValue="ON", offValue="OFF"] 

Great! Also for me it allowed to prepare most of my items.

But one use case is left. I should have a dimmer which sends “night” when it is OFF (0 %) and “day/” when it is ON. I can send the percentage value when using “day/%2$s” as commandExtension. But it doesn´t send “night” when the dimmer is OFF. In the followin way it doesn´t work:

Type dimmer : Display [ commandExtension="%2$s", mode="WRITEONLY", onValue="day/%2$s", offValue="night"]

Does anybody know how to solve that?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.