I’m trying to pull in data from the MyRadar API but (I think) my JSON attributes path is missing… something?
“JSON result was not a dictionary or list with 0th element a dictionary” is thrown but when I dump the results in a path finder the JSON attributes path appear correct.
rest:
- scan_interval: 7200
authentication: basic
password: "MyAPIKey"
resource: https://api.myradar.dev/forecast/MyLat,MyLong?extend=hourly&units=us&lang=en
sensor:
- name: "MyRadar Current Conditions"
json_attributes_path: "$.currently"
value_template: "OK"
json_attributes:
- "summary"
- "precipIntensity"
- "precipProbability"
- "precipType"
- "temperature"
- "apparentTemperature"
- "windSpeed"
- "cloudCover"
- "humidity"
- name: "MyRadar Daily Conditions"
json_attributes_path: "$.daily.data[0]"
value_template: "OK"
json_attributes:
- "sunriseTime"
- "sunsetTime"
- "moonPhase"
- "temperatureMin"
- "temperatureMinTime"
- "temperatureMax"
- "temperatureMaxTime"
I’ve also noticed that the response is gzipped. I don’t see anything in the documentation about encoding but could that be the issue?
The abbriged http response:
alt-svc: h3=":443"; ma=86400,h3-29=":443"; ma=86400
cache-control: max-age=300
content-encoding: gzip
content-type: application/json
date: Tue, 15 Nov 2022 13:23:21 GMT
expires: Tue, 15 Nov 2022 13:28:22 GMT
last-modified: Tue, 15 Nov 2022 13:23:22 GMT
transfer-encoding: chunked
vary: Accept-Encoding,Origin
{
"currently": {
"summary": "Rain.",
...
},
...
"daily": {
"data": [{
"time": 1668488400,
...
}]
}
}