Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pirate weather api #36

Open
EM1138 opened this issue Nov 13, 2022 · 6 comments
Open

Add Pirate weather api #36

EM1138 opened this issue Nov 13, 2022 · 6 comments

Comments

@EM1138
Copy link

EM1138 commented Nov 13, 2022

I discovered that Pirate Weather has created an API designed to be a drop in replacement/ alternative to the Dark Sky API. Could you add this to DarkSkyForecast? Using apiBase: "https://api.pirateweather.net" and my Pirate weather API key in the default weather app for weatherProvider: "darksky" does work. Please see https://pirateweather.net/getting-started for more info. Thank you.

@dankerthrone
Copy link

Hi, so you did get this to work? Would you mind sharing your config?

So far, I've adapted the node_helper.js to point to https://api.pirateweather.net/ like you suggested and then configured the module like I normally would. However, that doesn't work for me :-/

Any advice is greatly appreciated.

@EM1138
Copy link
Author

EM1138 commented Dec 28, 2022

I only changed the config for the default weather module.
module: "weather",
disabled: false,
position: "top_right",
config: {
weatherProvider: "darksky",
apiBase: 'https://api.pirateweather.net/',
type: "current",
weatherEndpoint: "forecast",
lat: MyLat,
lon: MyLon,
apiKey: PirateWeatherAPI,
roundTemp: true,
colored: true,
fade: false,
showHumidity: true
}
},

@dankerthrone
Copy link

Alright, so for anyone else wanting to use this module with the pirateweather api it's actually really easy. I don't even know enough about coding to implement my solution with a pull request or however one would go about this, but I was able to patch my own system so that this module worked again.

Most of the work is getting the API set up.

Here's what I did:

Reinstall the module from scratch:

cd MagicMirror/modules

rm -r MMM-DarkSkyForecast

git clone https://github.com/jclarke0000/MMM-DarkSkyForecast.git

cd MMM-DarkSkyForecast

npm install

Get Pirateweather API

The Pirateweather dev @alexander0042 has meant for the Pirateweather API to be a drop-in replacement for Dark Sky, so we really don't need to a whole lot. However, signing up for an account at https://pirateweather.net/ is not all - you should read the documentation! Also, don't generate an API-key for the dev version, use "beta" instead to generate an API key for api.pirateweather.net. Then also activate it - luckily the dashboard has a test function built in. However, it generates a test URL that messes up your location. Test it using this template:

https://api.pirateweather.net/forecast/APIKEY/55.03,16.06?units=si

You should get a result. Now, all that's left is telling the module to use a different API. This is done via

Editing node_helper.js

In Line 44, replace "https://api.darksky.net/forecast/" with "https://api.pirateweather.net/forecast/"
In your main MM config.js, edit the config to include this module like you want it and paste your API-Key.

Now do

pm2 restart mm

And it should work.

dankerthrone added a commit to dankerthrone/MMM-PirateSkyForecast that referenced this issue Jan 28, 2023
to pirateweather.net as described here: jclarke0000#36 (comment)
dankerthrone added a commit to dankerthrone/MMM-PirateSkyForecast that referenced this issue Jan 28, 2023
as described here: jclarke0000#36 (comment)
You'll need to update your readme.md to reflect the new weather data provider.
@ericjohncarlson
Copy link

@dankerthrone Thanks for the directions there, this worked great for me. It looks like the PirateWeather "beta" is now over, so can just subscribe to the standard API. The only data missing is the longer-form text-based "summary" that was such a nice addition from DarkSky. This is reduced to just "Clear" "Cloudy". However, the rest of the data mapped perfectly and we'll give it a shot.

Pity about the DarkSky API. Was a great source of accurate weather information and a really nice addition to MM.

@tcsabina
Copy link

Thanks @dankerthrone for the detailed instructions how to make this work with 'Pirate-weather'.
I had some issues login in to 'pirate-weather.apiable.io' after registering using Firefox. But at the end I've managed to login with Edge, and was able to register the free tier.

@TATUMTOT
Copy link

@dankerthrone THANK YOU SO MUCH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants