How to use the tplink-lightbulb.scan function in tplink-lightbulb

To help you get started, we’ve selected a few tplink-lightbulb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github leematt / homebridge-tplink-lightbulb / index.js View on Github external
scan () {
    Bulb.scan('IOT.SMARTBULB').on('light', (light) => {
      // Does the bulb support color?
      light.is_color = light._sysinfo.is_color

      var accessory = this.accessories.get(light.deviceId)
      // Initialize a new bulb as an accessory
      if (accessory === undefined) {
      // Reconfigure an existing cached accessory
      else {
        this.log('Lightbulb online: %s [%s]', accessory.displayName, light.deviceId)
        accessory = new TplinkLightbulbAccessory(this.log, accessory)
        this.accessories.set(light.deviceId, accessory)


Control TP-Link smart-home devices from nodejs

Latest version published 5 months ago

Package Health Score

59 / 100
Full package analysis

Popular tplink-lightbulb functions