ambient-weather-api
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/ambient-weather-api package

0.0.6 • Public • Published

Ambient Weather API

A simple wrapper for the forthcoming AmbientWeather.net API

Installation

npm install ambient-weather-api

Getting Started

const api = new AmbientWeatherApi({
  apiKey: 'Put your AW apiKey here',
  applicationKey: 'Put your AW applicationKey here'
})

REST Methods

  • userDevices() - list the user's devices
    • @return - Promise containing array of device objects
  • deviceData(macAddress, options) - fetch data for a specific device
    • macAddress - (required)
    • options - limit, endDate see docs
    • @return - Promise containing array of data objects

Realtime Methods

  • connect - connect to the realtime API
  • disconnect - disconnect from the realtime API
  • subscribe - apiKeys - (required) can be a string of a single apiKey or an array of multiple apiKeys. Will listen for data on all the devices for all of the user's apiKeyss. See Event: subscribed & Event: data
  • unsubscribe - apiKeys - (required) can be a string of a single apiKey or an array of multiple apiKeys. Will stop listening for data on all of the user's apiKeys devices. See Event: subscribed
  • Event: subscribed - emitted when successfully subscribed to one or more apiKeys using the subscribe method. This event is also emitted after sucessfully unsubscribing. It will list all the currently subscribed devices
    • data.devices - array of device objects currently subscribed to
  • Event: data - emitted on new data for a subscribed device
    • data - the weather data point
    • data.device - the device that data point is for

Readme

Keywords

Package Sidebar

Install

npm i ambient-weather-api

Weekly Downloads

24

Version

0.0.6

License

ISC

Unpacked Size

12.9 kB

Total Files

8

Last publish

Collaborators

  • owise1