homestar-openweathermap

1.0.2 • Public • Published

homestar-openweathermap

IOTDB Bridge for for OpenWeatherMap.

About

See the samples for details how to add to your project.

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

OpenWeatherMapForecast

See open-weather-map-forecast

Dependencies (3)

Dev Dependencies (9)

Package Sidebar

Install

npm i homestar-openweathermap

Weekly Downloads

1

Version

1.0.2

License

Apache-2.0

Last publish

Collaborators

  • dpjanes