Weather data and forecast for STEM from OpenWeatherMap.
weather loads the current weather and a five day forecast for a default location every 15 minutes and offers it through web-api. Optionally it also reads a local ESP sensor. Other plugins, for example mirra, use it to look up the weather of any town.
- Current weather and 5 day forecast for the default location, updated every 15 minutes
- Weather of any location on demand (console command and API)
- Optional ESP sensor (temperature, pressure, humidity), read every 60 seconds
- Failed requests keep the previous data
Requests use lang=de, units=metric and search locations in Germany (,de).
| Requirement | Version |
|---|---|
| STEM | 1.2.0 or newer (stem-api) |
| Plugins | web-api |
| API key | OpenWeatherMap key with access to the daily forecast |
- Build the plugin with
mvn clean package(or take the build from Jenkins). - Copy
target/weather.jarinto thepluginsfolder of STEM. - Start STEM once to create
plugins/weather/config.yml. - Enter your API key and location, then restart STEM (plugins are only loaded at startup).
| Key | Default | Description |
|---|---|---|
weather.apiKey |
xxxxxxxxxxxxxxxxx |
OpenWeatherMap API key |
weather.defaultLocation |
Blieskastel |
Location for the regular update |
espMCU.sensor.use |
false |
Read the ESP sensor |
espMCU.sensor.address |
10.40.0.52 |
Address of the ESP sensor (http://<address>) |
The ESP sensor must answer with JSON containing temperature, pressure and humidity.
| Command | Description |
|---|---|
weather <location> |
Current weather of a location |
weather |
Time since the last data of the ESP sensor |
/weather/current returns the data of the default location:
weatherID (icon), description, currentTemp, minTemp, maxTemp, location, pressure,
humidity and, if available, forecast with one entry per day (minTemp, maxTemp, speed,
clouds, main, description, date, dayText).
WeatherContainer current = WeatherPlugin.weatherPlugin.getWeatherData(); // default location, may be null
String key = WeatherPlugin.weatherPlugin.getDefaultConfig().getString("weather.apiKey");
WeatherContainer other = new WeatherEngine(key).getCurrentWeather("Berlin"); // null if not available
Both methods return null when no data is available, so always check the result.
Copyright (c) MirraNET, Niklas Linz. Licensed under the GNU Lesser General Public License v3.0.
