31 Commits

Author SHA1 Message Date
Magnus
bd0b3c00ad
New weather provider: Yr.no (#2948)
# Added Yr.no as a weather provider

Yr.no is a free Norwegian weather service. The configuration is quite
simple:
```js
{
    weatherProvider: "yr",
    lat: 59.9171,
    lon: 10.7276,
    altitude: 30
}
```
The latitude and longitude cannot have more than 4 decimals, but that
should be plenty. To quote yr: "There is no need to ask for weather
forecasts with nanometer precision!". The altitude should be meters
above sea level and defaults to 0. If `type` is set to `current` the
symbol can display the next 1, 6 or 12 hours by setting
`currentForecastHours` (default is 1).

It states in [Getting
started-guide](https://developer.yr.no/doc/GettingStarted/) that users
of the API should cache the results and use the `Expires`-header to know
when to ask for new data. By using the `If-Modified-Since`-header we can
avoid downloading the same data over and over again. I chose not to
override the `User-Agent`-header set in
[`server.js`](https://github.com/MichMich/MagicMirror/blob/a328ce5/js/server.js#L97)
even though it does not comply with [the terms of
service](https://developer.yr.no/doc/TermsOfService/). It currently
works with the default header, and by searching the web for MagicMirror
the GitHub-repo should be easy to find without an explicit link.

I also had to make some minor changes to `server.js` and
`weatherprovider.js` to be able to send and return HTTP headers. To
handle the HTTP 304 response without body I chose to return `undefined`
so we easily can use the response as a condition: `if (response) ...`.

The documentation for the API is available here:
- [API Reference overview](https://api.met.no/weatherapi/)
-
[Locationforecast](https://api.met.no/weatherapi/locationforecast/2.0/)
- Used to get the weather forecast
- [Sunrise](https://api.met.no/weatherapi/sunrise/2.0/documentation) -
used to find sunrise and sunset times

Co-authored-by: Veeck <github@veeck.de>
2022-11-08 06:18:47 +01:00
Veeck
d5e855dd6d
Use fetch instead of XMLHttpRequest in weatherprovider (#2935)
small update to the fetchData method to use the fetch helper instead of
the old XCMLHttpRequest.
Also fixes some typos :-)

Co-authored-by: veeck <michael@veeck.de>
2022-10-06 19:44:16 +02:00
Michael Teeuw
da90412cea
Merge pull request #2798 from khassel/cors 2022-01-28 11:22:43 +01:00
Kristjan SCHMIDT
a5668b1b99 Magic Mirror -> MagicMirror²
Consistent spelling
2022-01-26 23:09:26 +01:00
Karsten Hassel
f04dd6b6cd introduce useCorsProxy, per default only enabled for darksky and envcanada 2022-01-26 22:44:20 +01:00
Karsten Hassel
59bc2318f8 fix weather tests and add CHANGELOG 2022-01-26 00:29:01 +01:00
Karsten Hassel
c622db918b working version, use corsUrl in weather providers 2022-01-25 23:42:42 +01:00
Karsten Hassel
0ec80a7791 move weather-test to e2e 2021-10-16 00:05:12 +02:00
rejas
838eed2630 Use es6 notation in weatherprovider 2021-04-18 15:06:06 +02:00
buxxi
5a421220c9 Updating readme and changelog and fixing typo in method 2021-01-23 11:40:02 +01:00
buxxi
41508931be Moving default values regarding specific providers into the providers themselves 2021-01-23 11:21:56 +01:00
buxxi
e2cfa24686 make weatherprovider have a method for hourly fetching instead of a generic weatherData 2021-01-23 10:45:55 +01:00
Michael Teeuw
207a9ba723
Merge branch 'develop' into bryanzzhu-weather 2020-09-18 12:15:44 +02:00
rejas
c8664d5952 Cleanup weatherprovider jsdoc 2020-07-30 12:58:35 +02:00
rejas
43bcf4ab98 Run eslint over files, see what gets fixed automatically and clean up 2020-07-27 14:25:43 +02:00
Bryan Zhu
f73520559e typo and bug fixes 2020-06-30 12:06:16 -04:00
Bryan Zhu
4a162543f6 added OpenWeatherMap One Call API function to default Weather module, added wDataHourly type 2020-06-30 02:40:41 -04:00
Veeck
abb5dc5739 Run prettier over ALL files once
No other changes done in this commit
2020-05-11 22:22:32 +02:00
rejas
e7fc4ef1e7 Replace unsecure links with https ones 2020-04-28 23:05:28 +02:00
Veeck
ec187fe109 Update changelog and commen tags 2020-04-21 12:23:50 +02:00
vincep5
819c4cde1c Fix for weather module not refreshing data after exception 2019-07-11 12:49:24 -05:00
rejas
835668d96d Add eslint semi rule 2019-06-05 10:23:58 +02:00
rejas
2bce15dc6e Remove multiple-empty-lines 2019-06-05 10:03:28 +02:00
rejas
8f1a212b52 More typo fixes 2019-06-05 09:46:59 +02:00
fewieden
de04c12d3c fix rain amount information for different units and providers, documentation 2018-12-30 20:46:25 +01:00
fewieden
10bc326490 cleanup 2018-12-27 19:37:02 +01:00
fewieden
63836185d9 weatherprovider 2018-12-27 17:13:06 +01:00
Michael Teeuw
ab732b5435 Make all visiable values dynamic. 2017-10-18 13:38:56 +02:00
Michael Teeuw
ff9c6bac0a Add a small forecast example. 2017-09-22 13:26:44 +02:00
Michael Teeuw
713111254b First implementation of the currentWeatherView 2017-09-22 12:26:47 +02:00
Michael Teeuw
ef172592b8 A first setup of the new Weather Module 2017-09-21 16:38:18 +02:00