Read the statement by Michael Teeuw here.
New Default Weather Module: Hourly Forecast
-
Greetings.
In the latest MagicMirror update, the new default weather module was added, which is designed such that it can work for multiple different API providers.
In this new module, there is pre-coded support for the Met Office’s Data Hub, a service which for me, living in the UK, is a better service than other providers such as OpenWeather.
The module can offer two modes: Daily Forecast and Current Weather.
I’m wondering whether anyone would be able to create a third mode: Hourly Forecast.The Met Office Data Hub API offers free global hourly spot data, so I hope I’m not just requesting it for myself, but instead this would be available and useful to anyone.
The “Current Weather” mode already uses the hourly forecast to receive its data.
I believe there is some relatively straightforward way to combine the requests of the hourly forecast for the current weather in the format of the “daily forecast”.I get the feeling this wouldn’t be too difficult for someone with their head screwed on who knows what they’re doing.
Many thanks and kind regards,
MagicJake
-
@MagicJake I can’t help with your issue, however I wondered how you managed to get the Met Office data working? I’ve not ever managed to get it to work - and I’m desperate to as every other weeather module’s data provider seems to be majorly inaccurate when it comes to the great British weather (forecasting)
-
@robertybob No worries, I’ll lay out the steps clear as I can here:
This is for the newly created default module “Weather”, created in the MM update v2.12, so make sure it’s updated to that to get it.
The first thing to note is that the Met Office offers two API services: “Data Point” and “Data Hub”.
Data Hub is the better option which they say will take over the other one at some point - so I’d highly suggest using that over Data Point.Just scroll down a bit on this page to get Data Hub:
https://www.metoffice.gov.uk/services/dataRegister an account, and log in - might need to verify email.
Once logged in, you’ll need to register an application - this will be the magic mirror. Click on your email in the top right and go to “My Applications”. Register an application, give it the name you want, accept the terms and continue.
IMPORTANT: The next page will give you the “client secret”, click to show it and copy it down somewhere onto a notepad document and save it - you will need it later. You will no longer be able to see the client secret unless you reset it!
Scroll down and it will show your new application, make sure you copy the “Client ID” as well to go with the Client Secret.
On the top bar, go to API Usage Plans, scroll down and select “Global spot data bundle (1.1.1)”.
This takes you to a page with the plans on - you want the free one, so click subscribe and match it with the application you have just created.You also need the latitude and longitude of the place you want - a quick google can bring it up.
For example Lat and Lon of London is (51.509865, -0.118092)Now you have all the information, you can input it into your config file.
IMPORTANT: It wasn’t stated in the documentation, but the value for “weatherProvider” is “ukmetofficedatahub”.Here’s what’s in my config file if that will help too:
{ module: "weather", position: "top_left", config: { weatherProvider: "ukmetofficedatahub", type: "forecast", apiBase: "https://api-metoffice.apiconnect.ibmcloud.com/metoffice/production/v0/forecasts/point/", lat: "51.509865", lon: "-0.118092", apiKey: "YOUR CLIENT ID", apiSecret: "YOUR CLIENT SECRET", showPrecipitationAmount: true, fade: false, } },
Hope that helps, if there’s anything else, DM me, and I’ll see what I can do!
-
@MagicJake wow thank you for such a thorough reply, I’ll give a try and report back !
-
@MagicJake said in New Default Weather Module: Hourly Forecast:
module: “weather”,
position: “top_left”,
config: {
weatherProvider: “ukmetofficedatahub”,
type: “forecast”,
apiBase: “https://api-metoffice.apiconnect.ibmcloud.com/metoffice/production/v0/forecasts/point/”,
lat: “51.509865”,
lon: “-0.118092”,
apiKey: “YOUR CLIENT ID”,
apiSecret: “YOUR CLIENT SECRET”,
showPrecipitationAmount: true,
fade: false,
}Thanks for this - so so helpful…
-
The best way to do that is to open the default weather and grab the url and follow it. IF that data is available then it wouldn’t be that hard to do…