256 Commits

Author SHA1 Message Date
Veeck
c714399b4d
Fix weathergov provider hourly weather forecast (#3011)
Hourly forecast wasnt converted properly during the last release cycle,
one fix and two cleanups were necessary.

Fixes #3010

Co-authored-by: veeck <michael@veeck.de>
2023-01-16 21:52:11 +01:00
Karsten Hassel
8d9f132666
add Pirate Weather as new weather provider (#3006)
solves #3005 

- same api as former dark sky provider
- website: https://pirateweather.net/
2023-01-15 11:12:55 +01:00
Veeck
6e80e5a295
Add option to show hourly forecast in increments (#2998)
Adds new config option to show weather forecast for every X hour
(default value is 1 which reflects the current behaviour)
Also adds tests for hourly forecast
Fixes #2996

Co-authored-by: veeck <michael@veeck.de>
2023-01-10 18:55:07 +01:00
Veeck
fc303146a5
Remove darksky weather provider (#2993)
since the web api gets shut down end of march, see
https://darksky.net/dev

Co-authored-by: veeck <michael@veeck.de>
2023-01-07 20:14:03 +01:00
Veeck
a975b44fbb
Fix wrong day labels in envcanada forecast (#2992)
Fixes #2987

lastDate isnt a unix date, but just a normal moment-date

Co-authored-by: veeck <michael@veeck.de>
2023-01-07 20:12:23 +01:00
Andrés Vanegas Jiménez
e9be668d1b
Added a WeatherProvider for Open-Meteo (#2964)
## Added Weather Provider for Open-Meteo.

I've found a completely free weather REST API (event with option of
self-hosting) after having problems with API keys from all MagicMirror
weather providers currently implemented (the remote services, not the
providers themselves).

This API doesn't return information about reverse geocode from latitude
and longitude options like others. I solved that issue using another
free API.

### APIs used
- [Open-Meteo Weather Forecast API](https://open-meteo.com/en/docs)
- [BigDataCloud’s Free Client-Side Reverse Geocoding
API](https://www.bigdatacloud.com/docs/api/free-reverse-geocode-to-city-api)

### Considerations
- This provider is config reliable so, be free to use the same config
you can found in the official MagicMirror Weather module documentation.
- This module config skips the `apiKey` parameter. It's not used at all.
Only `latitude` and `longitude` are required.

#### Config examples:
```
modules: [
  {
    module: "weather",
    position: "top_right",
    header: "Weather Forecast",
    config: {
      updateInterval: <number here>, 
      weatherProvider: "openmeteo",
      type: "current",
      lat: <number here>,
      lon: <number here>,
      showHumidity: true,
      showWindDirectionAsArrow: true,
      showWindDirection: true,
      degreeLabel: true,
    }
  },
  {
    module: "weather",
    position: "top_right",
    header: "Weather Forecast",
    config: {
      updateInterval: <number here>,
      weatherProvider: "openmeteo",
      type: "daily",
      lat: <number here>,
      lon: <number here>
      colored: true,
      maxNumberOfDays: <number here>,
      showPrecipitationAmount: true,
      appendLocationNameToHeader: true
    }
  },
  {
    module: "weather",
    position: "top_right",
    header: "Weather Forecast",
    config: {
      updateInterval: <number here>,
      weatherProvider: "openmeteo",
      type: "hourly",
      lat: <number here>,
      lon: <number here>,
      maxEntries: <number here>,
      showPrecipitationAmount: true,
      degreeLabel: true,
      appendLocationNameToHeader: true
    }
  },
]
```

Co-authored-by: Michael Teeuw <michael@xonaymedia.nl>
2022-12-26 11:56:01 +01:00
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
c191ff0032
Refactor common weather methods into utils class (#2958)
Co-authored-by: veeck <michael@veeck.de>
2022-10-28 19:56:55 +02:00
Veeck
dde88601a6
Make sure smhi provider api only gets a maximimum of 6 digits coordinates (#2956)
Fixes #2955

Co-authored-by: veeck <michael@veeck.de>
2022-10-24 20:27:18 +02:00
Veeck
2d3940a4ff
Use metric units internally in all weatherproviders (#2849)
So finally I think this refactorin is ready to be reviewed :-)

DONE:
- [x] Removed all conversion functions for wind and temperature from
specific weatherproviders
- [x] Use internally only metric units: celsius for temperature, meters
per seconds for wind
- [x] Convert temp and wind into the configured units when displaying
data on the UI
- [x] look how beaufort calculation uses metrics, added knots as new
windunit
- [x] add more e2e tests 

Checked providers:
- [x] Darksky
- [x] EnvCanada
- [x] OpenWeatherMap
- [x] SMHI provider 
- [x] UK Met Office
- [x] UK Met Office DataHub
- [x] WeatherBit
- [x] WeatherFlow
- [x] WeatherGov

TODO in different tickets:
- check weatherproviders for usage of weatherEndpoint (as seen in
https://github.com/MichMich/MagicMirror-Documentation/issues/131) -> see
#2926
- cleanup precipations -> #2953

Co-authored-by: veeck <michael@veeck.de>
2022-10-24 19:41:34 +02:00
Veeck
fc59ed20e3
Convert moment(..., "X") to moment.unix(...) (#2950)
because I thought it was more readable and I found a little bug when
calculatin suntimes on the way....

Co-authored-by: veeck <michael@veeck.de>
2022-10-16 23:37:50 +02:00
dWoolridge
21ae79b386
weathergov.js: Removed weatherEndpoint definition (#2936)
Removed weatherEnpoint definition in defaults. It is not used in the
weathergov.js provider.
2022-10-07 19:03:52 +02: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
dWoolridge
a86e27a12c
Added fetchWeatherHourly functionality to Weather.gov provider (#2933)
Added fetchWeatherHourly functionality to:
 modules/default/weather/providers/weathergov.js
2022-10-06 09:56:32 +02:00
Malte Hallström
8212d30c4c
fix(weather/smhi) Correctly reference apparent temp method (#2931)
This PR addresses [this
comment](48756e8774 (commitcomment-85772193)),
which points out an issue with #2902.

Looks like the apparent temp calculation method was incorrectly
referenced 😅
2022-10-04 11:07:40 +02:00
Karsten Hassel
6cad0e191b fix weather README 2022-09-21 23:40:15 +02:00
Malte Hallström
50f72f09ac
refactor: fix linting & code style issues 2022-08-30 10:06:34 +02:00
Malte Hallström
02cf9b37e2
refactor: use const instead of let 2022-08-29 20:08:27 +02:00
Malte Hallström
0a1067ec7d
feat(weather/smhi): support custom location names 2022-08-28 20:31:54 +02:00
Malte Hallström
48756e8774
feat(weather/smhi): calculate apparent temperature 2022-08-28 20:31:54 +02:00
Malte Hallström
4915ad8fc7
feat(weather/smhi): support hourly forecasts 2022-08-28 20:31:54 +02:00
veeck
2c0c62c89b Remove default weatherEndpoint 2022-08-17 09:18:35 +02:00
veeck
ec13c952d9 Use type value from config instead just only weatherEndpoint 2022-08-16 22:39:30 +02:00
Davide Cavalca
39c1b37726 Drop executable bit where not needed 2022-07-02 14:38:10 -07:00
eouia
1d90c5e1fe Add JSDoc description 2022-04-26 17:37:23 +02:00
eouia
0f39b7733c fix typo jsdom tag returns 2022-04-26 14:57:47 +02:00
eouia
038b6765e7 Change property name clearly 2022-04-26 14:52:05 +02:00
eouia
df0f048ecc Added outgoing notification 2022-04-26 13:55:39 +02:00
veeck
eca339ad60 Fix weird code in weathergov, still returns no data though 2022-03-22 21:11:44 +01:00
rejas
b72cb52a71 Remove windspeed conversion from openweathermap 2022-03-22 20:46:15 +01:00
Michael Teeuw
e12f57d872
Merge pull request #2815 from 10bias/weather-provider-weatherflow
Weather provider weatherflow
2022-03-11 15:43:22 +01:00
tobias
9056abaf4a add function to switch units 2022-02-26 11:09:41 +01:00
tobias
3c27fd10b6 fix a problem with sunrise 2022-02-25 18:30:01 +01:00
tobias
4048d79fc5 run lint:prettier 2022-02-22 11:14:28 +01:00
tobias
212e60c12d fix copy and paste mistake in comment 2022-02-22 11:12:17 +01:00
tobias
e791a663c8 add weatherprovider for weatherflow 2022-02-21 14:54:35 +01:00
philna
d0838d53c2 fix parsing of feels like for weathergov 2022-02-08 21:07:08 -06:00
Michael Teeuw
da90412cea
Merge pull request #2798 from khassel/cors 2022-01-28 11:22:43 +01:00
Kristjan SCHMIDT
6f27e5ae07 MagicMirror -> MagicMirror² 2022-01-26 23:47:51 +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
7cfc7b9d74 first cors approach 2022-01-25 00:43:57 +01:00
Christopher Fenner
9e4997aa81
Merge branch 'develop' into patch-1 2022-01-12 20:39:09 +01:00
Christopher Fenner
1619dd29e9
Apply suggestions from code review 2022-01-06 21:28:25 +01:00
Christopher Fenner
24bfaaca7e
use solid type for font awesome icons 2022-01-05 13:18:08 +01:00
Sean Scott
0f596d5620
Update weather.js
Set absoluteDates default to false
2022-01-02 14:45:24 -07:00
Sean Scott
a5668ef729
Update forecast.njk
Add an absolute date option to the weather module's forecast.
2022-01-02 11:35:29 -07:00
Karsten Hassel
0ec80a7791 move weather-test to e2e 2021-10-16 00:05:12 +02:00