Hi,
I need help regarding a JSON Path Transformation, as I would like to monitor the level of birch pollen flying around my location. As there’s no API on the page I’d like to querry, I’m using ParseHub to extract data.
This is working and returns the below JSON response:
{
"Birke": [
{
"Tag": "Montag, 07. Mai",
"selection2": [
{
"Belastung": "1"
},
{
"Belastung": ""
},
{
"Belastung": ""
},
{
"Belastung": ""
},
{
"Belastung": ""
},
{
"Belastung": ""
}
]
},
{
"Tag": "Dienstag, 08. Mai",
"selection2": [
{
"Belastung": "1"
},
{
"Belastung": ""
},
{
"Belastung": ""
},
{
"Belastung": ""
},
{
"Belastung": ""
},
{
"Belastung": ""
}
]
},
{
"Tag": "Mittwoch, 09. Mai",
"selection2": [
{
"Belastung": "1"
},
{
"Belastung": ""
},
{
"Belastung": ""
},
{
"Belastung": ""
},
{
"Belastung": ""
},
{
"Belastung": ""
}
]
}
]
}
- I added an entry to the http.cfg:
pollen.url=https://www.parsehub.com/api/v2/projects/xxx/last_ready_run/data?api_key=yyy&format=JSON
pollen.updateInterval=3600000
trying to call off the Pollen exposure for Monday 07th of Mai using this item configuration:
Number PollenBirke_d0 "Birkenpollenbelastung heute: [%s]" (Wetter) { http="<[pollen:60000:JSONPATH($.Birke[0].selection2[0].Belastung)]"}
I would have thought to get “1” in response of the above call, but what I see in the logs is:
2018-05-07 12:31:48.266 [WARN ] [ab.binding.http.internal.HttpBinding] - Transformation 'JSONPATH($['Birke'][0]['selection2'][0]['Belastung'])' threw an exception. [response=����ZtKVgobDhMP8F��RPr�,�NU�R��RP�b���t _�7?�$1]G��\O�71SIa,Y����\���g���rJ�I,.)��6T����V2�T��X.�R��p�L�+����H
�̒����
`XX����R����3]
org.openhab.core.transform.TransformationException: Invalid path '$['Birke'][0]['selection2'][0]['Belastung']' in '����ZtKVgobDhMP8F��RPr�,�NU�R��RP�b���t _�7?�$1]G��\O�71SIa,Y����\���g���rJ�I,.)��6T����V2�T��X.�R��p�L�+����H
�̒����
`XX����R����3'
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) [220:org.openhab.core.compat1x:2.3.0.201803231044]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:194) [215:org.openhab.binding.http:1.12.0.201803230213]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) [220:org.openhab.core.compat1x:2.3.0.201803231044]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [220:org.openhab.core.compat1x:2.3.0.201803231044]
What am I doing wrong here? Any help would be highly appreciated.
thanks,
Kurt