A backend service that retrieves weather data for a given location from the openweathermap API at a regular interval and publishes it to an MQTT broker.
The openweathermap API is licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International licence (CC BY-SA 4.0).
The openweathermap data and database are open and licensed by the Open Data Commons Open Database License (ODbL).
{
condition: "wind" | "thunderstorm" | "rain" | "snow" | "cloudy" | "mixed" | "sunny",
temperature: number, # in degrees celsius
humidity: number, # in percent
wind: {
speed: number, # in km/h
direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW"
}
}
Contains forecasts for 7 days where the first entry is for today, the second for tomorrow and so forth.
[
{
condition: "wind" | "thunderstorm" | "rain" | "snow" | "cloudy" | "mixed" | "sunny",
low: number, # in degrees celsius
high: number # in degrees celsius
}
]
The service needs the following environment variables to be set:
TCP_BROKER_URI
to access the broker and theWEATHER_TOPIC
to publish toAPP_ID
to authenticate with openweathermapLAT
andLON
to define the location!
npm install
// set all environment variables needed
npm start