amp-smart-light
v0.5.2
Published
Library to interact with an Amp smart lighting controller
Downloads
12
Maintainers
Readme
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