From 6c1ce674a5a1adf7eb536a6337dea42d9b505ae1 Mon Sep 17 00:00:00 2001 From: ebaauw Date: Tue, 13 Dec 2016 20:49:17 +0100 Subject: [PATCH] Issue #28 Expose on/off plugs as Switch instead of Lightbulb. --- lib/HueLight.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/HueLight.js b/lib/HueLight.js index 75dc546f..4a0e35dd 100644 --- a/lib/HueLight.js +++ b/lib/HueLight.js @@ -248,7 +248,11 @@ function HueLight(bridge, id, obj, type) { .setCharacteristic(Characteristic.Manufacturer, zigbee ? obj.manufacturername : "homebridge-hue") .setCharacteristic(Characteristic.Model, zigbee ? obj.modelid : obj.type) .setCharacteristic(Characteristic.SerialNumber, this.uuid_base); - this.service = new Service.Lightbulb(this.name); + if (this.state.bri === undefined && this.state.ct === undefined && this.state.xy === undefined) { + this.service = new Service.Switch(this.name); + } else { + this.service = new Service.Lightbulb(this.name); + } this.service.setCharacteristic(Characteristic.On, this.hk.on); this.service.getCharacteristic(Characteristic.On) .on("get", function(callback) {callback(null, this.hk.on);}.bind(this))