README
homestar-openweathermap
IOTDB Bridge for for OpenWeatherMap.
About
See the samples for details how to add to your project.
Installation
- Read this first
- Read about installing Home☆Star. Home☆Star is only need for command line functions during installation.
Then:
$ npm install -g homestar ## may require sudo
$ npm install homestar-openweathermap
Then, get an AppID from OpenWeatherMap. Add it to IOTDB by
$ homestar set /bridges/OpenWeatherMapBridge/initd/key 848948494849
Use
Current Weather
Get the current weather. Any change to the weather will create an istate
event.
const iotdb = require('iotdb')
iotdb.use("homestar-openweathermap")
const things = iotdb.connect("OpenWeatherMapObservation", {
location: "Palm Springs, CA"
});
things.on("istate", thing => {
console.log("+", "istate", thing.state("meta"), "\n ", thing.state("istate"));
});
Forecasts
Get the forecasts. Each specific forecast for a point in time, for example, 3p on January 3, will create a new "Thing".
Changes to the forecast will create istate
events.
const iotdb = require('iotdb')
iotdb.use("homestar-openweathermap")
const things = iotdb.connect("OpenWeatherMapForecast", {
location: "Palm Springs, CA"
});
things.on("istate", thing => {
console.log("+", "istate", thing.state("meta"), "\n ", thing.state("istate"));
});
Models
OpenWeatherMapObservation
See open-weather-map-observation