Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/artcom/weather-service
A NodeJS service publishing Openweatermap weather data to an MQTT broker
https://github.com/artcom/weather-service
Last synced: about 1 month ago
JSON representation
A NodeJS service publishing Openweatermap weather data to an MQTT broker
- Host: GitHub
- URL: https://github.com/artcom/weather-service
- Owner: artcom
- License: apache-2.0
- Created: 2017-05-09T12:04:25.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T02:36:45.000Z (almost 2 years ago)
- Last Synced: 2024-11-07T06:36:25.774Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 976 KB
- Stars: 0
- Watchers: 12
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Weather Service
A backend service that retrieves weather data for a given location from the [openweathermap API](https://openweathermap.org/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)](https://creativecommons.org/licenses/by-sa/4.0/).
The openweathermap data and database are open and licensed by the [Open Data Commons Open Database License (ODbL)](https://opendatacommons.org/licenses/odbl/).
## Provided Data
### `/current`
```javascript
{
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"
}
}
```### `/forecast`
Contains forecasts for 7 days where the first entry is for today, the second for tomorrow and so forth.
```javascript
[
{
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
```bash
npm install// set all environment variables needed
npm start
```