Hoping to get some help integrating with a weather API.
I have looked at a number of examples and docs - sadly couldn’t find anything that was similar enough to get me on the right track.
The API I am trying to integrate with metocenapi API (Swagger UI) for a weather service. This provides json response with time stamps within dimensions
, and then the temperature/humidity/windspeed as variables
. Example below:
{
"dimensions": {
"point": {
"type": "point",
"units": "unknown",
"data": [
{
"lon": xx
"lat": xxx
}
]
},
"time": {
"type": "time",
"units": "unknown",
"data": [
"2023-11-18T23:45:36.47Z",
"2023-11-19T00:45:36.47Z",
"2023-11-19T01:45:36.47Z",
"2023-11-19T02:45:36.47Z",
"2023-11-19T03:45:36.47Z",
"2023-11-19T04:45:36.47Z",
"2023-11-19T05:45:36.47Z",
"2023-11-19T06:45:36.47Z",
"2023-11-19T07:45:36.47Z",
"2023-11-19T08:45:36.47Z",
"2023-11-19T09:45:36.47Z",
"2023-11-19T10:45:36.47Z",
"2023-11-19T11:45:36.47Z",
"2023-11-19T12:45:36.47Z",
"2023-11-19T13:45:36.47Z",
"2023-11-19T14:45:36.47Z",
"2023-11-19T15:45:36.47Z",
"2023-11-19T16:45:36.47Z",
"2023-11-19T17:45:36.47Z",
"2023-11-19T18:45:36.47Z",
"2023-11-19T19:45:36.47Z",
"2023-11-19T20:45:36.47Z",
"2023-11-19T21:45:36.47Z",
"2023-11-19T22:45:36.47Z",
"2023-11-19T23:45:36.47Z"
]
}
},
"noDataReasons": {
"ERROR_INTERNAL": 4,
"FILL": 1,
"GAP": 5,
"GOOD": 0,
"INVALID_HIGH": 3,
"INVALID_LOW": 2
},
"variables": {
"air.temperature.at-2m": {
"standardName": "air_temperature_at_2m_above_ground_level",
"units": "degreeK",
"siUnits": "K",
"dimensions": [
"time",
"point"
],
"data": [
290.90552,
290.93613,
290.94275,
290.9494,
290.95602,
290.96268,
290.96927,
290.90356,
290.81494,
290.72635,
290.63776,
290.54913,
290.4605,
290.37283,
290.2854,
290.198,
290.1106,
290.02316,
289.93576,
289.92242,
289.9325,
289.94257,
289.95264,
289.9627,
289.97278
],
"noData": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
}
}
I am struggling to work out how to create sensors that will provide the correct data as attributes, and work out how that can link back to the time
dimension.
Example above I have only air temperature, but I plan to pull back several. The other variables are set up the same as "air.temperature.at-2m
, all linking back to the time
dimension.
I was going down the past of a RESTful (RESTful - Home Assistant) rest
sensor, using json_attributes
from what I could work out from various examples/documentation.
I tried to look through the forums for similar examples - couldn’t find anything similar.
If someone could help point me in the right direction, I will really appreciate it!