homestar-openweathermap

IOTDB Bridge for OpenWeatherMap

Usage no npm install needed!

<script type="module">
  import homestarOpenweathermap from 'https://cdn.skypack.dev/homestar-openweathermap';
</script>

README

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