I have an Accuweather REST sensor which returns detailed hourly forecasts.
I am trying to parse it using this:
rest:
- resource: https://dataservice.accuweather.com/forecasts/v1/hourly/12hour/REDACTED API AND LOCATION
sensor:
- name: Accuweather Hour 0
unique_id: accuweather_hour_0
value_template: >
{{ value_json[0].IconPhrase }}
json_attributes_path: "$[0]"
json_attributes:
- HasPrecipitation
scan_interval:
minutes: 30
I get a value in the state of the sensor but try as I might I cannot get any attributes.
I get his error:
This is two hours worth of the JSON response (I didn’t think copying all 12 here was necessary):
[
{
"DateTime": "2024-07-28T12:00:00+01:00",
"EpochDateTime": 1722164400,
"WeatherIcon": 4,
"IconPhrase": "Cloudy",
"HasPrecipitation": false,
"IsDaylight": true,
"Temperature": {
"Value": 22.5,
"Unit": "C",
"UnitType": 17
},
"RealFeelTemperature": {
"Value": 25,
"Unit": "C",
"UnitType": 17,
"Phrase": "Pleasant"
},
"RealFeelTemperatureShade": {
"Value": 21.4,
"Unit": "C",
"UnitType": 17,
"Phrase": "Pleasant"
},
"WetBulbTemperature": {
"Value": 15.8,
"Unit": "C",
"UnitType": 17
},
"WetBulbGlobeTemperature": {
"Value": 20.4,
"Unit": "C",
"UnitType": 17
},
"DewPoint": {
"Value": 11.5,
"Unit": "C",
"UnitType": 17
},
"Wind": {
"Speed": {
"Value": 7.4,
"Unit": "km/h",
"UnitType": 7
},
"Direction": {
"Degrees": 192,
"Localized": "SSW",
"English": "SSW"
}
},
"WindGust": {
"Speed": {
"Value": 13,
"Unit": "km/h",
"UnitType": 7
}
},
"RelativeHumidity": 49,
"IndoorRelativeHumidity": 49,
"Visibility": {
"Value": 16.1,
"Unit": "km",
"UnitType": 6
},
"Ceiling": {
"Value": 1585,
"Unit": "m",
"UnitType": 5
},
"UVIndex": 3,
"UVIndexText": "Moderate",
"PrecipitationProbability": 0,
"ThunderstormProbability": 0,
"RainProbability": 0,
"SnowProbability": 0,
"IceProbability": 0,
"TotalLiquid": {
"Value": 0,
"Unit": "mm",
"UnitType": 3
},
"Rain": {
"Value": 0,
"Unit": "mm",
"UnitType": 3
},
"Snow": {
"Value": 0,
"Unit": "cm",
"UnitType": 4
},
"Ice": {
"Value": 0,
"Unit": "mm",
"UnitType": 3
},
"CloudCover": 64,
"Evapotranspiration": {
"Value": 0.3,
"Unit": "mm",
"UnitType": 3
},
"SolarIrradiance": {
"Value": 711.2,
"Unit": "W/m²",
"UnitType": 33
}
},
{
"DateTime": "2024-07-28T13:00:00+01:00",
"EpochDateTime": 1722168000,
"WeatherIcon": 7,
"IconPhrase": "Cloudy",
"HasPrecipitation": false,
"IsDaylight": true,
"Temperature": {
"Value": 23.4,
"Unit": "C",
"UnitType": 17
},
"RealFeelTemperature": {
"Value": 24.2,
"Unit": "C",
"UnitType": 17,
"Phrase": "Pleasant"
},
"RealFeelTemperatureShade": {
"Value": 22.2,
"Unit": "C",
"UnitType": 17,
"Phrase": "Pleasant"
},
"WetBulbTemperature": {
"Value": 16,
"Unit": "C",
"UnitType": 17
},
"WetBulbGlobeTemperature": {
"Value": 19.5,
"Unit": "C",
"UnitType": 17
},
"DewPoint": {
"Value": 11.1,
"Unit": "C",
"UnitType": 17
},
"Wind": {
"Speed": {
"Value": 7.4,
"Unit": "km/h",
"UnitType": 7
},
"Direction": {
"Degrees": 170,
"Localized": "S",
"English": "S"
}
},
"WindGust": {
"Speed": {
"Value": 13,
"Unit": "km/h",
"UnitType": 7
}
},
"RelativeHumidity": 46,
"IndoorRelativeHumidity": 46,
"Visibility": {
"Value": 16.1,
"Unit": "km",
"UnitType": 6
},
"Ceiling": {
"Value": 1585,
"Unit": "m",
"UnitType": 5
},
"UVIndex": 2,
"UVIndexText": "Low",
"PrecipitationProbability": 0,
"ThunderstormProbability": 0,
"RainProbability": 0,
"SnowProbability": 0,
"IceProbability": 0,
"TotalLiquid": {
"Value": 0,
"Unit": "mm",
"UnitType": 3
},
"Rain": {
"Value": 0,
"Unit": "mm",
"UnitType": 3
},
"Snow": {
"Value": 0,
"Unit": "cm",
"UnitType": 4
},
"Ice": {
"Value": 0,
"Unit": "mm",
"UnitType": 3
},
"CloudCover": 95,
"Evapotranspiration": {
"Value": 0.3,
"Unit": "mm",
"UnitType": 3
},
"SolarIrradiance": {
"Value": 185.9,
"Unit": "W/m²",
"UnitType": 33
}
}
]
And just for completeness: