Skip to content

Commit

Permalink
1.1.5 added Yeelight lights, MI plug
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxmudjon committed Jun 9, 2020
1 parent 2c97819 commit c8af23e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Added support for Mi Gateways child devices.

## Version 1.1.4 - Supported devices:
## Version 1.1.5 - Supported devices:

### Zigbee subdevices Xiaomi Gateway

Expand Down Expand Up @@ -38,10 +38,10 @@ Added support for Mi Gateways child devices.

### Wifi devices

- Yeelight Color Bulb V1/V2.
- Yeelight Color Bulb V1/V2/V3.
- Yeelight White Bulb.
- Yeelight Ceiling Lamp.
- Yeelight Bedside Lamp.
- Yeelight Bedside Lamp V1/V2.
- Yeelight Light Strip V1/V2.
- Yeelight Jiaoyue 650.
- Yeelight Jiaoyue 450.
Expand Down Expand Up @@ -127,6 +127,12 @@ Added support for Mi Gateways child devices.

## Version logs

### 1.1.5 (9.06.2020)

1. added support for Yeelight Color Bulb V3.
2. added support for Yeelight Bedside Lamp V2.
3. added support for Xiaomi Chuangmi Plug (M3), Mi Smart Plug (HMI205).

### 1.1.4 (23.05.2020)

1. added Mi Air Humidifier 2 (mi_humidifier_cb1).
Expand Down
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "com.maxmudjon.mihomey",
"version": "1.1.4",
"version": "1.1.5",
"compatibility": ">=2.0.0",
"sdk": 2,
"name": {
Expand Down
2 changes: 1 addition & 1 deletion drivers/chuangmi_plug_m1/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MiSmartPlugWiFi extends Homey.Driver {
device
.call("miIO.info", [])
.then(value => {
if (value.model == this.data.model) {
if (value.model == this.data.model || value.model == "chuangmi.plug.m3" || value.model == "chuangmi.plug.hmi205") {
pairingDevice.data.id = "PL:UG:M1:" + value.mac + ":PL:UG:M1";
device
.call("get_prop", ["power"])
Expand Down
6 changes: 3 additions & 3 deletions drivers/ctrl_neutral1/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class SingleSwitch extends Homey.Device {
let sid = this.data.sid;
this.registerCapabilityListener(name, async value => {
const newValue = value ? valueOn : valueOff;
const data = { status: newValue };
const data = { channel_0: newValue };
await Homey.app.mihub.sendWrite(sid, data);
this.triggerFlow(trigger, name, value);
});
Expand All @@ -110,12 +110,12 @@ class SingleSwitch extends Homey.Device {

registerToggleAction(name, valueOn = true, valueOff = false, action) {
action.on.registerRunListener(async (args, state) => {
const data = { status: valueOn };
const data = { channel_0: valueOn };
await Homey.app.mihub.sendWrite(args.device.data.sid, data);
return true;
});
action.off.registerRunListener(async (args, state) => {
const data = { status: valueOff };
const data = { channel_0: valueOff };
await Homey.app.mihub.sendWrite(args.device.data.sid, data);
return true;
});
Expand Down
2 changes: 1 addition & 1 deletion drivers/yeelight_light_bslamp1/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class YeelightBedsideLamp extends Homey.Driver {
device
.call("miIO.info", [])
.then(value => {
if (value.model == this.data.model) {
if (value.model == this.data.model || value.model == "yeelink.light.bslamp2") {
pairingDevice.data.id = "YL:BS:L1:" + value.mac + ":YL:BS:L1";
device
.call("get_prop", ["bright"])
Expand Down
8 changes: 4 additions & 4 deletions drivers/yeelight_light_color1/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ class YeelightColorBulb extends Homey.Driver {
pairingDevice.settings = {};
pairingDevice.data = {};

socket.on("connect", function (data, callback) {
socket.on("connect", (data, callback) => {
this.data = data;
miio
.device({ address: data.ip, token: data.token })
.then(device => {
device
.call("miIO.info", [])
.then(value => {
if (value.model == this.data.model || value.model == 'yeelink.light.color2') {
if (value.model == this.data.model || value.model == "yeelink.light.color2" || value.model == "yeelink.light.color3") {
pairingDevice.data.id = "YL:CB:" + value.mac + ":YL:CB";
device
.call("get_prop", ["bright"])
Expand Down Expand Up @@ -63,7 +63,7 @@ class YeelightColorBulb extends Homey.Driver {
})
.catch(error => callback(null, error));
})
.catch(function (error) {
.catch(error => {
if (error == "Error: Could not connect to device, handshake timeout") {
callback(null, "timeout");
}
Expand All @@ -74,7 +74,7 @@ class YeelightColorBulb extends Homey.Driver {
}
});
});
socket.on("done", function (data, callback) {
socket.on("done", (data, callback) => {
callback(null, pairingDevice);
});
}
Expand Down

0 comments on commit c8af23e

Please sign in to comment.