diff --git a/APPSTORE.md b/APPSTORE.md index 18ee9d0..d8db294 100644 --- a/APPSTORE.md +++ b/APPSTORE.md @@ -5,7 +5,7 @@ This app uses an unofficial library called the [miIO Device Library](https://git ## Supported devices Below is a list of supported devices and devices. Post a comment in the [support topic](https://forum.athom.com/discussion/3295/) if you would like to see support for a specific device, some devices might already be supported by the miio library but just need to be implemented. For devices not yet support by the miio library you need technical knowledge to discover the device properties yourself as described [here](https://github.com/aholstenson/miio/blob/master/docs/missing-devices.md). -* Yeelights: Bulbs Wi-Fi (tested), LED strips (tested), Bedside Lamp II (tested), Ceiling Lights (tested) +* Yeelights: Bulbs Wi-Fi (tested), LED strips (tested), Bedside Lamp II (tested), Ceiling Lights (tested), Desk Lamp (tested) * Xiaomi Philips: Light Bulbs (tested), Eyecare Lamp 2 (untested) * Xiaomi Robot Vacuum Cleaner V1 (tested) and Xiaomi Robot Vacuum Cleaner V2 (untested) * Xiaomi Air Purifiers 2, 2S and Pro (tested) @@ -24,5 +24,6 @@ This Homey app supports direct control for Yeelights. Before being able to add y For Homey to be able to communicate with devices over the miIO protocol a unique device token needs to be obtained. Technical knowledge is needed for retrieving these tokens. If your are not to tech-savvy using this app for any other devices than the Yeelights might be challenging. See the instructions [here](https://github.com/jghaanstra/com.xiaomi-miio/blob/master/docs/obtain_token.md) on retrieving device tokens. ## Changelog -### 2018-05-29 -- v2.6.5 +### 2018-06-04 -- v2.6.5 +* NEW: add support for Yeelight Desk Lamp * FIX: fixed issues with color temperature for Xiaomi Philips Light Bulbs diff --git a/drivers/yeelights/assets/desklamp.svg b/drivers/yeelights/assets/desklamp.svg new file mode 100644 index 0000000..f226569 --- /dev/null +++ b/drivers/yeelights/assets/desklamp.svg @@ -0,0 +1,92 @@ + + + + + diff --git a/drivers/yeelights/driver.js b/drivers/yeelights/driver.js index 6e1938c..cd3e391 100644 --- a/drivers/yeelights/driver.js +++ b/drivers/yeelights/driver.js @@ -6,59 +6,63 @@ const yeelight = require('/lib/yeelight.js'); const typeCapabilityMap = { 'mono' : [ 'onoff', 'dim' ], 'color' : [ 'onoff', 'dim', 'light_hue', 'light_saturation', 'light_temperature', 'light_mode' ], - 'stripe' : [ 'onoff', 'dim', 'light_hue', 'light_saturation', 'light_temperature', 'light_mode' ], - 'bslamp' : [ 'onoff', 'dim', 'light_hue', 'light_saturation', 'light_temperature', 'light_mode' ], - 'ceiling' : [ 'onoff', 'dim', 'light_hue', 'light_saturation', 'light_temperature', 'light_mode' ], - 'ceiling4' : [ 'onoff', 'dim', 'light_hue', 'light_saturation', 'light_temperature', 'light_mode' ], + 'stripe' : [ 'onoff', 'dim', 'light_hue', 'light_saturation', 'light_temperature', 'light_mode' ], + 'bslamp' : [ 'onoff', 'dim', 'light_hue', 'light_saturation', 'light_temperature', 'light_mode' ], + 'ceiling' : [ 'onoff', 'dim', 'light_hue', 'light_saturation', 'light_temperature', 'light_mode' ], + 'ceiling4' : [ 'onoff', 'dim', 'light_hue', 'light_saturation', 'light_temperature', 'light_mode' ], + 'desklamp' : [ 'onoff', 'dim', 'light_temperature', 'light_mode' ] } const typeIconMap = { - 'mono' : 'bulb.svg', - 'color' : 'bulb.svg', - 'stripe' : 'strip.svg', - 'bslamp' : 'bslamp.svg', - 'ceiling' : 'ceiling.svg', - 'ceiling4': 'ceiling4.svg' + 'mono' : 'bulb.svg', + 'color' : 'bulb.svg', + 'stripe' : 'strip.svg', + 'bslamp' : 'bslamp.svg', + 'ceiling' : 'ceiling.svg', + 'ceiling4' : 'ceiling4.svg', + 'desklamp' : 'desklamp.svg' } class YeelightDriver extends Homey.Driver { - onInit() { - yeelight.listenUpdates(); - } + onInit() { + yeelight.listenUpdates(); + } - onPairListDevices (data, callback) { - yeelight.discover() - .then(result => { - let devices = []; - for (let i in result) { - if(result[i].model == 'color') { - var name = Homey.__('yeelight_bulb_color')+ ' (' + result[i].address + ')'; - } else if (result[i].model == 'mono') { - var name = Homey.__('yeelight_bulb_white')+ ' (' + result[i].address + ')'; - } else if (result[i].model == 'stripe') { - var name = Homey.__('yeelight_led_strip')+ ' (' + result[i].address + ')'; - } else if (result[i].model == 'bslamp') { - var name = Homey.__('yeelight_bedside_lamp')+ ' (' + result[i].address + ')'; - } else if (result[i].model == 'ceiling' || result[i].model == 'ceiling4') { - var name = Homey.__('yeelight_ceiling_light')+ ' (' + result[i].address + ')'; - } - devices.push({ - name: name, - data: { - id: result[i].id, - address: result[i].address, - port: result[i].port, - model: result[i].model - }, - capabilities: typeCapabilityMap[result[i].model], - icon: typeIconMap[result[i].model] - }); - } - callback(null, devices); - }); + onPairListDevices (data, callback) { + yeelight.discover() + .then(result => { + let devices = []; + for (let i in result) { + if(result[i].model == 'color') { + var name = Homey.__('yeelight_bulb_color')+ ' (' + result[i].address + ')'; + } else if (result[i].model == 'mono') { + var name = Homey.__('yeelight_bulb_white')+ ' (' + result[i].address + ')'; + } else if (result[i].model == 'stripe') { + var name = Homey.__('yeelight_led_strip')+ ' (' + result[i].address + ')'; + } else if (result[i].model == 'bslamp') { + var name = Homey.__('yeelight_bedside_lamp')+ ' (' + result[i].address + ')'; + } else if (result[i].model == 'ceiling' || result[i].model == 'ceiling4') { + var name = Homey.__('yeelight_ceiling_light')+ ' (' + result[i].address + ')'; + } else if (result[i].model == 'desklamp') { + var name = Homey.__('yeelight_desklamp')+ ' (' + result[i].address + ')'; + } + devices.push({ + name: name, + data: { + id: result[i].id, + address: result[i].address, + port: result[i].port, + model: result[i].model + }, + capabilities: typeCapabilityMap[result[i].model], + icon: typeIconMap[result[i].model] + }); + } + callback(null, devices); + }); - } + } } diff --git a/locales/en.json b/locales/en.json index 11aa6c0..f15be36 100644 --- a/locales/en.json +++ b/locales/en.json @@ -40,5 +40,6 @@ "yeelight_led_stripe": "Yeelight LED Strip", "yeelight_bedside_lamp": "Yeelight Bedside Lamp", "yeelight_ceiling_light": "Yeelight Ceiling Light", + "yeelight_desklamp": "Yeelight Desk Lamp", "unreachable": "Offline" } diff --git a/locales/nl.json b/locales/nl.json index 82871e9..94b5fa5 100644 --- a/locales/nl.json +++ b/locales/nl.json @@ -40,5 +40,6 @@ "yeelight_led_strip": "Yeelight LED strip", "yeelight_bedside_lamp": "Yeelight Nachtlamp", "yeelight_ceiling_light": "Yeelight Plafondlamp", + "yeelight_desklamp": "Yeelight Bureau Lamp", "unreachable": "Niet beschikbaar" }