Release 2.22.0 (#2983)
## [2.22.0] - 2023-01-01
Thanks to: @angeldeejay, @buxxi, @dariom, @dWoolridge,
@KristjanESPERANTO, @MagMar94, @naveensrinivasan, @retroflex, @SkySails
and @Tom.
Special thanks to @khassel, @rejas and @sdetweil for taking over most
(if not all) of the work on this release as project collaborators. This
version would not be there without their effort. Thank you!
### Added
- Added test for remoteFile option in compliments module
- Added hourlyWeather functionality to Weather.gov weather provider
- Removed weatherEndpoint definition from weathergov.js (not used)
- Added css class names "today" and "tomorrow" for default calendar
- Added Collaboration.md
- Added new github action for dependency review (#2862)
- Added a WeatherProvider for Open-Meteo
- Added Yr as a weather provider
- Added config options "ignoreXOriginHeader" and
"ignoreContentSecurityPolicy"
### Removed
- Removed usage of internal fetch function of node until it is more
stable
### Updated
- Cleaned up test directory (#2937) and jest config (#2959)
- Wait for all modules to start before declaring the system ready
(#2487)
- Updated e2e tests (moved `done()` in helper functions) and use es6
syntax in all tests
- Updated da translation
- Rework weather module
- Make sure smhi provider api only gets a maximum of 6 digits
coordinates (#2955)
- Use fetch instead of XMLHttpRequest in weatherprovider (#2935)
- Reworked how weatherproviders handle units (#2849)
- Use unix() method for parsing times, fix suntimes on the way (#2950)
- Refactor conversion functions into utils class (#2958)
- The `cors`-method in `server.js` now supports sending and recieving
HTTP headers
- Replace `…` by `…`
- Cleanup compliments module
- Updated dependencies including electron to v22 (#2903)
### Fixed
- Correctly show apparent temperature in SMHI weather provider
- Ensure updatenotification module isn't shown when local is _ahead_ of
remote
- Handle node_helper errors during startup (#2944)
- Possibility to change FontAwesome class in calendar, so icons like
`fab fa-facebook-square` works.
- Fix cors problems with newsfeed articles (as far as possible), allow
disabling cors per feed with option `useCorsProxy: false` (#2840)
- Tests not waiting for the application to start and stop before
starting the next test
- Fix electron tests failing sometimes in github workflow
- Fixed gap in clock module when displayed on the left side with
displayType=digital
- Fixed playwright issue by upgrading to v1.29.1 (#2969)
Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
Co-authored-by: Karsten Hassel <hassel@gmx.de>
Co-authored-by: Malte Hallström <46646495+SkySails@users.noreply.github.com>
Co-authored-by: Veeck <github@veeck.de>
Co-authored-by: veeck <michael@veeck.de>
Co-authored-by: dWoolridge <dwoolridge@charter.net>
Co-authored-by: Johan <jojjepersson@yahoo.se>
Co-authored-by: Dario Mratovich <dario_mratovich@hotmail.com>
Co-authored-by: Dario Mratovich <dario.mratovich@outlook.com>
Co-authored-by: Magnus <34011212+MagMar94@users.noreply.github.com>
Co-authored-by: Naveen <172697+naveensrinivasan@users.noreply.github.com>
Co-authored-by: buxxi <buxxi@omfilm.net>
Co-authored-by: Thomas Hirschberger <47733292+Tom-Hirschberger@users.noreply.github.com>
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
Co-authored-by: Andrés Vanegas Jiménez <142350+angeldeejay@users.noreply.github.com>
2023-01-01 18:09:08 +01:00
|
|
|
/* global SunCalc, WeatherUtils */
|
2021-08-31 21:41:27 +02:00
|
|
|
|
2022-01-26 23:09:26 +01:00
|
|
|
/* MagicMirror²
|
2017-09-22 12:26:47 +02:00
|
|
|
* Module: Weather
|
|
|
|
*
|
2020-04-28 23:05:28 +02:00
|
|
|
* By Michael Teeuw https://michaelteeuw.nl
|
2017-09-22 12:26:47 +02:00
|
|
|
* MIT Licensed.
|
2017-10-18 13:38:56 +02:00
|
|
|
*
|
2017-09-22 12:26:47 +02:00
|
|
|
* This class is the blueprint for a day which includes weather information.
|
2020-04-21 10:41:21 +02:00
|
|
|
*
|
|
|
|
* Currently this is focused on the information which is necessary for the current weather.
|
|
|
|
* As soon as we start implementing the forecast, mode properties will be added.
|
2017-09-22 12:26:47 +02:00
|
|
|
*/
|
|
|
|
class WeatherObject {
|
2021-08-31 23:26:06 +02:00
|
|
|
/**
|
2021-09-02 20:35:43 +02:00
|
|
|
* Constructor for a WeatherObject
|
2021-08-31 23:26:06 +02:00
|
|
|
*/
|
Release 2.22.0 (#2983)
## [2.22.0] - 2023-01-01
Thanks to: @angeldeejay, @buxxi, @dariom, @dWoolridge,
@KristjanESPERANTO, @MagMar94, @naveensrinivasan, @retroflex, @SkySails
and @Tom.
Special thanks to @khassel, @rejas and @sdetweil for taking over most
(if not all) of the work on this release as project collaborators. This
version would not be there without their effort. Thank you!
### Added
- Added test for remoteFile option in compliments module
- Added hourlyWeather functionality to Weather.gov weather provider
- Removed weatherEndpoint definition from weathergov.js (not used)
- Added css class names "today" and "tomorrow" for default calendar
- Added Collaboration.md
- Added new github action for dependency review (#2862)
- Added a WeatherProvider for Open-Meteo
- Added Yr as a weather provider
- Added config options "ignoreXOriginHeader" and
"ignoreContentSecurityPolicy"
### Removed
- Removed usage of internal fetch function of node until it is more
stable
### Updated
- Cleaned up test directory (#2937) and jest config (#2959)
- Wait for all modules to start before declaring the system ready
(#2487)
- Updated e2e tests (moved `done()` in helper functions) and use es6
syntax in all tests
- Updated da translation
- Rework weather module
- Make sure smhi provider api only gets a maximum of 6 digits
coordinates (#2955)
- Use fetch instead of XMLHttpRequest in weatherprovider (#2935)
- Reworked how weatherproviders handle units (#2849)
- Use unix() method for parsing times, fix suntimes on the way (#2950)
- Refactor conversion functions into utils class (#2958)
- The `cors`-method in `server.js` now supports sending and recieving
HTTP headers
- Replace `…` by `…`
- Cleanup compliments module
- Updated dependencies including electron to v22 (#2903)
### Fixed
- Correctly show apparent temperature in SMHI weather provider
- Ensure updatenotification module isn't shown when local is _ahead_ of
remote
- Handle node_helper errors during startup (#2944)
- Possibility to change FontAwesome class in calendar, so icons like
`fab fa-facebook-square` works.
- Fix cors problems with newsfeed articles (as far as possible), allow
disabling cors per feed with option `useCorsProxy: false` (#2840)
- Tests not waiting for the application to start and stop before
starting the next test
- Fix electron tests failing sometimes in github workflow
- Fixed gap in clock module when displayed on the left side with
displayType=digital
- Fixed playwright issue by upgrading to v1.29.1 (#2969)
Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
Co-authored-by: Karsten Hassel <hassel@gmx.de>
Co-authored-by: Malte Hallström <46646495+SkySails@users.noreply.github.com>
Co-authored-by: Veeck <github@veeck.de>
Co-authored-by: veeck <michael@veeck.de>
Co-authored-by: dWoolridge <dwoolridge@charter.net>
Co-authored-by: Johan <jojjepersson@yahoo.se>
Co-authored-by: Dario Mratovich <dario_mratovich@hotmail.com>
Co-authored-by: Dario Mratovich <dario.mratovich@outlook.com>
Co-authored-by: Magnus <34011212+MagMar94@users.noreply.github.com>
Co-authored-by: Naveen <172697+naveensrinivasan@users.noreply.github.com>
Co-authored-by: buxxi <buxxi@omfilm.net>
Co-authored-by: Thomas Hirschberger <47733292+Tom-Hirschberger@users.noreply.github.com>
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
Co-authored-by: Andrés Vanegas Jiménez <142350+angeldeejay@users.noreply.github.com>
2023-01-01 18:09:08 +01:00
|
|
|
constructor() {
|
2018-12-27 19:37:02 +01:00
|
|
|
this.date = null;
|
|
|
|
this.windSpeed = null;
|
|
|
|
this.windDirection = null;
|
|
|
|
this.sunrise = null;
|
|
|
|
this.sunset = null;
|
|
|
|
this.temperature = null;
|
|
|
|
this.minTemperature = null;
|
|
|
|
this.maxTemperature = null;
|
|
|
|
this.weatherType = null;
|
|
|
|
this.humidity = null;
|
2018-12-30 20:46:25 +01:00
|
|
|
this.rain = null;
|
2019-02-14 13:00:40 -06:00
|
|
|
this.snow = null;
|
|
|
|
this.precipitation = null;
|
2021-05-13 10:56:30 -04:00
|
|
|
this.precipitationUnits = null;
|
2019-04-03 15:19:32 +01:00
|
|
|
this.feelsLikeTemp = null;
|
2017-09-22 12:26:47 +02:00
|
|
|
}
|
|
|
|
|
2018-12-30 14:14:17 +01:00
|
|
|
cardinalWindDirection() {
|
2020-05-11 22:22:32 +02:00
|
|
|
if (this.windDirection > 11.25 && this.windDirection <= 33.75) {
|
2017-09-22 12:26:47 +02:00
|
|
|
return "NNE";
|
|
|
|
} else if (this.windDirection > 33.75 && this.windDirection <= 56.25) {
|
|
|
|
return "NE";
|
|
|
|
} else if (this.windDirection > 56.25 && this.windDirection <= 78.75) {
|
|
|
|
return "ENE";
|
|
|
|
} else if (this.windDirection > 78.75 && this.windDirection <= 101.25) {
|
|
|
|
return "E";
|
|
|
|
} else if (this.windDirection > 101.25 && this.windDirection <= 123.75) {
|
|
|
|
return "ESE";
|
|
|
|
} else if (this.windDirection > 123.75 && this.windDirection <= 146.25) {
|
|
|
|
return "SE";
|
|
|
|
} else if (this.windDirection > 146.25 && this.windDirection <= 168.75) {
|
|
|
|
return "SSE";
|
|
|
|
} else if (this.windDirection > 168.75 && this.windDirection <= 191.25) {
|
|
|
|
return "S";
|
|
|
|
} else if (this.windDirection > 191.25 && this.windDirection <= 213.75) {
|
|
|
|
return "SSW";
|
|
|
|
} else if (this.windDirection > 213.75 && this.windDirection <= 236.25) {
|
|
|
|
return "SW";
|
|
|
|
} else if (this.windDirection > 236.25 && this.windDirection <= 258.75) {
|
|
|
|
return "WSW";
|
|
|
|
} else if (this.windDirection > 258.75 && this.windDirection <= 281.25) {
|
|
|
|
return "W";
|
|
|
|
} else if (this.windDirection > 281.25 && this.windDirection <= 303.75) {
|
|
|
|
return "WNW";
|
|
|
|
} else if (this.windDirection > 303.75 && this.windDirection <= 326.25) {
|
|
|
|
return "NW";
|
|
|
|
} else if (this.windDirection > 326.25 && this.windDirection <= 348.75) {
|
|
|
|
return "NNW";
|
|
|
|
} else {
|
|
|
|
return "N";
|
|
|
|
}
|
|
|
|
}
|
2017-10-18 13:38:56 +02:00
|
|
|
|
2018-12-30 14:14:17 +01:00
|
|
|
nextSunAction() {
|
|
|
|
return moment().isBetween(this.sunrise, this.sunset) ? "sunset" : "sunrise";
|
2017-10-18 13:38:56 +02:00
|
|
|
}
|
2018-12-30 14:17:13 +01:00
|
|
|
|
|
|
|
feelsLike() {
|
2020-04-20 22:16:23 +02:00
|
|
|
if (this.feelsLikeTemp) {
|
|
|
|
return this.feelsLikeTemp;
|
2019-04-03 15:19:32 +01:00
|
|
|
}
|
Release 2.22.0 (#2983)
## [2.22.0] - 2023-01-01
Thanks to: @angeldeejay, @buxxi, @dariom, @dWoolridge,
@KristjanESPERANTO, @MagMar94, @naveensrinivasan, @retroflex, @SkySails
and @Tom.
Special thanks to @khassel, @rejas and @sdetweil for taking over most
(if not all) of the work on this release as project collaborators. This
version would not be there without their effort. Thank you!
### Added
- Added test for remoteFile option in compliments module
- Added hourlyWeather functionality to Weather.gov weather provider
- Removed weatherEndpoint definition from weathergov.js (not used)
- Added css class names "today" and "tomorrow" for default calendar
- Added Collaboration.md
- Added new github action for dependency review (#2862)
- Added a WeatherProvider for Open-Meteo
- Added Yr as a weather provider
- Added config options "ignoreXOriginHeader" and
"ignoreContentSecurityPolicy"
### Removed
- Removed usage of internal fetch function of node until it is more
stable
### Updated
- Cleaned up test directory (#2937) and jest config (#2959)
- Wait for all modules to start before declaring the system ready
(#2487)
- Updated e2e tests (moved `done()` in helper functions) and use es6
syntax in all tests
- Updated da translation
- Rework weather module
- Make sure smhi provider api only gets a maximum of 6 digits
coordinates (#2955)
- Use fetch instead of XMLHttpRequest in weatherprovider (#2935)
- Reworked how weatherproviders handle units (#2849)
- Use unix() method for parsing times, fix suntimes on the way (#2950)
- Refactor conversion functions into utils class (#2958)
- The `cors`-method in `server.js` now supports sending and recieving
HTTP headers
- Replace `…` by `…`
- Cleanup compliments module
- Updated dependencies including electron to v22 (#2903)
### Fixed
- Correctly show apparent temperature in SMHI weather provider
- Ensure updatenotification module isn't shown when local is _ahead_ of
remote
- Handle node_helper errors during startup (#2944)
- Possibility to change FontAwesome class in calendar, so icons like
`fab fa-facebook-square` works.
- Fix cors problems with newsfeed articles (as far as possible), allow
disabling cors per feed with option `useCorsProxy: false` (#2840)
- Tests not waiting for the application to start and stop before
starting the next test
- Fix electron tests failing sometimes in github workflow
- Fixed gap in clock module when displayed on the left side with
displayType=digital
- Fixed playwright issue by upgrading to v1.29.1 (#2969)
Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
Co-authored-by: Karsten Hassel <hassel@gmx.de>
Co-authored-by: Malte Hallström <46646495+SkySails@users.noreply.github.com>
Co-authored-by: Veeck <github@veeck.de>
Co-authored-by: veeck <michael@veeck.de>
Co-authored-by: dWoolridge <dwoolridge@charter.net>
Co-authored-by: Johan <jojjepersson@yahoo.se>
Co-authored-by: Dario Mratovich <dario_mratovich@hotmail.com>
Co-authored-by: Dario Mratovich <dario.mratovich@outlook.com>
Co-authored-by: Magnus <34011212+MagMar94@users.noreply.github.com>
Co-authored-by: Naveen <172697+naveensrinivasan@users.noreply.github.com>
Co-authored-by: buxxi <buxxi@omfilm.net>
Co-authored-by: Thomas Hirschberger <47733292+Tom-Hirschberger@users.noreply.github.com>
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
Co-authored-by: Andrés Vanegas Jiménez <142350+angeldeejay@users.noreply.github.com>
2023-01-01 18:09:08 +01:00
|
|
|
const windInMph = WeatherUtils.convertWind(this.windSpeed, "imperial");
|
|
|
|
const tempInF = WeatherUtils.convertTemp(this.temperature, "imperial");
|
2018-12-30 14:17:13 +01:00
|
|
|
let feelsLike = tempInF;
|
|
|
|
|
|
|
|
if (windInMph > 3 && tempInF < 50) {
|
|
|
|
feelsLike = Math.round(35.74 + 0.6215 * tempInF - 35.75 * Math.pow(windInMph, 0.16) + 0.4275 * tempInF * Math.pow(windInMph, 0.16));
|
|
|
|
} else if (tempInF > 80 && this.humidity > 40) {
|
2020-05-11 22:22:32 +02:00
|
|
|
feelsLike =
|
|
|
|
-42.379 +
|
|
|
|
2.04901523 * tempInF +
|
|
|
|
10.14333127 * this.humidity -
|
|
|
|
0.22475541 * tempInF * this.humidity -
|
|
|
|
6.83783 * Math.pow(10, -3) * tempInF * tempInF -
|
|
|
|
5.481717 * Math.pow(10, -2) * this.humidity * this.humidity +
|
|
|
|
1.22874 * Math.pow(10, -3) * tempInF * tempInF * this.humidity +
|
|
|
|
8.5282 * Math.pow(10, -4) * tempInF * this.humidity * this.humidity -
|
|
|
|
1.99 * Math.pow(10, -6) * tempInF * tempInF * this.humidity * this.humidity;
|
2018-12-30 14:17:13 +01:00
|
|
|
}
|
|
|
|
|
Release 2.22.0 (#2983)
## [2.22.0] - 2023-01-01
Thanks to: @angeldeejay, @buxxi, @dariom, @dWoolridge,
@KristjanESPERANTO, @MagMar94, @naveensrinivasan, @retroflex, @SkySails
and @Tom.
Special thanks to @khassel, @rejas and @sdetweil for taking over most
(if not all) of the work on this release as project collaborators. This
version would not be there without their effort. Thank you!
### Added
- Added test for remoteFile option in compliments module
- Added hourlyWeather functionality to Weather.gov weather provider
- Removed weatherEndpoint definition from weathergov.js (not used)
- Added css class names "today" and "tomorrow" for default calendar
- Added Collaboration.md
- Added new github action for dependency review (#2862)
- Added a WeatherProvider for Open-Meteo
- Added Yr as a weather provider
- Added config options "ignoreXOriginHeader" and
"ignoreContentSecurityPolicy"
### Removed
- Removed usage of internal fetch function of node until it is more
stable
### Updated
- Cleaned up test directory (#2937) and jest config (#2959)
- Wait for all modules to start before declaring the system ready
(#2487)
- Updated e2e tests (moved `done()` in helper functions) and use es6
syntax in all tests
- Updated da translation
- Rework weather module
- Make sure smhi provider api only gets a maximum of 6 digits
coordinates (#2955)
- Use fetch instead of XMLHttpRequest in weatherprovider (#2935)
- Reworked how weatherproviders handle units (#2849)
- Use unix() method for parsing times, fix suntimes on the way (#2950)
- Refactor conversion functions into utils class (#2958)
- The `cors`-method in `server.js` now supports sending and recieving
HTTP headers
- Replace `…` by `…`
- Cleanup compliments module
- Updated dependencies including electron to v22 (#2903)
### Fixed
- Correctly show apparent temperature in SMHI weather provider
- Ensure updatenotification module isn't shown when local is _ahead_ of
remote
- Handle node_helper errors during startup (#2944)
- Possibility to change FontAwesome class in calendar, so icons like
`fab fa-facebook-square` works.
- Fix cors problems with newsfeed articles (as far as possible), allow
disabling cors per feed with option `useCorsProxy: false` (#2840)
- Tests not waiting for the application to start and stop before
starting the next test
- Fix electron tests failing sometimes in github workflow
- Fixed gap in clock module when displayed on the left side with
displayType=digital
- Fixed playwright issue by upgrading to v1.29.1 (#2969)
Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
Co-authored-by: Karsten Hassel <hassel@gmx.de>
Co-authored-by: Malte Hallström <46646495+SkySails@users.noreply.github.com>
Co-authored-by: Veeck <github@veeck.de>
Co-authored-by: veeck <michael@veeck.de>
Co-authored-by: dWoolridge <dwoolridge@charter.net>
Co-authored-by: Johan <jojjepersson@yahoo.se>
Co-authored-by: Dario Mratovich <dario_mratovich@hotmail.com>
Co-authored-by: Dario Mratovich <dario.mratovich@outlook.com>
Co-authored-by: Magnus <34011212+MagMar94@users.noreply.github.com>
Co-authored-by: Naveen <172697+naveensrinivasan@users.noreply.github.com>
Co-authored-by: buxxi <buxxi@omfilm.net>
Co-authored-by: Thomas Hirschberger <47733292+Tom-Hirschberger@users.noreply.github.com>
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
Co-authored-by: Andrés Vanegas Jiménez <142350+angeldeejay@users.noreply.github.com>
2023-01-01 18:09:08 +01:00
|
|
|
return ((feelsLike - 32) * 5) / 9;
|
2018-12-30 14:17:13 +01:00
|
|
|
}
|
2021-08-31 21:41:27 +02:00
|
|
|
|
2021-08-31 21:55:43 +02:00
|
|
|
/**
|
|
|
|
* Checks if the weatherObject is at dayTime.
|
|
|
|
*
|
2022-04-26 14:57:47 +02:00
|
|
|
* @returns {boolean} true if it is at dayTime
|
2021-08-31 21:55:43 +02:00
|
|
|
*/
|
|
|
|
isDayTime() {
|
|
|
|
return this.date.isBetween(this.sunrise, this.sunset, undefined, "[]");
|
|
|
|
}
|
|
|
|
|
2021-08-31 21:41:27 +02:00
|
|
|
/**
|
2021-09-04 12:25:43 +02:00
|
|
|
* Update the sunrise / sunset time depending on the location. This can be
|
Release 2.22.0 (#2983)
## [2.22.0] - 2023-01-01
Thanks to: @angeldeejay, @buxxi, @dariom, @dWoolridge,
@KristjanESPERANTO, @MagMar94, @naveensrinivasan, @retroflex, @SkySails
and @Tom.
Special thanks to @khassel, @rejas and @sdetweil for taking over most
(if not all) of the work on this release as project collaborators. This
version would not be there without their effort. Thank you!
### Added
- Added test for remoteFile option in compliments module
- Added hourlyWeather functionality to Weather.gov weather provider
- Removed weatherEndpoint definition from weathergov.js (not used)
- Added css class names "today" and "tomorrow" for default calendar
- Added Collaboration.md
- Added new github action for dependency review (#2862)
- Added a WeatherProvider for Open-Meteo
- Added Yr as a weather provider
- Added config options "ignoreXOriginHeader" and
"ignoreContentSecurityPolicy"
### Removed
- Removed usage of internal fetch function of node until it is more
stable
### Updated
- Cleaned up test directory (#2937) and jest config (#2959)
- Wait for all modules to start before declaring the system ready
(#2487)
- Updated e2e tests (moved `done()` in helper functions) and use es6
syntax in all tests
- Updated da translation
- Rework weather module
- Make sure smhi provider api only gets a maximum of 6 digits
coordinates (#2955)
- Use fetch instead of XMLHttpRequest in weatherprovider (#2935)
- Reworked how weatherproviders handle units (#2849)
- Use unix() method for parsing times, fix suntimes on the way (#2950)
- Refactor conversion functions into utils class (#2958)
- The `cors`-method in `server.js` now supports sending and recieving
HTTP headers
- Replace `…` by `…`
- Cleanup compliments module
- Updated dependencies including electron to v22 (#2903)
### Fixed
- Correctly show apparent temperature in SMHI weather provider
- Ensure updatenotification module isn't shown when local is _ahead_ of
remote
- Handle node_helper errors during startup (#2944)
- Possibility to change FontAwesome class in calendar, so icons like
`fab fa-facebook-square` works.
- Fix cors problems with newsfeed articles (as far as possible), allow
disabling cors per feed with option `useCorsProxy: false` (#2840)
- Tests not waiting for the application to start and stop before
starting the next test
- Fix electron tests failing sometimes in github workflow
- Fixed gap in clock module when displayed on the left side with
displayType=digital
- Fixed playwright issue by upgrading to v1.29.1 (#2969)
Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
Co-authored-by: Karsten Hassel <hassel@gmx.de>
Co-authored-by: Malte Hallström <46646495+SkySails@users.noreply.github.com>
Co-authored-by: Veeck <github@veeck.de>
Co-authored-by: veeck <michael@veeck.de>
Co-authored-by: dWoolridge <dwoolridge@charter.net>
Co-authored-by: Johan <jojjepersson@yahoo.se>
Co-authored-by: Dario Mratovich <dario_mratovich@hotmail.com>
Co-authored-by: Dario Mratovich <dario.mratovich@outlook.com>
Co-authored-by: Magnus <34011212+MagMar94@users.noreply.github.com>
Co-authored-by: Naveen <172697+naveensrinivasan@users.noreply.github.com>
Co-authored-by: buxxi <buxxi@omfilm.net>
Co-authored-by: Thomas Hirschberger <47733292+Tom-Hirschberger@users.noreply.github.com>
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
Co-authored-by: Andrés Vanegas Jiménez <142350+angeldeejay@users.noreply.github.com>
2023-01-01 18:09:08 +01:00
|
|
|
* used if your provider doesn't provide that data by itself. Then SunCalc
|
2021-09-04 12:25:43 +02:00
|
|
|
* is used here to calculate them according to the location.
|
2021-08-31 21:41:27 +02:00
|
|
|
*
|
|
|
|
* @param {number} lat latitude
|
|
|
|
* @param {number} lon longitude
|
|
|
|
*/
|
|
|
|
updateSunTime(lat, lon) {
|
Release 2.22.0 (#2983)
## [2.22.0] - 2023-01-01
Thanks to: @angeldeejay, @buxxi, @dariom, @dWoolridge,
@KristjanESPERANTO, @MagMar94, @naveensrinivasan, @retroflex, @SkySails
and @Tom.
Special thanks to @khassel, @rejas and @sdetweil for taking over most
(if not all) of the work on this release as project collaborators. This
version would not be there without their effort. Thank you!
### Added
- Added test for remoteFile option in compliments module
- Added hourlyWeather functionality to Weather.gov weather provider
- Removed weatherEndpoint definition from weathergov.js (not used)
- Added css class names "today" and "tomorrow" for default calendar
- Added Collaboration.md
- Added new github action for dependency review (#2862)
- Added a WeatherProvider for Open-Meteo
- Added Yr as a weather provider
- Added config options "ignoreXOriginHeader" and
"ignoreContentSecurityPolicy"
### Removed
- Removed usage of internal fetch function of node until it is more
stable
### Updated
- Cleaned up test directory (#2937) and jest config (#2959)
- Wait for all modules to start before declaring the system ready
(#2487)
- Updated e2e tests (moved `done()` in helper functions) and use es6
syntax in all tests
- Updated da translation
- Rework weather module
- Make sure smhi provider api only gets a maximum of 6 digits
coordinates (#2955)
- Use fetch instead of XMLHttpRequest in weatherprovider (#2935)
- Reworked how weatherproviders handle units (#2849)
- Use unix() method for parsing times, fix suntimes on the way (#2950)
- Refactor conversion functions into utils class (#2958)
- The `cors`-method in `server.js` now supports sending and recieving
HTTP headers
- Replace `…` by `…`
- Cleanup compliments module
- Updated dependencies including electron to v22 (#2903)
### Fixed
- Correctly show apparent temperature in SMHI weather provider
- Ensure updatenotification module isn't shown when local is _ahead_ of
remote
- Handle node_helper errors during startup (#2944)
- Possibility to change FontAwesome class in calendar, so icons like
`fab fa-facebook-square` works.
- Fix cors problems with newsfeed articles (as far as possible), allow
disabling cors per feed with option `useCorsProxy: false` (#2840)
- Tests not waiting for the application to start and stop before
starting the next test
- Fix electron tests failing sometimes in github workflow
- Fixed gap in clock module when displayed on the left side with
displayType=digital
- Fixed playwright issue by upgrading to v1.29.1 (#2969)
Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
Co-authored-by: Karsten Hassel <hassel@gmx.de>
Co-authored-by: Malte Hallström <46646495+SkySails@users.noreply.github.com>
Co-authored-by: Veeck <github@veeck.de>
Co-authored-by: veeck <michael@veeck.de>
Co-authored-by: dWoolridge <dwoolridge@charter.net>
Co-authored-by: Johan <jojjepersson@yahoo.se>
Co-authored-by: Dario Mratovich <dario_mratovich@hotmail.com>
Co-authored-by: Dario Mratovich <dario.mratovich@outlook.com>
Co-authored-by: Magnus <34011212+MagMar94@users.noreply.github.com>
Co-authored-by: Naveen <172697+naveensrinivasan@users.noreply.github.com>
Co-authored-by: buxxi <buxxi@omfilm.net>
Co-authored-by: Thomas Hirschberger <47733292+Tom-Hirschberger@users.noreply.github.com>
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
Co-authored-by: Andrés Vanegas Jiménez <142350+angeldeejay@users.noreply.github.com>
2023-01-01 18:09:08 +01:00
|
|
|
const now = !this.date ? new Date() : this.date.toDate();
|
|
|
|
const times = SunCalc.getTimes(now, lat, lon);
|
|
|
|
this.sunrise = moment(times.sunrise);
|
|
|
|
this.sunset = moment(times.sunset);
|
2021-08-31 21:41:27 +02:00
|
|
|
}
|
2022-04-26 13:55:39 +02:00
|
|
|
|
|
|
|
/**
|
2022-04-26 17:37:23 +02:00
|
|
|
* Clone to simple object to prevent mutating and deprecation of legacy library.
|
2022-04-26 13:55:39 +02:00
|
|
|
*
|
2022-04-26 17:37:23 +02:00
|
|
|
* Before being handed to other modules, mutable values must be cloned safely.
|
|
|
|
* Especially 'moment' object is not immutable, so original 'date', 'sunrise', 'sunset' could be corrupted or changed by other modules.
|
|
|
|
*
|
|
|
|
* @returns {object} plained object clone of original weatherObject
|
2022-04-26 13:55:39 +02:00
|
|
|
*/
|
|
|
|
simpleClone() {
|
|
|
|
const toFlat = ["date", "sunrise", "sunset"];
|
|
|
|
let clone = { ...this };
|
|
|
|
for (const prop of toFlat) {
|
|
|
|
clone[prop] = clone?.[prop]?.valueOf() ?? clone?.[prop];
|
|
|
|
}
|
|
|
|
return clone;
|
|
|
|
}
|
2018-12-27 19:37:02 +01:00
|
|
|
}
|
2021-08-31 23:26:06 +02:00
|
|
|
|
|
|
|
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
|
|
|
if (typeof module !== "undefined") {
|
|
|
|
module.exports = WeatherObject;
|
|
|
|
}
|