1.0.0 • Published 5 years ago

redi-openweathermap v1.0.0

Weekly downloads
4
License
ISC
Repository
github
Last release
5 years ago

Open Weather Map

the simple way to stay informed with your weather

Install via NPM:

npm i redi-openweathermap --save
requires an API key of OpenWeatherMap.org and the citycode

Only tested on Raspberry Pi Zero W on NodeJS Version v10.14.2

API

Configuration
nametypedefaultdescriptioninforequired
idintfalsecity codefind it here, eg https://openweathermap.org/city/2803460x
APPIDstringfalseOpenWeatherMap API Codeget it herex
basestringhttps://api.openweathermap.org/data/2.5base url,
unitsstringmetricresponse unitmetric,imperial
langstringderesponse languagear, bg, ca, cz, de, el, en, fa, fi, fr, gl, hr, hu, it, ja, kr, la, lt, mk, nl, pl, pt, ro, ru, se, sk, sl, es, tr, ua, vi, zh_cn, zh_tw,
timerint10*1000check interval,
forecastlenint5number of elements in your forecastlimit is 38,
Events
namedescriptionresponse
weatherreturns current weather{ main: '', description: '', icon: '', temp: { current: x, min: x, max: x }, wind: x, time: UNIX_TIMESTAMP }
forecastreturns the forecast list{ main: '', description: '', icon: '', temp: { current: x, min: x, max: x }, wind: x, time: UNIX_TIMESTAMP },{....}

Full example as in example.js

const owm = require('redi-openweathermap')({
	id: false,
	APPID: false,
	// base: 'https://api.openweathermap.org/data/2.5',
	// units: 'metric',
	// lang: 'de',
	// timer: 10*1000,
	// forecastlen: 5,
})
owm.weather( data => { console.log('weather',data) })
owm.forecast( data => { console.log('forecast',data) })