23 Commits

Author SHA1 Message Date
Kristjan ESPERANTO
d276a7ddb9
Use template literals instead of string concatenation (#3066)
We have used it inconsistently till now. Template literals are more
modern and easier to maintain in my opinion.

Because that's a large amount of changes, here's a way to reproduce it:
I added the rule `"prefer-template": "error"` to the `.eslintrc.json`
and did an autofix. Since this caused a new problem in line 409 of
`newsfeed.js`, I reversed it in that line and also removed the rule from
the eslint config file.

The rule is described here:
https://eslint.org/docs/latest/rules/prefer-template

Note: I've played around with some other linter rules as well, and some
seem to point to some specific, non-cosmetic, issues. But before I dive
even deeper and then introduce even bigger and hardly understandable
changes at once, I thought I'd start with this simple cosmetic rule.
2023-03-19 14:32:23 +01:00
Magnus
bf279d9a57
Tidy up precipitation (#3023)
Fixes #2953

This is an attempt to fix the issue with precipitation amount and
percentage mixup. I have created a separate
`precipitationPercentage`-variable where the probability of rain can be
stored.

The config options now has the old `showPrecipitationAmount` in addition
to a new setting: `showPrecipitationProbability` (shows the likelihood
of rain).

<details>
  <summary>Examples</summary>
  
  ### Yr

I tested the Yr weather provider for a Norwegian city Bergen that has a
lot of rain. I have removed properties that are irrelevant for this demo
from the config-samples below.

Config:
  ```js
{
	module: "weather",
	config: {
			weatherProvider: "yr",
			type: "current",
			showPrecipitationAmount: true,
			showPrecipitationProbability: true
	}
},
{
	module: "weather",
	config: {
			weatherProvider: "yr",
			type: "hourly",
			showPrecipitationAmount: true,
			showPrecipitationProbability: true
	}
},
{
	module: "weather",
	config: {
			weatherProvider: "yr",
			type: "daily",
			showPrecipitationAmount: true,
			showPrecipitationProbability: true
	}
}
  ```

Result:<br/>
<img width="444" alt="screenshot"
src="https://user-images.githubusercontent.com/34011212/216775423-4e37345c-f915-47e5-8551-7c544ebd24b1.png">

</details>

---------

Co-authored-by: Magnus Marthinsen <magmar@online.no>
Co-authored-by: Veeck <github@veeck.de>
2023-02-04 19:02:55 +01:00
Magnus
2e2962d492
Fix yr weather direction (#3020)
Fixes so the Yr weather direction is not inverted. This error was
[reported in the
community](https://forum.magicmirror.builders/topic/17561/wind-direction-180-degrees-twisted-at-yr).

I misunderstood when developing the module because of the wind direction
arrow was pointing opposite to the arrow displayed on Yr.no. I renamed
the variable to help other developers in the future.

Co-authored-by: Magnus Marthinsen <magmar@online.no>
Co-authored-by: veeck <michael@veeck.de>
2023-01-21 22:40:08 +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
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
Davide Cavalca
39c1b37726 Drop executable bit where not needed 2022-07-02 14:38:10 -07:00
Kristjan SCHMIDT
a5668b1b99 Magic Mirror -> MagicMirror²
Consistent spelling
2022-01-26 23:09:26 +01:00
veeck
9ee11654a6 Update jsdocs 2021-09-02 20:35:43 +02:00
veeck
a273266e5e Remove useless returns and now unused jsdoc variables 2021-09-02 20:35:25 +02:00
rejas
8949aa3bec Add common method for updating suntimes 2021-08-31 21:41:27 +02:00
rejas
2ababa521d Use es6 notation in weather module and ukmet provider 2021-04-17 16:29:38 +02:00
buxxi
41508931be Moving default values regarding specific providers into the providers themselves 2021-01-23 11:21:56 +01:00
Aurélien Veillard
1460f002ab Add new parameter "useKmh" to weather module
Add new parameter "useKmh" to weather module for displaying wind speed as km/h instead of m/s when windUnits is set to metric.
2020-11-08 14:01:02 +01:00
Aurélien Veillard
0d6f736c2c Fix windspeed convertion error in ukmetoffice weather provider
Fix windspeed convertion error from mph to m/s in ukmetoffice weather provider (#2189)
2020-11-08 12:37:21 +01:00
Veeck
abb5dc5739 Run prettier over ALL files once
No other changes done in this commit
2020-05-11 22:22:32 +02:00
Veeck
7fc7d626bc Add Module to globals, cleanup comments 2020-05-05 14:55:15 +02:00
Veeck
c8a0f1d0de Fix some more undefs that popped up out of nowhere 2020-05-05 14:54:49 +02:00
Veeck
ec187fe109 Update changelog and commen tags 2020-04-21 12:23:50 +02:00
Veeck
9ec329b7ae Final fixes for eslint:recommended 2020-04-21 12:23:50 +02:00
Veeck
fb557b9130 Update ignored files for eslint 2020-04-20 11:15:11 +02:00
vincep5
819c4cde1c Fix for weather module not refreshing data after exception 2019-07-11 12:49:24 -05:00
Malcolm Oakes
a619fc4fef Allow temp and wind units to be specified separately if required. 2019-06-07 15:27:08 +01:00
Malcolm Oakes
c80e04fe8d Add new weather data provider UK Met Office (Datapoint) 2019-04-03 15:19:32 +01:00