diff --git a/build/synctastic.js b/build/synctastic.js index 6cd59908367632ba4de173e6604d6586d592c30a..34b4f5f2321124e1ab56d2b9cdcd20039f77b647 100644 --- a/build/synctastic.js +++ b/build/synctastic.js @@ -16858,8 +16858,12 @@ if (weather.current === void 0) return false; var wd = openWeatherMap.wind_direction(weather.current.wind_deg); + var conditions = weather.current.weather.map(function(e) { + return e.main; + }).join(", "); var ws = "Weather for ".concat(weather.lat.toFixed(2), ", ").concat(weather.lon.toFixed(2)); - ws += "\r\n".concat(weather.current.weather[0].main, ", ").concat(weather.current.weather[0].description); + if (conditions.length > 0) + ws += "\r\n".concat(conditions); ws += "\r\n".concat(weather.current.temp, "\xB0C, feels like ").concat(weather.current.feels_like, "\xB0C"); ws += "\r\nUV: ".concat(weather.current.uvi, " ").concat(uvEmoji(weather.current.uvi)); ws += "\r\nHumidity: ".concat(weather.current.humidity, "%"); diff --git a/src/modules/weather.ts b/src/modules/weather.ts index 9489ae756ebd8c80d06da5246495737be71eea6b..4e50c13836fc9393da1e4da9d38172b253adaad6 100644 --- a/src/modules/weather.ts +++ b/src/modules/weather.ts @@ -11,11 +11,6 @@ function uvEmoji(uvi: number): string { return '🟣'; } -function weatherEmoji(icon: string): string { - // just map their icons to some emojis and check for 'd' vs 'n' to choose sun/moon variants - return ''; -} - export default class Weather extends Module { constructor(config: IModuleConfig, devices: Device[]) { @@ -33,8 +28,9 @@ export default class Weather extends Module { const weather = openWeatherMap.call_api_v3({ lat: 43.7554870, lon: -79.4384880, exclude: ['minutely', 'hourly', 'daily', 'alerts'], units: 'metric' }); if (weather.current === undefined) return false; const wd = openWeatherMap.wind_direction(weather.current.wind_deg); + const conditions = weather.current.weather.map(e => e.main).join(', '); let ws = `Weather for ${weather.lat.toFixed(2)}, ${weather.lon.toFixed(2)}`; - ws += `\r\n${weather.current.weather[0].main}, ${weather.current.weather[0].description}`; + if (conditions.length > 0) ws += `\r\n${conditions}`; ws += `\r\n${weather.current.temp}°C, feels like ${weather.current.feels_like}°C`; ws += `\r\nUV: ${weather.current.uvi} ${uvEmoji(weather.current.uvi)}`; ws += `\r\nHumidity: ${weather.current.humidity}%`;