Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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) {
this.addAccessory(light)
}
// 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)
accessory.configure(light)
}
})