0.5.2 • Published 4 years ago

amp-smart-light v0.5.2

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

amp.js

Interaction library for the Amp smart lighting controller. Uses RxJS observables to communicate changes from the Amp.

Usage

const Amp = require('amp-smart-light')
let amp = new Amp()

Connect to an Amp

amp.connection.subscribe(connection => {
  switch (connection) {
    case ConnectionState.DISCONNECTED:
      break;
    case ConnectionState.CONNECTING:
      break;
    case ConnectionState.DISCOVERING_SERVICES:
      break;
    case ConnectionState.READY:
      alert('connected to amp')
      break;
  }
})

// the following line will only work from a user gesture
// see: https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web#user_gesture_required
const device = navigator.bluetooth.requestDevice(amp.getDeviceOptions())
await amp.connect(device)

TODO: add library documentation

0.5.0

4 years ago

0.5.2

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.3.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago