API Call to convert into Sensor

Hi

I would like to use some data from this API call in HA. Ideally the various topics are copied into a sensor. This will be used to condition an automation later based on these values (detailed cloud coverage forecast for next 48hrs)

The data is fetched from this URL:
https://api.open-meteo.com/v1/meteofrance?latitude=49.30&longitude=8.40&hourly=temperature_2m,cloud_cover,cloud_cover_low,cloud_cover_mid,cloud_cover_high&timezone=Europe%2FBerlin

and looks like this:

{
  "current": {
    "time": "2022-01-01T15:00"
    "temperature_2m": 2.4,
    "wind_speed_10m": 11.9,
  },
  "hourly": {
    "time": ["2022-07-01T00:00","2022-07-01T01:00", ...]
    "wind_speed_10m": [3.16,3.02,3.3,3.14,3.2,2.95, ...],
    "temperature_2m": [13.7,13.3,12.8,12.3,11.8, ...],
    "relative_humidity_2m": [82,83,86,85,88,88,84,76, ...],
  }
}

how can I convert this API call into a sensor in HA?

with:

value_template: "{{ now() }}"
json_attributes:
  - current
  - hourly

Then use template sensors if you need to pull out individual values.

1 Like