MetOffice integration becoming redundant by 03/25 unless updated
The problem
Dear HA Team and Community,
Currently, the UK MetOffice datapoint service is not taking any new registrations as the service is being decommissioned in March 2025. (See LINK).
The MetOffice now provides a new service - Weather Data Hub, which people can subscribe for for free (with a fixed monthly number of calls). It should be integratable into Home Assistant. It just uses different API keys and provides data in GeoJSON format.
If the Metoffice integration is updated to provide this new service, I am sure many UK Home Assistant users would appreciate it. I think there are plenty of Python wizards among you to make light work of this. This would spare us having to create custom GeoJSON servers to pass to HA.
Below is the example python code from MetOffice and attached is the corresponding GeoJSON file I received:
` import requests import argparse import time import sys import logging as log
log.basicConfig(filename='ss_download.log', filemode='w', format='%(asctime)s - %(levelname)s - %(message)s')
base_url = "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/"
def retrieve_forecast(baseUrl, timesteps, requestHeaders, latitude, longitude, excludeMetadata, includeLocation):
url = baseUrl + timesteps
headers = {'accept': "application/json"}
headers.update(requestHeaders)
params = {
'excludeParameterMetadata' : excludeMetadata,
'includeLocationName' : includeLocation,
'latitude' : latitude,
'longitude' : longitude
}
success = False
retries = 5
while not success and retries >0:
try:
req = requests.get(url, headers=headers, params=params)
success = True
except Exception as e:
log.warning("Exception occurred", exc_info=True)
retries -= 1
time.sleep(10)
if retries == 0:
log.error("Retries exceeded", exc_info=True)
sys.exit()
req.encoding = 'utf-8'
print(req.text)
if name == "main":
parser = argparse.ArgumentParser(
description="Retrieve the site-specific forecast for a single location"
)
parser.add_argument(
"-t",
"--timesteps",
action="store",
dest="timesteps",
default="hourly",
help="The frequency of the timesteps provided in the forecast. The options are hourly, three-hourly or daily",
)
parser.add_argument(
"-m",
"--metadata",
action="store",
dest="excludeMetadata",
default="FALSE",
help="Provide a boolean value for whether parameter metadata should be excluded."
)
parser.add_argument(
"-n",
"--name",
action="store",
dest="includeLocation",
default="TRUE",
help="Provide a boolean value for whether the location name should be included."
)
parser.add_argument(
"-y",
"--latitude",
action="store",
dest="latitude",
default=" YOUR LATITUDE GOES HERE ",
help="Provide the latitude of the location you wish to retrieve the forecast for."
)
parser.add_argument(
"-x",
"--longitude",
action="store",
dest="longitude",
default=" YOUR LONGITUDE GOES HERE ",
help="Provide the longitude of the location you wish to retrieve the forecast for."
)
parser.add_argument(
"-k",
"--apikey",
action="store",
dest="apikey",
default=" YOUR API KEY GOES HERE ",
help="REQUIRED: Your WDH API Credentials."
)
args = parser.parse_args()
timesteps = args.timesteps
includeLocation = args.includeLocation
excludeMetadata = args.excludeMetadata
latitude = args.latitude
longitude = args.longitude
apikey = args.apikey
# Client API key must be supplied
if apikey == "":
print("ERROR: API credentials must be supplied.")
sys.exit()
else:
requestHeaders = {"apikey": apikey}
if latitude == "" or longitude == "":
print("ERROR: Latitude and longitude must be supplied")
sys.exit()
if timesteps != "hourly" and timesteps != "three-hourly" and timesteps != "daily":
print("ERROR: The available frequencies for timesteps are hourly, three-hourly or daily.")
sys.exit()
retrieve_forecast(base_url, timesteps, requestHeaders, latitude, longitude, excludeMetadata, includeLocation)
What version of Home Assistant Core has the issue?
core-2024.8.3
What was the last working version of Home Assistant Core?
core-2024.8.3
What type of installation are you running?
Home Assistant OS
Integration causing the issue
MetOffice
Link to integration documentation on our website
https://www.home-assistant.io/integrations/metoffice/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
Hey there @mrharcombe, @avee87, mind taking a look at this issue as it has been labeled with an integration (metoffice) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of metoffice can trigger bot actions by commenting:
@home-assistant closeCloses the issue.@home-assistant rename Awesome new titleRenames the issue.@home-assistant reopenReopen the issue.@home-assistant unassign metofficeRemoves the current integration label and assignees on the issue, add the integration domain after the command.@home-assistant add-label needs-more-informationAdd a label (needs-more-information, problem in dependency, problem in custom component) to the issue.@home-assistant remove-label needs-more-informationRemove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.
(message by CodeOwnersMention)
metoffice documentation metoffice source (message by IssueLinks)
The Met Office have provided sample data but they've said that..
The sample data must not be used for commercial or operational use and must not be share with any third parties.
So there could be potential issues around even including a test fixture in the HA codebase.
Hi, I maintain the datapoint-python package that HomeAssistant uses. I've today released an update to the package which supports the new DataHub API. There had previously been some discussion of this here: https://github.com/home-assistant/core/issues/109301.
Hi @EJEP Thanks for your work on this. I had the service drop today I assume because of some outage with Datapoint. I've done the usual searching around for answers and came across your post. Can you tell me what I need to do to get this working with the DataHub API? as I've signed up there and got myself a new login and API key, but nowhere can I see anywhere to input these details into the integration.
I've not made any changes to Home Assistant. I had a quick look at the integration, but I'm not really sure what needs doing. @MrHarcombe or @avee87 will be able to help here
Same issue here, integration is down and this error appears in the logs:
Logger: homeassistant.components.metoffice.helpers Source: components/metoffice/helpers.py:37 integration: Met Office (documentation, issues) First occurred: 21 November 2024 at 11:49:38 (103 occurrences) Last logged: 07:40:20
Check Met Office connection: ('DataPoint has not returned any data for therequested site.',)
I am having similar problems; this same error is in the logs;
Logger: homeassistant.components.metoffice.helpers Source: components/metoffice/helpers.py:37 integration: Met Office (documentation, issues) First occurred: 12:46:01 (14 occurrences) Last logged: 14:39:30
Check Met Office connection: ('DataPoint has not returned any data for therequested site.',)
I am getting the same issue.
It may be coincidental, but I only noticed this happening after upgrading core 2024.11.2 to core 2024.11.3 earlier today.
Same symptoms yesterday when I was still on 2024.11.2, so I don't think it is related to the upgrade to 2024.11.3.
Same symptoms yesterday when I was still on 2024.11.2, so I don't think it is related to the upgrade to 2024.11.3.
I think is a MetOffice issue, I have been seeing the issue intermittently for the past 3 days.
But we are still on the countdown for the removal of the Met Office DataPoint access, if the integration is still not using the Data Hub (can't get a definitive answer from the discussion)
@aycuens The metoffice HA integration is definitely still on DataPoint.
@EJEP released DataHub support in V0.10.0: https://github.com/EJEP/datapoint-python/blob/master/CHANGELOG.md#0100---2024-11-17 (Thanks!)
HA metoffice component is still using datapoint 0.9.9:
"requirements": ["datapoint==0.9.9"]
https://github.com/home-assistant/core/blob/dev/homeassistant/components/metoffice/manifest.json#L9
So it needs someone with enough time to figure out whats required for HA to use datapoint==0.10.0,
I may take a stab at this tomorrow if I have time
Thought I would check in on this as I remembered Datapoint is changing to Datahub before too long, happy to try and assist again but looks like you guys have it all in hand! Thank you for your efforts.
Has this been switched over yet? I tried my Met Office Weather hub API key and it failed to connect
Not yet, still waiting for PR to be accepted. @joostlek, @gjohansson-ST, is there anything I could do to get this moving?
I think the migration might finally have happened. As of this morning, my integration won't load and I'm getting "Check Met Office connection: ('DataPoint has not returned any data for therequested site.',)". Bump @joostlek @gjohansson-ST 🙂 this is likely the main weather integration people in the UK will be using.
I think the migration might finally have happened. As of this morning, my integration won't load and I'm getting "Check Met Office connection: ('DataPoint has not returned any data for therequested site.',)". Bump @joostlek @gjohansson-ST 🙂 this is likely the main weather integration people in the UK will be using.
It looked like it was still working for me on datapoint, but then I reloaded the integration and am now getting the same error. The PR which swaps to datahub is still open though.
I was getting errors earlier in the week about the datapoint API not working so had assumed that the met office had retired it now
But today it’s back and working again. Met Office website says retirement is Sept 2025 so maybe its been pushed back https://www.metoffice.gov.uk/services/data/datapoint/datapoint-retirement-faqs
But still closed to new registrants so a move to datahub is definitely needed
My service is now unavailable so either they have production issues, or the migration taking place earlier than September 2025. Are there any other good UK weather integrations?
For info, the service does periodically go "unavailable" but generally returns after a while, so this isn't necessarily the end of the service. The website suggests September 2025, but obviously no new users can sign up in the interim.
Is there anything we can help with to get the new service merged and running? Is there a sticking point?
My service is now unavailable so either they have production issues, or the migration taking place earlier than September 2025. Are there any other good UK weather integrations?
It was definitely working for me earlier today, and has also now gone unavailable, but it did that earlier today as well. I suspect it's just overloaded server as the website does say it's retired in September (was March 2025)
Suffering same issue with DataPoint. Frequently fails, but seems to come back after a few hours if the integration is reloaded.
Although I'm not a dev, I'm happy to help with testing of Datahub integration.
2025-04-07 08:17:53.740 ERROR (SyncWorker_22) [homeassistant.components.metoffice.helpers] Check Met Office connection: ('DataPoint has not returned any data for therequested site.',)
It keeps becoming unavailable randomly. The only data points I use are 3hourly precipitation % and 3hour temperature. but I'd be quite happy moving to something else or even creating these sensor myself but using others weather data sources.
I actually bought my own weather sensor to find out the difference in forecasts vs real weather and its quite stark, often forecast in warmer weather is about 7°c below the actual temperature. Wind forecast is often higher than reality.
Plan to use these datapoints to make a Machine learning algorithm for correct weather forecast.
For now I've had this working for my 3 point weather feeds for months
https://community.home-assistant.io/t/template-weather-provider-from-uk-met-office-datahub-api/695692
Fun fact from my previous job. We were on a drama in Cornwall with the drone and the producer phoned the met office for an uptown date forecast for tomorrow (cost £1000!) then it rained the next day. 😂 but he's off the hook as can say well someone said xyz.
Anyway it looks like this new api is a bit less useful as in % of rain etc? I suppose it can be manually made from hourly weather forcast. Will have to delve into what's available in the API.
So I shalll probably proceed with my own machine learning project where we take a range of providers forecasts plus my own weather station & create a model from that.