Cleanup some docs in the weather modules

This commit is contained in:
rejas 2021-09-04 12:25:43 +02:00
parent 06389e35f9
commit 221b6325f6
6 changed files with 44 additions and 40 deletions

View File

@ -8,7 +8,8 @@
* MIT Licensed
*
* This class is a provider for Dark Sky.
* Note that the Dark Sky API does not provide rainfall. Instead it provides snowfall and precipitation probability
* Note that the Dark Sky API does not provide rainfall. Instead it provides
* snowfall and precipitation probability
*/
WeatherProvider.register("darksky", {
// Set the name of the provider.
@ -98,7 +99,8 @@ WeatherProvider.register("darksky", {
weather.snow = 0;
// The API will return centimeters if units is 'si' and will return inches for 'us'
// Note that the Dark Sky API does not provide rainfall. Instead it provides snowfall and precipitation probability
// Note that the Dark Sky API does not provide rainfall.
// Instead it provides snowfall and precipitation probability
if (forecast.hasOwnProperty("precipAccumulation")) {
if (this.config.units === "imperial" && !isNaN(forecast.precipAccumulation)) {
weather.snow = forecast.precipAccumulation;

View File

@ -18,10 +18,10 @@ WeatherProvider.register("openweathermap", {
defaults: {
apiVersion: "2.5",
apiBase: "https://api.openweathermap.org/data/",
weatherEndpoint: "",
weatherEndpoint: "", // can be "onecall", "forecast" or "weather" (for current)
locationID: false,
location: false,
lat: 0,
lat: 0, // the onecall endpoint needs lat / lon values, it doesn'T support the locationId
lon: 0,
apiKey: ""
},

View File

@ -7,9 +7,8 @@
* By BuXXi https://github.com/buxxi
* MIT Licensed
*
* This class is a provider for SMHI (Sweden only).
* Note that SMHI doesn't provide sunrise and sundown, use SunCalc to calculate it.
* Metric system is the only supported unit.
* This class is a provider for SMHI (Sweden only). Metric system is the only
* supported unit.
*/
WeatherProvider.register("smhi", {
providerName: "SMHI",
@ -193,7 +192,8 @@ WeatherProvider.register("smhi", {
},
/**
* Resolve coordinates from the response data (probably preferably to use this if it's not matching the config values exactly)
* Resolve coordinates from the response data (probably preferably to use
* this if it's not matching the config values exactly)
*
* @param {object} data Response data from the weather service
* @returns {{lon, lat}} the lat/long coordinates of the data
@ -237,12 +237,12 @@ WeatherProvider.register("smhi", {
},
/**
* Map the icon value from SHMI to an icon that MagicMirror understands.
* Map the icon value from SMHI to an icon that MagicMirror understands.
* Uses different icons depending if its daytime or nighttime.
* SHMI's description of what the numeric value means is the comment after the case.
* SMHI's description of what the numeric value means is the comment after the case.
*
* @param {number} input The smhi icon value
* @param {boolean} isDayTime True if the icon should be for daytime, false for nightime
* @param {number} input The SMHI icon value
* @param {boolean} isDayTime True if the icon should be for daytime, false for nighttime
* @returns {string} The icon name for the MagicMirror
*/
convertWeatherType(input, isDayTime) {
@ -250,57 +250,57 @@ WeatherProvider.register("smhi", {
case 1:
return isDayTime ? "day-sunny" : "night-clear"; // Clear sky
case 2:
return isDayTime ? "day-sunny-overcast" : "night-partly-cloudy"; //Nearly clear sky
return isDayTime ? "day-sunny-overcast" : "night-partly-cloudy"; // Nearly clear sky
case 3:
return isDayTime ? "day-cloudy" : "night-cloudy"; //Variable cloudiness
return isDayTime ? "day-cloudy" : "night-cloudy"; // Variable cloudiness
case 4:
return isDayTime ? "day-cloudy" : "night-cloudy"; //Halfclear sky
return isDayTime ? "day-cloudy" : "night-cloudy"; // Halfclear sky
case 5:
return "cloudy"; //Cloudy sky
return "cloudy"; // Cloudy sky
case 6:
return "cloudy"; //Overcast
return "cloudy"; // Overcast
case 7:
return "fog"; //Fog
return "fog"; // Fog
case 8:
return "showers"; //Light rain showers
return "showers"; // Light rain showers
case 9:
return "showers"; //Moderate rain showers
return "showers"; // Moderate rain showers
case 10:
return "showers"; //Heavy rain showers
return "showers"; // Heavy rain showers
case 11:
return "thunderstorm"; //Thunderstorm
return "thunderstorm"; // Thunderstorm
case 12:
return "sleet"; //Light sleet showers
return "sleet"; // Light sleet showers
case 13:
return "sleet"; //Moderate sleet showers
return "sleet"; // Moderate sleet showers
case 14:
return "sleet"; //Heavy sleet showers
return "sleet"; // Heavy sleet showers
case 15:
return "snow"; //Light snow showers
return "snow"; // Light snow showers
case 16:
return "snow"; //Moderate snow showers
return "snow"; // Moderate snow showers
case 17:
return "snow"; //Heavy snow showers
return "snow"; // Heavy snow showers
case 18:
return "rain"; //Light rain
return "rain"; // Light rain
case 19:
return "rain"; //Moderate rain
return "rain"; // Moderate rain
case 20:
return "rain"; //Heavy rain
return "rain"; // Heavy rain
case 21:
return "thunderstorm"; //Thunder
return "thunderstorm"; // Thunder
case 22:
return "sleet"; // Light sleet
case 23:
return "sleet"; //Moderate sleet
return "sleet"; // Moderate sleet
case 24:
return "sleet"; // Heavy sleet
case 25:
return "snow"; // Light snowfall
case 26:
return "snow"; //Moderate snowfall
return "snow"; // Moderate snowfall
case 27:
return "snow"; //Heavy snowfall
return "snow"; // Heavy snowfall
default:
return "";
}

View File

@ -13,9 +13,8 @@
* Hourly data for next 2 days ("hourly") - https://www.metoffice.gov.uk/binaries/content/assets/metofficegovuk/pdf/data/global-spot-data-hourly.pdf
* 3-hourly data for the next 7 days ("3hourly") - https://www.metoffice.gov.uk/binaries/content/assets/metofficegovuk/pdf/data/global-spot-data-3-hourly.pdf
* Daily data for the next 7 days ("daily") - https://www.metoffice.gov.uk/binaries/content/assets/metofficegovuk/pdf/data/global-spot-data-daily.pdf
*/
/* NOTES
*
* NOTES
* This provider requires longitude/latitude coordinates, rather than a location ID (as with the previous Met Office provider)
* Provide the following in your config.js file:
* weatherProvider: "ukmetofficedatahub",

View File

@ -7,7 +7,8 @@
* By Andrew Pometti
* MIT Licensed
*
* This class is a provider for Weatherbit, based on Nicholas Hubbard's class for Dark Sky & Vince Peri's class for Weather.gov.
* This class is a provider for Weatherbit, based on Nicholas Hubbard's class
* for Dark Sky & Vince Peri's class for Weather.gov.
*/
WeatherProvider.register("weatherbit", {
// Set the name of the provider.

View File

@ -133,7 +133,9 @@ class WeatherObject {
}
/**
* Update the sunrise / sunset time depending on the location
* Update the sunrise / sunset time depending on the location. This can be
* used if your provider doesnt provide that data by itself. Then SunCalc
* is used here to calculate them according to the location.
*
* @param {number} lat latitude
* @param {number} lon longitude