Great binding. I just have one issue.
I can read the values for 3 channels via GET method, but I need also a GET Method to set a switch item to ON & OFF.
2020-07-22 16:26:43.165 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.thingUpdated()' on 'org.openhab.binding.http.internal.HttpThingHandler@1ad26566': String index out of range: 0
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:658) ~[?:1.8.0_252]
at org.openhab.binding.http.internal.HttpThingHandler.concatenateUrlParts(HttpThingHandler.java:308) ~[?:?]
at org.openhab.binding.http.internal.HttpThingHandler.createChannel(HttpThingHandler.java:191) ~[?:?]
at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:1.8.0_252]
at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1082) ~[?:1.8.0_252]
at org.openhab.binding.http.internal.HttpThingHandler.initialize(HttpThingHandler.java:161) ~[?:?]
at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.thingUpdated(BaseThingHandler.java:166) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_252]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_252]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_252]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_252]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_252]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
Thanks for your snapshot. The missing part actually was that I need to use %2$s for the state argument. @J-N-K if I didnāt overlook it thatās not documented ?
That doesnāt seem to work properly yet.
On my last example (to read and write the channel), State URL Extension was ignored.
And when Iāve set it to empty (but readwrite mode), I got an exception on saving saying
2020-07-22 22:31:15.968 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.thingUpdated()' on 'org.openhab.binding.http.internal.HttpThingHandler@163344': String index out of range: 0
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.StringLatin1.charAt(StringLatin1.java:47) ~[?:?]
at java.lang.String.charAt(String.java:693) ~[?:?]
at org.openhab.binding.http.internal.HttpThingHandler.concatenateUrlParts(HttpThingHandler.java:308) ~[?:?]
at org.openhab.binding.http.internal.HttpThingHandler.createChannel(HttpThingHandler.java:191) ~[?:?]
With another thing which has no Command Extension, State Extension is working, but apparently not together with Command Extensions.
I have fixed the exception and made the documentation a little bit more explicit.The link above is updated. Be careful if you drop the .jar in your addons folder: Itās now 2.5.8 instead of 2.5.7, so the old version will not be overwritten.
meaning it is currently not in standby thus ON. A POST request /web/powerstate?newstate=5 will instruct it to switch OFF and newstate=4 means to switch ON.
The state transformation REGEX fully reads REGEX:.*?<e2instandby>(.*?)</e2instandby>.* and returns what is between <e2instandby> and </e2instandby>, i.e. false or true. dreambox.map for the command transformation is
true=5
false=4
NULL=no data
-=no data
Very unlike the HTTPv1 binding, the item definition is only a very simple channel reference Switch Dreambox "Dreambox [%s]" { channel="http:url:<thing ID>:<channel ID>" }
Exellent work!!
This will be the binding to integrate all those proprietary smart/cloud devices.
But Iām stuck with authentication on my Air-Heatpump.
Does the method for URL need to be Post?
Cause REGEX canāt find matches, because itās only loading the loginpage.
If your device requires authentication, you need to define this on the thing (user/pwd or token in the http header). This depends on the device you want to connect.