mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Fix == usages
This commit is contained in:
parent
a1e3fed312
commit
bcc0cc599d
@ -60,7 +60,7 @@ WeatherProvider.register("smhi", {
|
|||||||
*/
|
*/
|
||||||
setConfig(config) {
|
setConfig(config) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
if (!config.precipitationValue || ["pmin", "pmean", "pmedian", "pmax"].indexOf(config.precipitationValue) == -1) {
|
if (!config.precipitationValue || ["pmin", "pmean", "pmedian", "pmax"].indexOf(config.precipitationValue) === -1) {
|
||||||
console.log("invalid or not set: " + config.precipitationValue);
|
console.log("invalid or not set: " + config.precipitationValue);
|
||||||
config.precipitationValue = this.defaults.precipitationValue;
|
config.precipitationValue = this.defaults.precipitationValue;
|
||||||
}
|
}
|
||||||
@ -240,7 +240,7 @@ WeatherProvider.register("smhi", {
|
|||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
paramValue(currentWeatherData, name) {
|
paramValue(currentWeatherData, name) {
|
||||||
return currentWeatherData.parameters.filter((p) => p.name == name).flatMap((p) => p.values)[0];
|
return currentWeatherData.parameters.filter((p) => p.name === name).flatMap((p) => p.values)[0];
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,7 +91,7 @@ WeatherProvider.register("ukmetofficedatahub", {
|
|||||||
this.fetchWeather(this.getUrl("hourly"), this.getHeaders())
|
this.fetchWeather(this.getUrl("hourly"), this.getHeaders())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
// Check data is useable
|
// Check data is useable
|
||||||
if (!data || !data.features || !data.features[0].properties || !data.features[0].properties.timeSeries || data.features[0].properties.timeSeries.length == 0) {
|
if (!data || !data.features || !data.features[0].properties || !data.features[0].properties.timeSeries || data.features[0].properties.timeSeries.length === 0) {
|
||||||
// Did not receive usable new data.
|
// Did not receive usable new data.
|
||||||
// Maybe this needs a better check?
|
// Maybe this needs a better check?
|
||||||
Log.error("Possibly bad current/hourly data?");
|
Log.error("Possibly bad current/hourly data?");
|
||||||
@ -162,7 +162,7 @@ WeatherProvider.register("ukmetofficedatahub", {
|
|||||||
this.fetchWeather(this.getUrl("daily"), this.getHeaders())
|
this.fetchWeather(this.getUrl("daily"), this.getHeaders())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
// Check data is useable
|
// Check data is useable
|
||||||
if (!data || !data.features || !data.features[0].properties || !data.features[0].properties.timeSeries || data.features[0].properties.timeSeries.length == 0) {
|
if (!data || !data.features || !data.features[0].properties || !data.features[0].properties.timeSeries || data.features[0].properties.timeSeries.length === 0) {
|
||||||
// Did not receive usable new data.
|
// Did not receive usable new data.
|
||||||
// Maybe this needs a better check?
|
// Maybe this needs a better check?
|
||||||
Log.error("Possibly bad forecast data?");
|
Log.error("Possibly bad forecast data?");
|
||||||
@ -258,11 +258,11 @@ WeatherProvider.register("ukmetofficedatahub", {
|
|||||||
// To use kilometres per hour, use "kph"
|
// To use kilometres per hour, use "kph"
|
||||||
// Else assumed imperial and the value is returned in miles per hour (a Met Office user is likely to be UK-based)
|
// Else assumed imperial and the value is returned in miles per hour (a Met Office user is likely to be UK-based)
|
||||||
convertWindSpeed(windInMpS) {
|
convertWindSpeed(windInMpS) {
|
||||||
if (this.config.windUnits == "mps") {
|
if (this.config.windUnits === "mps") {
|
||||||
return windInMpS;
|
return windInMpS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.config.windUnits == "kph" || this.config.windUnits == "metric" || this.config.useKmh) {
|
if (this.config.windUnits === "kph" || this.config.windUnits === "metric" || this.config.useKmh) {
|
||||||
return windInMpS * 3.6;
|
return windInMpS * 3.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user