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
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: https://www.openhab.org/addons/bindings/http1/#http-headers
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!