Skip to content

A NodeJS service publishing Openweatermap weather data to an MQTT broker

License

Notifications You must be signed in to change notification settings

artcom/weather-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather Service

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.

License

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).

Provided Data

<WEATHER_TOPIC>/current

{
  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"
  }
}

<WEATHER_TOPIC>/forecast

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
  }
]

Configuration

The service needs the following environment variables to be set:

  • TCP_BROKER_URI to access the broker and the WEATHER_TOPIC to publish to
  • APP_ID to authenticate with openweathermap
  • LAT and LON to define the location!

Local Setup

npm install

// set all environment variables needed

npm start

About

A NodeJS service publishing Openweatermap weather data to an MQTT broker

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •