run lint:prettier

This commit is contained in:
tobias 2022-02-22 11:14:28 +01:00
parent 212e60c12d
commit 4048d79fc5

View File

@ -20,7 +20,7 @@ WeatherProvider.register("weatherflow", {
defaults: { defaults: {
apiBase: "https://swd.weatherflow.com/swd/rest/", apiBase: "https://swd.weatherflow.com/swd/rest/",
token: "", token: "",
stationid: "", stationid: ""
}, },
units: { units: {
@ -28,7 +28,6 @@ WeatherProvider.register("weatherflow", {
metric: "si" metric: "si"
}, },
fetchCurrentWeather() { fetchCurrentWeather() {
this.fetchData(this.getUrl()) this.fetchData(this.getUrl())
.then((data) => { .then((data) => {
@ -40,10 +39,9 @@ WeatherProvider.register("weatherflow", {
currentWeather.windSpeed = data.current_conditions.wind_avg; currentWeather.windSpeed = data.current_conditions.wind_avg;
currentWeather.windDirection = data.current_conditions.wind_direction; currentWeather.windDirection = data.current_conditions.wind_direction;
currentWeather.weatherType = data.forecast.daily[0].icon; currentWeather.weatherType = data.forecast.daily[0].icon;
currentWeather.sunrise = moment(data.forecast.daily[0].sunrise), "X"; (currentWeather.sunrise = moment(data.forecast.daily[0].sunrise)), "X";
currentWeather.sunset = moment(data.forecast.daily[0].sunset, "X"); currentWeather.sunset = moment(data.forecast.daily[0].sunset, "X");
this.setCurrentWeather(currentWeather); this.setCurrentWeather(currentWeather);
}) })
.catch(function (request) { .catch(function (request) {
Log.error("Could not load data ... ", request); Log.error("Could not load data ... ", request);
@ -57,7 +55,6 @@ WeatherProvider.register("weatherflow", {
const days = []; const days = [];
for (const forecast of data.forecast.daily) { for (const forecast of data.forecast.daily) {
const weather = new WeatherObject(this.config.units, this.config.tempUnits, this.config.windUnits, this.config.useKmh); const weather = new WeatherObject(this.config.units, this.config.tempUnits, this.config.windUnits, this.config.useKmh);
weather.date = moment(forecast.day_start_local, "X"); weather.date = moment(forecast.day_start_local, "X");
@ -66,12 +63,10 @@ WeatherProvider.register("weatherflow", {
weather.weatherType = forecast.icon; weather.weatherType = forecast.icon;
weather.snow = 0; weather.snow = 0;
days.push(weather); days.push(weather);
} }
this.setWeatherForecast(days); this.setWeatherForecast(days);
}) })
.catch(function (request) { .catch(function (request) {
Log.error("Could not load data ... ", request); Log.error("Could not load data ... ", request);
@ -81,6 +76,6 @@ WeatherProvider.register("weatherflow", {
// Create a URL from the config and base URL. // Create a URL from the config and base URL.
getUrl() { getUrl() {
return this.config.apiBase + "better_forecast?station_id=" + this.config.stationid + "&token=" + this.config.token return this.config.apiBase + "better_forecast?station_id=" + this.config.stationid + "&token=" + this.config.token;
} }
}); });