LOL. Thanks for pointing that out. yes this is the correct solution ![]()
also did content-type as “application/json”
Links in 1st post do not work.
If you are using OH3, the binding is now included in the snapshots
Hi,
I’m currently testing the HTTP binding on OH 3 (Build 2017). But the site i’m running the test against doesn’t seem to be using any authentication except for a “API” Key they call “AppKey”.
Please note that i have changed the AppKey, and address in this post. This is just for showing an example.
I’m getting this current error:
[WARN ] [p.internal.http.HttpResponseListener] - Requesting ‘https://komteksky.norkart.no/komtek.renovasjonwebapi/api/tommekalender/?gatenavn=Address&gatekode=1006&husnr=150’ (method=‘GET’, content=‘null’) failed: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
I have setup the thiing with this Header: Kommunenr=0000&RenovasjonAppKey=11-22-33-44&OS=Android&Connection=Keep-Alive&Accept-Encoding=gzip
I can get it to work with a curl like this:
curl -H “Kommunenr: 0000” -H “RenovasjonAppKey: 11-22-33-44” -H “OS: Android” -H “Connection: Keep-Alive” -H “Accept-Encoding: gzip” -X GET “https:/komteksky.norkart.no/komtek.renovasjonwebapi/api/tommekalender/?gatenavn=Address&gatekode=1006&husnr=150”
Does anyone have any suggestion on what could be wrong?
Please enable TRACE or DEBUG logging and show what exactly is sent. Did you configure authentication? Did you really set the headers as above? That’ll probably not work. Add a new entry for each header key-value-pair.
Hi,
im using one of the last 2.5.8 version of the binding.
I want to use a switch channel, but im having problems with that.
The switch item is not showing the right state. Only UNDEF…
Switching on or off is working fine.
The trace log looks like this:
2020-11-21 13:44:19.828 [TRACE] [ttp.internal.http.RefreshingUrlCache] - Sending to ‘https://openhab.home/waschmaschine/sp2101w_waschmaschine_status.php’: Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.20.v20190813}, Content = {null}
220-11-21 13:44:20.943 [TRACE] [p.internal.http.HttpResponseListener] - Received from ‘https://openhab.home/waschmaschine/sp2101w_waschmaschine_status.php’: Code = {200}, Headers = {Date: Sat, 21 Nov 2020 12:44:19 GMT, Server: Apache/2.4.18 (Ubuntu), Content-Length: 2, Content-Type: text/html; charset=UTF-8}, Content = {ON}*
I looks like the response is right, but the switch is not updating to this state:
2020-11-21 13:46:39.043 [ome.event.ItemCommandEvent] - Item ‘EdimaxWaschmaschinePowerSwitch’ received command ON
2020-11-21 13:46:39.045 [nt.ItemStatePredictedEvent] - EdimaxWaschmaschinePowerSwitch predicted to become ON
2020-11-21 13:46:39.054 [vent.ItemStateChangedEvent] - EdimaxWaschmaschinePowerSwitch changed from UNDEF to ON
2020-11-21 13:46:51.033 [vent.ItemStateChangedEvent] - EdimaxWaschmaschinePowerSwitch changed from ON to UNDEF
Am I doing something wrong?
Hi,
I thing you need to use a transformation map
you used your command values as Onvalue and Offvalue while you should use for your state value.
Therefore you should use a transformation map
So you can use:
OnValue:“ON” OffValue: “OFF”
Command Trasformation : “MAP:yourmap.map”
and in yourmap.map file
on=sp2101w_waschmachine_an.php
off=sp2101w_waschmachine_aus.php
or viceversa (I always forgot the right order)
Let’s try
Regards
Lorenzo
Yes. See my post #76 for a complete example how to use transformations.
Hi mstormi and foxejoe,
I ve read the whole thread ![]()
But the response for the state is still on or off like you can see in the trance log, so I thought i dont need a transform…
Or maybe i understand you wrong ![]()
But nevertheless I will try it ![]()
Hi, this is not the problem… the problem is the command ![]()
In your configuration you set as status the command and as command you send the status therefore your command works but your status doesn’t.
You have to set the status on OnValue and Offvalue NOT the command !!
Read the example as mstormi wrote that explain better my point above.
Regards
Lorenzo
Hey Guys,
I got it!
It is working now ![]()
But I do not really understand it!
But maybe the documentation at this point is not specific enough…
Next Question, maye also a documentation thing, but is it possible to call a url and send a xml after connection to get a status?
Background: Im ussing Edimax smarplugs and they work with xml playload. To get or set a state you have to connect to the plug by url and send a xml payload to it. After that, yout get the actual state or change the state…
<?xml version="1.0" encoding="UTF8"?>
<SMARTPLUG id="edimax">
<CMD id="get">
<Device.System.Power.State></Device.System.Power.State>
</CMD>
</SMARTPLUG>
This is one king of the xml.
Thanks for your help ![]()
Hi all
I’m acutally struggeling with the new binding on OH3. To make that clear : I have no clue what i’m doing here, i’m doing my best to understand these programming topics but its a far way unitl i really understand the basics. Mainly i’m trying and following examples i find in the wide web.
My actual problem is my PV inverter which i need to bring back into OH. WIth the old HTTP binding i had the following setup which worked perfect on my Kostal Piko BA8.
Under Services i had http.config file with the following path :
kostalCache1.url=http://192.168.3.90/api/dxs.json?dxsEntries=33556736&dxsEntries=83888128&dxsEntries=16780032&dxsEntries=33555202&dxsEntries=33555201&dxsEntries=33555203&dxsEntries=33555458&dxsEntries=33555457&dxsEntries=33555459&dxsEntries=33556226&dxsEntries=33556229&dxsEntries=33556238&dxsEntries=33556230&dxsEntries=33556228&dxsEntries=33556227&dxsEntries=83886336&dxsEntries=83886592&dxsEntries=83886848&dxsEntries=83887106&dxsEntries=83887362&dxsEntries=83887618&dxsEntries=67109120&dxsEntries=67110400&dxsEntries=67110656&dxsEntries=67110144
THe item files lokked like that :
//Home - Zusammenfassung
Number Kostal_0 “DC Eingang gesamt [%d W]” { http=“<[kostalCache1:30000:JSONPATH($.dxsEntries[0].value)]” , autoupdate=“false” }
Number Kostal_1 “Eigenverbrauch [%d W]” { http=“<[kostalCache1:30000:JSONPATH($.dxsEntries[1].value)]” , autoupdate=“false” }
Number Kostal_2 “Betriebsstatus [MAP(kostal_status.map):%s]” { http=“<[kostalCache1:30000:JSONPATH($.dxsEntries[2].value)]” , autoupdate=“false” }
With the new binding i have included the following thing :
The channels look like that ;
Trace shows me that values arrive
2020-11-23 12:29:58.463 [TRACE] [p.internal.http.HttpResponseListener] - Received from ‘http://192.168.3.90/api/dxs.json?dxsEntries=33555458’: Code = {200}, Headers = {Content-Type: text/plain, Expires: Sun, 02 Jan 2000 11:11:11 GMT}, Content = {{“dxsEntries”:[{“dxsId”:33555458,“value”:492.231293}],“session”:{“sessionId”:0,“roleId”:0},“status”:{“code”:0}}}
2020-11-23 12:29:58.471 [TRACE] [p.internal.http.HttpResponseListener] - Received from ‘http://192.168.3.90/api/dxs.json?dxsEntries=33555459’: Code = {200}, Headers = {Content-Type: text/plain, Expires: Sun, 02 Jan 2000 11:11:11 GMT}, Content = {{“dxsEntries”:[{“dxsId”:33555459,“value”:0.000000}],“session”:{“sessionId”:0,“roleId”:0},“status”:{“code”:0}}}
2020-11-23 12:29:58.472 [TRACE] [p.internal.http.HttpResponseListener] - Received from ‘http://192.168.3.90/api/dxs.json?dxsEntries=83886848’: Code = {200}, Headers = {Content-Type: text/plain, Expires: Sun, 02 Jan 2000 11:11:11 GMT}, Content = {{“dxsEntries”:[{“dxsId”:83886848,“value”:3933.464355}],“session”:{“sessionId”:0,“roleId”:0},“status”:{“code”:0}}}
2020-11-23 12:29:58.495 [TRACE] [p.internal.http.HttpResponseListener] - Received from ‘http://192.168.3.90/api/dxs.json?dxsEntries=33555457’: Code = {200}, Headers = {Content-Type: text/plain, Expires: Sun, 02 Jan 2000 11:11:11 GMT}, Content = {{“dxsEntries”:[{“dxsId”:33555457,“value”:0.000000}],“session”:{“sessionId”:0,“roleId”:0},“status”:{“code”:0}}}
Then i link a new Item to the channel
But i always get either NULL or UNDEF as output of the item
I assume i need to enter something somewhere to transfer the value to the item but i have no clue what i have to enter and where…
If i use JSONpath on the link between Channel and item i’m asked for a JSONPath Expression. My assumption is that i need to enter something there but what ? ![]()
Most probably thats something very stupid and easy if you know what you do…
Hi all,
I’ve been using the http binding in OH2 for quite a while now and just started migrating to OH3.
I’m using Milestone2 release and struggle to find it.
Does “(edited; binding included in distribution)” mean, it should be there already?
I can’t find a .jar to download neither and am confused ![]()
Can someone enlighten me?
I’d be happy, if I could start to migrate my HTTP items and help testing…
“If you are using OH3, the binding is now included in the snapshots”
=> might be you need a snapshot release instead of the milestone.
Thanks @Matze_R,
Is there still a download available?
I’m using the docker install and would prefer to use the releases.
This is a “semi-prod” environment ![]()
And I’d be happy, if I don’t have to upgrade too often…
Thanks!
I just updated from milestone2 to M3 and it’s now available.
Thanks for your efforts!
I’ll give it a try now and provide feedback, if I find anything unusual ![]()
Thank you Jan.
Changing from defining headers on one line with “&” between, to one per line did the trick. I guess i misread the old http readme, where you apparently included the header in the URL: HTTP - Bindings | openHAB
Hi,
I’ve got the binding working and enabled a channel that is successfully reading the state of my switches.
Unfortunately I struggle with getting the command part working.
The HTTP page displays the status of a couple of switches like:
Switch A1 is: 1
Switch A2 is: 0
...
To control a switch a link like http://<ip>/rcOn=1 or http://<ip>/rcOff=1 where 1 is the ID of the switch can be used.
To read the state I use the following State Transformation REGEX:.*?A1 is: (.*?) .* and Open/Close Value as 1 / 0.
This works fine and the state of the Channel/Item follows the switch state correctly.
For the command extension I would probably need something like:
/rcXXX=1
Can anyone help to find the correct substitution for XXX?
I assume that I would need to replace the transformed on/off value of 1 with On and 0 with Off somehow, but am unable to find out how ![]()
Thanks a lot!
Hi,
when status and commands are completly different as in your case, I use a map transformation file for the command as described above on post #76
Hi @Foxejoe,
I saw this, but was unsure on what I need to map exactly.
When I tried I first didn’t see any HTTP calls when I flipped the switch.
Turned out, I added the Channel with type Contact…
Anyway, after a few more corrections here and there it’s finally working…
Thanks!





