Skip to content

Interaction library for the Amp smart lighting controller

License

Notifications You must be signed in to change notification settings

intentfulmotion/amp.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Interaction library for the Amp smart lighting controller

Resources

License

Stars

Watchers

Forks

Packages