From 0aea7da1682761697ebdbde5c1beddf54909fee2 Mon Sep 17 00:00:00 2001 From: jghaanstra Date: Fri, 15 Nov 2019 22:26:10 +0100 Subject: [PATCH] Release 2.13.3 --- .homeychangelog.json | 5 +++++ APPSTORE.md | 34 ------------------------------- README.txt | 3 +++ app.json | 9 ++++---- drivers/air-monitor/device.js | 15 ++++++++++++++ drivers/dmaker-fan/device.js | 16 ++++++++++++++- drivers/gateway/device.js | 16 ++++++++++++++- drivers/mi-airpurifier/device.js | 16 ++++++++++++++- drivers/mi-humidifier/device.js | 16 ++++++++++++++- drivers/mi-humidifier2/device.js | 16 ++++++++++++++- drivers/mi-power-plug/device.js | 14 +++++++++++++ drivers/mi-power-strip/device.js | 15 +++++++++++++- drivers/mi-robot/device.js | 16 ++++++++++++++- drivers/philips-bulb/device.js | 14 +++++++++++++ drivers/philips-eyecare/device.js | 14 +++++++++++++ drivers/zhimi-fan/device.js | 16 ++++++++++++++- package-lock.json | 2 +- package.json | 2 +- 18 files changed, 191 insertions(+), 48 deletions(-) create mode 100644 .homeychangelog.json delete mode 100644 APPSTORE.md create mode 100644 README.txt diff --git a/.homeychangelog.json b/.homeychangelog.json new file mode 100644 index 0000000..6c649ad --- /dev/null +++ b/.homeychangelog.json @@ -0,0 +1,5 @@ +{ + "2.13.3": { + "en": "Added a mechanism to refresh the device connection to prevent devices from not responding on the first try. Also moved installation instructions from app store to community support topic." + } +} diff --git a/APPSTORE.md b/APPSTORE.md deleted file mode 100644 index 7ae98e9..0000000 --- a/APPSTORE.md +++ /dev/null @@ -1,34 +0,0 @@ -# Control Xiaomi Mi Home Wi-Fi devices -Use Homey to control Xiaomi Mi Home devices (the Mi Home Ecosystem is also branded as MiJia). Xiaomi does not officialy support controlling most of it's devices from outside the Mi Home app with the exception of Yeelights. Yeelights can be added to Homey quite easy but for all other devices additional steps are needed that require some technical knowledge setting it up. These steps are described here but Xiaomi can make changes to it's eco system at any time resulting in Homey not being able to control these devices anymore. - -This app uses an unofficial library called the [miIO Device Library](https://github.com/aholstenson/miio) for communication with those devices which lack official support for controlling externally, credits go out to the author of this library. This Homey app only adds support for the devices that can be controlled directly through Wi-Fi (there is another app for directly controlling Xiaomi ZigBee sensors). - -## 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, LED strips, Bedside Lamp II, Ceiling Lights, Desk Lamp -* Xiaomi Philips Light Bulbs -* Philips Eyecare Light -* Xiaomi Robot Vacuum Cleaner V1 and V2/S50, S6 -* Xiaomi Air Purifiers 2, 2S and Pro -* Xiamomi Humidifier v1 & v2 -* Xiaomi Mi Fan (ZhiMi and Dmaker models) -* Xiaomi Single Power Plug and Power Strip WiFi version -* Xiaomi PM2.5 Air Monitor -* Xiaomi Gateway Light & Alarm - subdevices are supported directly with the Xiaomi ZigBee app - -## Support topic -For support please use the official support topic on the forum [here](https://community.athom.com/t/118). - -## Adding Yeelights -This Homey app supports direct control for Yeelights. Before being able to add your Yeelights as devices in Homey you will need to enable the "Developer Mode" or "LAN control" in the official Yeelight app. You can do this by using the official Yeelight app on your smartphone (not the Xiaomi Mi Home app but the actual Yeelight app). In this app go into the settings of your bulb and you will see a menu item called Developer Mode. This contains a toggle to enable the developer mode. After enabling this the Homey app will be able to autodiscover your bulb when adding it as new device. - -## Adding miIO devices -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. - -## Using Target and Zone Cleanup for Xiaomi Mi Robot -Xiaomi has released an update for the vacuum cleaners that enables zone cleaning and goto function. Using the action cards that utilize these functions are a bit challenging. If you want to use these cards please read the instructions [here](https://github.com/jghaanstra/com.xiaomi-miio/blob/master/docs/mirobot_zonecleanup.md). - -## Changelog -### v2.13.2 - 2019-11-10 -* Small fix for Yeelights not updating dim capability when in night mode -* Small fix for Yeelights not updating onoff capability when turning them on by only changing the color diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..32cdab1 --- /dev/null +++ b/README.txt @@ -0,0 +1,3 @@ +Use Homey to control Xiaomi Mi Home and Yeelight devices (the Mi Home Ecosystem is also branded as MiJia). Xiaomi does not officialy support controlling most of it's devices from outside the Mi Home app with the exception of Yeelights. Yeelights can be added to Homey quite easy but for all other devices additional steps are needed that require some technical knowledge setting it up. Beware that Xiaomi can make changes to it's eco system at any time resulting in Homey not being able to control these devices anymore. + +Please visit the support topic for supported devices, installation instructions and further details. diff --git a/app.json b/app.json index dbf8411..96c7717 100644 --- a/app.json +++ b/app.json @@ -10,7 +10,7 @@ "en": [ "Xiaomi", "Mi", "Mi Home", "miio", "vacuumcleaner", "robot", "yeelight", "yeelights", "purifier", "humidifier", "philips", "eyecare", "powerplug", "gateway" ], "nl": [ "Xiaomi", "Mi", "Mi home", "miio", "stofzuiger", "robot", "yeelight", "yeelights", "luchtreiniger", "luchtbevochtiger", "philips", "eyecare", "powerplug", "gateway" ] }, - "version": "2.13.2", + "version": "2.13.3", "compatibility": ">=3.0.0", "author": { "name": "Jelger Haanstra", @@ -26,16 +26,17 @@ "bugs": { "url": "https://github.com/jghaanstra/com.xiaomi-miio/issues" }, - "athomForumDiscussionId": 3295, "homeyCommunityTopicId": 118, + "source": "https://github.com/jghaanstra/com.xiaomi-miio", + "homepage": "https://community.athom.com/t/118", "images": { "large": "./assets/images/large.jpg", "small": "./assets/images/small.jpg" }, "category": "appliances", "description": { - "en": "Control Xiaomi Mi Home devices", - "nl": "Bestuur Xiaomi Mi Home apparaten" + "en": "Control Yeelight and Xiaomi Mi Home devices using Homey", + "nl": "Bedien Yeelight en Xiaomi Mi Home apparaten via Homey" }, "dependencies": { "net": "*" diff --git a/drivers/air-monitor/device.js b/drivers/air-monitor/device.js index 447284c..606d268 100644 --- a/drivers/air-monitor/device.js +++ b/drivers/air-monitor/device.js @@ -7,6 +7,8 @@ class MiAirMonitorDevice extends Homey.Device { onInit() { this.createDevice(); + setTimeout(() => { this.refreshDevice(); }, 600000); + this.setUnavailable(Homey.__('unreachable')); // LISTENERS FOR UPDATING CAPABILITIES @@ -24,6 +26,7 @@ class MiAirMonitorDevice extends Homey.Device { onDeleted() { clearInterval(this.pollingInterval); + clearInterval(this.refreshInterval); if (this.miio) { this.miio.destroy(); } @@ -85,6 +88,18 @@ class MiAirMonitorDevice extends Homey.Device { getData(); }, 1000 * interval); } + + refreshDevice(interval) { + clearInterval(this.refreshInterval); + + this.refreshInterval = setInterval(() => { + this.miio.destroy(); + + setTimeout(() => { + this.createDevice(); + }, 2000); + }, 300000); + } } module.exports = MiAirMonitorDevice; diff --git a/drivers/dmaker-fan/device.js b/drivers/dmaker-fan/device.js index d59aaf0..461335e 100644 --- a/drivers/dmaker-fan/device.js +++ b/drivers/dmaker-fan/device.js @@ -7,6 +7,8 @@ class DmakerFanDevice extends Homey.Device { onInit() { this.createDevice(); + setTimeout(() => { this.refreshDevice(); }, 600000); + this.setUnavailable(Homey.__('unreachable')); // LISTENERS FOR UPDATING CAPABILITIES @@ -19,11 +21,11 @@ class DmakerFanDevice extends Homey.Device { return Promise.reject('Device unreachable, please try again ...'); } }); - } onDeleted() { clearInterval(this.pollingInterval); + clearInterval(this.refreshInterval); if (this.miio) { this.miio.destroy(); } @@ -104,6 +106,18 @@ class DmakerFanDevice extends Homey.Device { }); }, 1000 * interval); } + + refreshDevice(interval) { + clearInterval(this.refreshInterval); + + this.refreshInterval = setInterval(() => { + this.miio.destroy(); + + setTimeout(() => { + this.createDevice(); + }, 2000); + }, 300000); + } } module.exports = DmakerFanDevice; diff --git a/drivers/gateway/device.js b/drivers/gateway/device.js index 26062e2..433ba07 100644 --- a/drivers/gateway/device.js +++ b/drivers/gateway/device.js @@ -11,6 +11,8 @@ class GatewayDevice extends Homey.Device { this.gatewayLuminanceTrigger = new Homey.FlowCardTriggerDevice('gatewayLuminance').register(); this.createDevice(); + setTimeout(() => { this.refreshDevice(); }, 600000); + this.setUnavailable(Homey.__('unreachable')); // LISTENERS FOR UPDATING CAPABILITIES @@ -72,11 +74,11 @@ class GatewayDevice extends Homey.Device { return Promise.reject('Device unreachable, please try again ...'); } }); - } onDeleted() { clearInterval(this.pollingInterval); + clearInterval(this.refreshInterval); if (this.miio) { this.miio.destroy(); } @@ -158,6 +160,18 @@ class GatewayDevice extends Homey.Device { getData(); }, 1000 * interval); } + + refreshDevice(interval) { + clearInterval(this.refreshInterval); + + this.refreshInterval = setInterval(() => { + this.miio.destroy(); + + setTimeout(() => { + this.createDevice(); + }, 2000); + }, 300000); + } } module.exports = GatewayDevice; diff --git a/drivers/mi-airpurifier/device.js b/drivers/mi-airpurifier/device.js index 71adb3a..718b7ce 100644 --- a/drivers/mi-airpurifier/device.js +++ b/drivers/mi-airpurifier/device.js @@ -7,6 +7,8 @@ class MiAirPurifierDevice extends Homey.Device { onInit() { this.createDevice(); + setTimeout(() => { this.refreshDevice(); }, 600000); + this.setUnavailable(Homey.__('unreachable')); // LISTENERS FOR UPDATING CAPABILITIES @@ -19,11 +21,11 @@ class MiAirPurifierDevice extends Homey.Device { return Promise.reject('Device unreachable, please try again ...'); } }); - } onDeleted() { clearInterval(this.pollingInterval); + clearInterval(this.refreshInterval); if (this.miio) { this.miio.destroy(); } @@ -93,6 +95,18 @@ class MiAirPurifierDevice extends Homey.Device { getData(); }, 1000 * interval); } + + refreshDevice(interval) { + clearInterval(this.refreshInterval); + + this.refreshInterval = setInterval(() => { + this.miio.destroy(); + + setTimeout(() => { + this.createDevice(); + }, 2000); + }, 300000); + } } module.exports = MiAirPurifierDevice; diff --git a/drivers/mi-humidifier/device.js b/drivers/mi-humidifier/device.js index d7bbe2c..0f3e561 100644 --- a/drivers/mi-humidifier/device.js +++ b/drivers/mi-humidifier/device.js @@ -7,6 +7,8 @@ class MiHumidifierDevice extends Homey.Device { onInit() { this.createDevice(); + setTimeout(() => { this.refreshDevice(); }, 600000); + this.setUnavailable(Homey.__('unreachable')); // LISTENERS FOR UPDATING CAPABILITIES @@ -19,11 +21,11 @@ class MiHumidifierDevice extends Homey.Device { return Promise.reject('Device unreachable, please try again ...'); } }); - } onDeleted() { clearInterval(this.pollingInterval); + clearInterval(this.refreshInterval); if (this.miio) { this.miio.destroy(); } @@ -89,6 +91,18 @@ class MiHumidifierDevice extends Homey.Device { getData(); }, 1000 * interval); } + + refreshDevice(interval) { + clearInterval(this.refreshInterval); + + this.refreshInterval = setInterval(() => { + this.miio.destroy(); + + setTimeout(() => { + this.createDevice(); + }, 2000); + }, 300000); + } } module.exports = MiHumidifierDevice; diff --git a/drivers/mi-humidifier2/device.js b/drivers/mi-humidifier2/device.js index f534c06..22e5be5 100644 --- a/drivers/mi-humidifier2/device.js +++ b/drivers/mi-humidifier2/device.js @@ -9,6 +9,8 @@ class MiHumidifier2Device extends Homey.Device { this.humidifier2WaterlevelTrigger = new Homey.FlowCardTriggerDevice('humidifier2Waterlevel').register(); this.createDevice(); + setTimeout(() => { this.refreshDevice(); }, 600000); + this.setUnavailable(Homey.__('unreachable')); // LISTENERS FOR UPDATING CAPABILITIES @@ -21,11 +23,11 @@ class MiHumidifier2Device extends Homey.Device { return Promise.reject('Device unreachable, please try again ...'); } }); - } onDeleted() { clearInterval(this.pollingInterval); + clearInterval(this.refreshInterval); if (this.miio) { this.miio.destroy(); } @@ -98,6 +100,18 @@ class MiHumidifier2Device extends Homey.Device { getData(); }, 1000 * interval); } + + refreshDevice(interval) { + clearInterval(this.refreshInterval); + + this.refreshInterval = setInterval(() => { + this.miio.destroy(); + + setTimeout(() => { + this.createDevice(); + }, 2000); + }, 300000); + } } module.exports = MiHumidifier2Device; diff --git a/drivers/mi-power-plug/device.js b/drivers/mi-power-plug/device.js index dd4e158..65e1137 100644 --- a/drivers/mi-power-plug/device.js +++ b/drivers/mi-power-plug/device.js @@ -7,6 +7,8 @@ class PowerPlugDevice extends Homey.Device { onInit() { this.createDevice(); + setTimeout(() => { this.refreshDevice(); }, 600000); + this.setUnavailable(Homey.__('unreachable')); // LISTENERS FOR UPDATING CAPABILITIES @@ -24,6 +26,7 @@ class PowerPlugDevice extends Homey.Device { onDeleted() { clearInterval(this.pollingInterval); + clearInterval(this.refreshInterval); if (this.miio) { this.miio.destroy(); } @@ -78,6 +81,17 @@ class PowerPlugDevice extends Homey.Device { }, 1000 * interval); } + refreshDevice(interval) { + clearInterval(this.refreshInterval); + + this.refreshInterval = setInterval(() => { + this.miio.destroy(); + + setTimeout(() => { + this.createDevice(); + }, 2000); + }, 300000); + } } module.exports = PowerPlugDevice; diff --git a/drivers/mi-power-strip/device.js b/drivers/mi-power-strip/device.js index ec0021d..2491488 100644 --- a/drivers/mi-power-strip/device.js +++ b/drivers/mi-power-strip/device.js @@ -7,6 +7,8 @@ class PowerStripDevice extends Homey.Device { onInit() { this.createDevice(); + setTimeout(() => { this.refreshDevice(); }, 600000); + this.setUnavailable(Homey.__('unreachable')); // LISTENERS FOR UPDATING CAPABILITIES @@ -19,11 +21,11 @@ class PowerStripDevice extends Homey.Device { return Promise.reject('Device unreachable, please try again ...'); } }); - } onDeleted() { clearInterval(this.pollingInterval); + clearInterval(this.refreshInterval); if (this.miio) { this.miio.destroy(); } @@ -87,6 +89,17 @@ class PowerStripDevice extends Homey.Device { }, 1000 * interval); } + refreshDevice(interval) { + clearInterval(this.refreshInterval); + + this.refreshInterval = setInterval(() => { + this.miio.destroy(); + + setTimeout(() => { + this.createDevice(); + }, 2000); + }, 300000); + } } module.exports = PowerStripDevice; diff --git a/drivers/mi-robot/device.js b/drivers/mi-robot/device.js index 5efe72e..4df9435 100644 --- a/drivers/mi-robot/device.js +++ b/drivers/mi-robot/device.js @@ -9,6 +9,8 @@ class MiRobotDevice extends Homey.Device { new Homey.FlowCardTriggerDevice('statusVacuum').register(); this.createDevice(); + setTimeout(() => { this.refreshDevice(); }, 600000); + this.setUnavailable(Homey.__('unreachable')); // LISTENERS FOR UPDATING CAPABILITIES @@ -85,11 +87,11 @@ class MiRobotDevice extends Homey.Device { return Promise.reject('Device unreachable, please try again ...'); } }); - } onDeleted() { clearInterval(this.pollingInterval); + clearInterval(this.refreshInterval); if (this.miio) { this.miio.destroy(); } @@ -172,6 +174,18 @@ class MiRobotDevice extends Homey.Device { getData(); }, 1000 * interval); } + + refreshDevice(interval) { + clearInterval(this.refreshInterval); + + this.refreshInterval = setInterval(() => { + this.miio.destroy(); + + setTimeout(() => { + this.createDevice(); + }, 2000); + }, 300000); + } } module.exports = MiRobotDevice; diff --git a/drivers/philips-bulb/device.js b/drivers/philips-bulb/device.js index 7e6194e..1e7860d 100644 --- a/drivers/philips-bulb/device.js +++ b/drivers/philips-bulb/device.js @@ -8,6 +8,8 @@ class PhilipsBulbDevice extends Homey.Device { onInit() { this.createDevice(); + setTimeout(() => { this.refreshDevice(); }, 600000); + this.setUnavailable(Homey.__('unreachable')); // LISTENERS FOR UPDATING CAPABILITIES @@ -48,6 +50,7 @@ class PhilipsBulbDevice extends Homey.Device { onDeleted() { clearInterval(this.pollingInterval); + clearInterval(this.refreshInterval); if (this.miio ) { this.miio.destroy(); } @@ -114,6 +117,17 @@ class PhilipsBulbDevice extends Homey.Device { }, 1000 * interval); } + refreshDevice(interval) { + clearInterval(this.refreshInterval); + + this.refreshInterval = setInterval(() => { + this.miio.destroy(); + + setTimeout(() => { + this.createDevice(); + }, 2000); + }, 300000); + } } module.exports = PhilipsBulbDevice; diff --git a/drivers/philips-eyecare/device.js b/drivers/philips-eyecare/device.js index 76ead2e..d5c5166 100644 --- a/drivers/philips-eyecare/device.js +++ b/drivers/philips-eyecare/device.js @@ -8,6 +8,7 @@ class PhilipsEyecareDevice extends Homey.Device { onInit() { this.createDevice(); + setTimeout(() => { this.refreshDevice(); }, 600000); // LISTENERS FOR UPDATING CAPABILITIES this.registerCapabilityListener('onoff', (value, opts) => { @@ -34,6 +35,7 @@ class PhilipsEyecareDevice extends Homey.Device { onDeleted() { clearInterval(this.pollingInterval); + clearInterval(this.refreshInterval); if (this.miio ) { this.miio.destroy(); } @@ -100,6 +102,18 @@ class PhilipsEyecareDevice extends Homey.Device { getData(); }, 1000 * interval); } + + refreshDevice(interval) { + clearInterval(this.refreshInterval); + + this.refreshInterval = setInterval(() => { + this.miio.destroy(); + + setTimeout(() => { + this.createDevice(); + }, 2000); + }, 300000); + } } module.exports = PhilipsEyecareDevice; diff --git a/drivers/zhimi-fan/device.js b/drivers/zhimi-fan/device.js index 874d562..21cb24d 100644 --- a/drivers/zhimi-fan/device.js +++ b/drivers/zhimi-fan/device.js @@ -7,6 +7,8 @@ class ZhiMiFanDevice extends Homey.Device { onInit() { this.createDevice(); + setTimeout(() => { this.refreshDevice(); }, 600000); + this.setUnavailable(Homey.__('unreachable')); // LISTENERS FOR UPDATING CAPABILITIES @@ -19,11 +21,11 @@ class ZhiMiFanDevice extends Homey.Device { return Promise.reject('Device unreachable, please try again ...'); } }); - } onDeleted() { clearInterval(this.pollingInterval); + clearInterval(this.refreshInterval); if (this.miio) { this.miio.destroy(); } @@ -97,6 +99,18 @@ class ZhiMiFanDevice extends Homey.Device { }); }, 1000 * interval); } + + refreshDevice(interval) { + clearInterval(this.refreshInterval); + + this.refreshInterval = setInterval(() => { + this.miio.destroy(); + + setTimeout(() => { + this.createDevice(); + }, 2000); + }, 300000); + } } module.exports = ZhiMiFanDevice; diff --git a/package-lock.json b/package-lock.json index 4132c18..4ba862f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "com.xiaomi-miio", - "version": "2.13.1", + "version": "2.13.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 5794f2f..2edd3b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.xiaomi-miio", - "version": "2.13.2", + "version": "2.13.3", "description": "Xiaomi Mi Home", "main": "app.js", "dependencies": {