Met office (UK) - weather forecast

I have the Met Office Sensor and also the Met Office Weather component working - but neither is offering forecast data (at least when presented in Lovelace).
I added Meteo France with a location in France and I do see forecast data for that.

I see that the Met Office includes the following:
forecast = self._datapoint.get_forecast_for_site(, "3hourly")

So it looks like it is trying to get it.

The sensor used to work for me long time ago but I removed it as it generated a lot of errors in the HA log.
Added it to my config recently and… nothing. It does not create any sensors, never. I created an issue but so far no response. It does not have any debug output so it’s really hard to tell if it is actually doing anything.

If it helps, here is the relevant part of my config.yml for met office weather that seems to be working fine for me:

  - platform: metoffice
    api_key: !secret api_metoffice
    latitude: !secret metoffice_lat
    longitude: !secret metoffice_lon

# Sensors
  - platform: metoffice
    api_key: !secret api_metoffice
    latitude: !secret metoffice_lat
    longitude: !secret metoffice_lon
      - weather
      - temperature
      - feels_like_temperature
      - wind_speed
      - wind_direction
      - wind_gust
      - visibility
      - visibility_distance
      - uv
      - precipitation
      - humidity
1 Like

Do you get the 5 day forecast?

No, I never have (I may have mis-read the original question) , but from skimming through the home assistant source code for the Met Office component, it looks like HA doesn’t poll for it even though the DataPoint API supports it.

By comparison, the darksky component has code for hourly, 3 hourly and daily data.

I’m not a seasoned python coder though, so i could be wrong.

The Met Office have a new API (DataHub) which will apparently replace DataPoint at somepoint in the future, so met office integration will need to be rewritten to support that sooner or later.

Seeing as I (like a lot of people) have a lot of free time lately, i might take a crack at seeing if I can add forecasting to the existing integration.

1 Like

Fiar play, wouldn’t even know where to start personally :joy: twiddling home Assistant is the first time Ive even looked at some sort of code, enjoying it so far though learning something new.

So i’ve taken a look at the code and replicated a simple version locally.
From what i can see, the DataPoint API returns a 5 day forecast all the time if quered the same way HA does it.
So even though in the OP it looks like it’s requesting the forecast for only the next 3 hours:
forecast = self._datapoint.get_forecast_for_site(, "3hourly")

It’s in fact requesting a 5 day forecast, with a resolution of 3 hours.

I.e. today: 00:00, 03:00 … 18:00, 21:00;
tomorrow: 00:00, 03:00 … 18:00, 21:00;
day after tomorrow: 00:00, 03:00 … 18:00, 21:00…

So i’m not sure if this is technically a bug, but it may be worth creating an issue on github in the off chance.

There are a couple of open issues for this integration and a PR that looks like it’s going to be merged to core.

Hopefully won’t be too long before the functionality is available. :slight_smile:

Edit: As I his post I realise that one of the names from github looks familiar, it’s @JamiePhonic from this thread. :man_facepalming::joy:

Having problems adding this integration.
I created an account the other day and whenever I try to add the integration I get failed to connect. I used this for the api key:

That should be it right?

I created an API key using Your DataPoint API key - Met Office and it worked fine.

Anyone else getting problems with the sensor recently?
Keeping getting this error after a while: Check Met Office connection: ('DataPoint has not returned any data for therequested site.',)

yes recently I’ve had short-ish periods where all the sensors for the integration show as unavailable

Not just me then! I’m not sure if it came back by itself or it came back because I restarted the integration. It has happened to me twice over the last two or three days.

its not a vital function in my system so I just left it alone… it seems to come and go over time… although its been good for over 24 hours now