Api.met.no REST fails as it now requires User-agent

I have a ton of weather-info in my Home assistant, as it is the engine under my power price prognosis.

Today most of my weather-graphs were ‘loading’, and not displaying data.

I use Apexcharts-card

Apparently Met.no now have stricter rules, that if you use their data, you should identify yourselves in the User-agent.

Luckily, Home Assistant can do just that, here is a redacted example:

  - platform: rest
    name: Wind_where_I_live
    resource: https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=55[FILL IN HERE]
    json_attributes_path: "$.properties"
    json_attributes:
      - timeseries
    scan_interval: 3600
    headers:
      User-Agent: Home Assistant [email protected]
      Content-Type: application/json
    value_template: "OK"

Modify your configuration.yaml to add the User-agent lines as above, and pls remember to add your proper email instead of [email protected]

BR Henrik

3 Likes

When adding your lines above in my sensors.yaml I get the following error:
Invalid config for [sensor.rest]: [json_attributes_path] is an invalid option for [sensor.rest]. Check: sensor.rest->json_attributes_path.
What is wrong?

Can you help?