I have http-binding installed to get data from a website, to extract several values.
- Installed HTTP-binding via Paper-UI.
2.Activated http.cfg
# timeout in milliseconds for the http requests (optional, defaults to 5000)
timeout=120000
# the interval in milliseconds when to find new refresh candidates
# (optional, defaults to 1000)
#granularity=
# whether to substitute the current time or state value into the URL
# (optional, defaults to true)
#format=
# configuration of the first cache item
owm_test.url=https://api.openweathermap.org/data/2.5/weather?id=123456&APPID=my-key_1-32&lang=de&units=metric
owm_test.updateInterval=450000
# configuration of the second cache item
#<id2>.url=
#<id2>.updateInterval=
- Created two items
String Test_1 "Test1" {http="<[owm_test:450000:JSONPATH($.[1].weather.main.temp)]"}
Number Test_2 "Test2" {http="<[owm_test:450000:JSONPATH($.[1].weather.main.pessure)]"}
- Tested my Url via Browser and got this
{
"coord": {
"lon": 9.xx,
"lat": 48.yy
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01d"
}
],
"base": "stations",
"main": {
"temp": 297.02,
"pressure": 1020,
"humidity": 38,
"temp_min": 296.15,
"temp_max": 298.15
},
"visibility": 10000,
"wind": {
"speed": 3.1,
"deg": 70
},
"clouds": {
"all": 0
},
"dt": 1539435000,
"sys": {
"type": 1,
"id": 4891,
"message": 0.004,
"country": "DE",
"sunrise": 1539409104,
"sunset": 1539448444
},
"id": 1234567,
"name": "Berlin",
"cod": 200
}
The Logger shows me now:
2018-10-14 01:27:10.173 [INFO ] [smarthome.model.script.weather-rules] - Forecast executed
2018-10-14 01:29:07.686 [WARN ] [ab.binding.http.internal.HttpBinding] - Transformation 'JSONPATH($.[1].weather.main.temp)' threw an exception. [response={"coord":{"lon":9.xx,"lat":48.yy},"weather":[{"id":800,"main":"Clear","description":"Klarer Himmel","icon":"01n"}],"base":"stations","main":{"temp":12.73,"pressure":1017,"humidity":87,"temp_min":11,"temp_max":14},"visibility":10000,"wind":{"speed":2.1,"deg":270},"clouds":{"all":0},"dt":1539471000,"sys":{"type":1,"id":4891,"message":0.0054,"country":"DE","sunrise":1539409142,"sunset":1539448393},"id":1234567,"name":"Berlin","cod":200}]
org.openhab.core.transform.TransformationException: Invalid path '$.[1].weather.main.temp' in '{"coord":{"lon":9.87,"lat":48.89},"weather":[{"id":800,"main":"Clear","description":"Klarer Himmel","icon":"01n"}],"base":"stations","main":{"temp":12.73,"pressure":1017,"humidity":87,"temp_min":11,"temp_max":14},"visibility":10000,"wind":{"speed":2.1,"deg":270},"clouds":{"all":0},"dt":1539471000,"sys":{"type":1,"id":4891,"message":0.0054,"country":"DE","sunrise":1539409142,"sunset":1539448393},"id":1234567,"name":"Berlin","cod":200}'
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) ~[193:org.openhab.core.compat1x:2.4.0.M4]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:194) [221:org.openhab.binding.http:1.13.0.M4]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) [193:org.openhab.core.compat1x:2.4.0.M4]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [193:org.openhab.core.compat1x:2.4.0.M4]
2018-10-14 01:29:07.696 [WARN ] [ab.binding.http.internal.HttpBinding] - Transformation 'JSONPATH($.[1].weather.main.pessure)' threw an exception. [response={"coord":{"lon":9.xx,"lat":48yy},"weather":[{"id":800,"main":"Clear","description":"Klarer Himmel","icon":"01n"}],"base":"stations","main":{"temp":12.73,"pressure":1017,"humidity":87,"temp_min":11,"temp_max":14},"visibility":10000,"wind":{"speed":2.1,"deg":270},"clouds":{"all":0},"dt":1539471000,"sys":{"type":1,"id":4891,"message":0.0054,"country":"DE","sunrise":1539409142,"sunset":1539448393},"id":1234567,"name":"Berlin","cod":200}]
org.openhab.core.transform.TransformationException: Invalid path '$.[1].weather.main.pessure' in '{"coord":{"lon":9.87,"lat":48.89},"weather":[{"id":800,"main":"Clear","description":"Klarer Himmel","icon":"01n"}],"base":"stations","main":{"temp":12.73,"pressure":1017,"humidity":87,"temp_min":11,"temp_max":14},"visibility":10000,"wind":{"speed":2.1,"deg":270},"clouds":{"all":0},"dt":1539471000,"sys":{"type":1,"id":4891,"message":0.0054,"country":"DE","sunrise":1539409142,"sunset":1539448393},"id":1234567,"name":"Berlin","cod":200}'
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) ~[193:org.openhab.core.compat1x:2.4.0.M4]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:194) [221:org.openhab.binding.http:1.13.0.M4]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) [193:org.openhab.core.compat1x:2.4.0.M4]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [193:org.openhab.core.compat1x:2.4.0.M4]
2018-10-14 01:36:38.571 [WARN ] [ab.binding.http.internal.HttpBinding] - Transformation 'JSONPATH($.[1].weather.main.temp)' threw an exception. [response={"coord":{"lon":9.xx,"lat":48.xx},"weather":[{"id":800,"main":"Clear","description":"Klarer Himmel","icon":"01n"}],"base":"stations","main":{"temp":12.5,"pressure":1017,"humidity":81,"temp_min":11,"temp_max":14},"visibility":10000,"wind":{"speed":0.5},"clouds":{"all":0},"dt":1539472800,"sys":{"type":1,"id":4891,"message":0.0033,"country":"DE","su
Have i forgotten something to set?
Is there someone to help me ?
Thank’s in advance