Four line Display support removed because the Display font cannot draw the Celsius symbol and wind direction
Yandex Weaher Usermod
V2 Usermod for getting weather data from Yandex Weather service
Web interface
The info page in the web interface shows:
- Remaining time until new weather request
- Current temperature (°C)
- Feels temperature (°C)
- Wind speed (m/s)
- Wind direction
Usage
Compile the source with the buildflag -D USERMOD_YA_WEATHER added.
build_flags = ${env:esp32dev.build_flags}
-D USERMOD_YA_WEATHER
API for other Usermods
void setEnable(bool enable)– To change enable statebool isEnable()– To query enable stateWeatherInfo *currentWeather()– To query current weather struct
Access from other Usermod
There are two options to get access to the usermod instance:
- Include
yandex-weather-usermod-v2.hbefore your Usermod in usermods_list.cpp - Use
#include "yandex-weather-usermod-v2.h"at the top of the your Usermod
Usage example
#include "wled.h"
#include "yandex-weather-usermod-v2.h"
class MyUsermode: public Usermod {
void foo() {
#ifdef USERMOD_ID_YA_WEATHER
YandexWeatherUsermod *weatherUserMode = (YandexWeatherUsermod *)usermods.lookup(USERMOD_ID_YA_WEATHER);
if (weatherUserMode != nullptr) {
weatherUserMode->setEnable(true);
weatherUserMode->currentWeather();
}
#endif
}
}
Settings
Enabled:
Checkbox to enable or disable the Usermod
ApiKey
ApiKey for access to Yandex Weather API. You can get it here.
UpdateInterval
API access frequency in minutes.
Note: It should be greater or equal to 30, because free APIKey has a limit of 50 requests per day.
ApiLanguage
The language and country combinations for which weather wording data will be returned.
More info here
CustomCoordinates
Enables the use of custom coordinates (more on them below) instead of the system ones from WLED.
CityLatitude
Custom city latitude coordinate (works only with CustomCoordinates enabled)
CityLongitude
Custom city longitude coordinate (works only with CustomCoordinates enabled)
ShowInInfo
Enable display of weather information in the "Info" page (on the WLED main scree)
PostToMQTT
Enable post weather data to MQTT topic (/yandexWeather)
MQTT Topics
| Topic | Unit | Description |
|---|---|---|
| yandexWeather/date | String | Weather received date |
| yandexWeather/tempReal | °C | Real temperature |
| yandexWeather/tempFeels | °C | Feels like temperature |
| yandexWeather/windSpeed | m/s | Wind speed |
| yandexWeather/windDir | String | Wind direction |
Additional Build Flags
| Flag | Description |
|---|---|
| YA_WEATHER_DEBUG | Show debug message with [YandexWeatherUsermod] prefix |
| YA_WEATHER_ALLOW_ALL_TIMEOUT | Allows you to set UpdateInterval to less than 30 (Use for tests or if you have a paid ApiKey) |
| YA_WEATHER_HIDE_REMAINING | Hide the remaining time to update in Info |
Author:
2Grey | Github