Skip to content

Commit

Permalink
Release 2.6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
jghaanstra committed Jun 5, 2018
1 parent bf3c26f commit 543802e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 33 deletions.
4 changes: 3 additions & 1 deletion APPSTORE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ 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-06-04 -- v2.6.5
### 2018-06-05 -- v2.6.5
* NEW: add support for Yeelight Desk Lamp
* FIX: remove color capabilities for regular Yeelight ceiling lamp
* FIX: fix type-o in temperature range for Yeelight ceiling lamp
* FIX: fixed issues with color temperature for Xiaomi Philips Light Bulbs
55 changes: 27 additions & 28 deletions drivers/philips-bulb/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,35 @@ const miio = require('miio');

class PhilipsBulbDriver extends Homey.Driver {

onPair(socket) {
socket.on('testConnection', function(data, callback) {
miio.device({
address: data.address,
token: data.token
}).then(device => {
const getData = async () => {
try {
const power = await device.power();
const brightness = await device.brightness()
const colorTemperature = await device.color();
onPair(socket) {
socket.on('testConnection', function(data, callback) {
miio.device({
address: data.address,
token: data.token
}).then(device => {
const getData = async () => {
try {
const power = await device.power();
const brightness = await device.brightness();
const colorTemperature = await device.color();

let result = {
onoff: power,
brightness: brightness,
colorTemperature: colorTemperature
}

callback(null, result);
} catch (error) {
callback(error, null);
}
}
getData();
}).catch(function (error) {
callback(error, null);
});
});
}
let result = {
onoff: power,
brightness: brightness,
colorTemperature: colorTemperature
}

callback(null, result);
} catch (error) {
callback(error, null);
}
}
getData();
}).catch(function (error) {
callback(error, null);
});
});
}
}

module.exports = PhilipsBulbDriver;
6 changes: 3 additions & 3 deletions drivers/yeelights/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class YeelightDevice extends Homey.Device {
if (this.getData().model == 'ceiling4') {
var color_temp = yeelight.denormalize(value, 2700, 6000);
} else {
var color_temp = yeelight.denormalize(value, 1700, 6500);
var color_temp = yeelight.denormalize(value, 2700, 6500);
}
this.sendCommand(this.getData().id, '{"id":1,"method":"set_ct_abx","params":['+ color_temp +', "smooth", 500]}');
callback(null, value);
Expand Down Expand Up @@ -183,7 +183,7 @@ class YeelightDevice extends Homey.Device {
if (device.getData().model == 'ceiling4') {
var color_temp = yeelight.normalize(result.params.ct, 2700, 6000);
} else {
var color_temp = yeelight.normalize(result.params.ct, 1700, 6500);
var color_temp = yeelight.normalize(result.params.ct, 2700, 6500);
}
device.setCapabilityValue('light_temperature', color_temp);
break;
Expand Down Expand Up @@ -229,7 +229,7 @@ class YeelightDevice extends Homey.Device {
if (device.getData().model == 'ceiling4') {
var color_temp = yeelight.normalize(result.result[3], 2700, 6000);
} else {
var color_temp = yeelight.normalize(result.result[3], 1700, 6500);
var color_temp = yeelight.normalize(result.result[3], 2700, 6500);
}
if(result.result[2] == 2) {
var color_mode = 'temperature';
Expand Down
2 changes: 1 addition & 1 deletion drivers/yeelights/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const typeCapabilityMap = {
'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' ],
'ceiling' : [ 'onoff', 'dim', 'light_temperature', 'light_mode' ],
'ceiling4' : [ 'onoff', 'dim', 'light_hue', 'light_saturation', 'light_temperature', 'light_mode' ],
'desklamp' : [ 'onoff', 'dim', 'light_temperature', 'light_mode' ]
}
Expand Down

0 comments on commit 543802e

Please sign in to comment.