diff --git a/APPSTORE.md b/APPSTORE.md index 920ecd0..d867163 100644 --- a/APPSTORE.md +++ b/APPSTORE.md @@ -27,6 +27,10 @@ For Homey to be able to communicate with devices over the miIO protocol a unique Xiaomi has recently released an update for its v1 vacuum that enabled it for the zoned cleaning and goto function that was previously only available to the v2 vacuum. 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 +### 2018-09-09 - v2.8.3 +* FIX: fixed a bug with powered on|off condition cards for the air purifier and humidifier +* FIX: better error handling when miio device can not connect + ### 2018-09-05 - v2.8.2 * FIX: fixed bug with return to dock action card for Vacuum Cleaner * FIX: fixed where the Vacuum Cleaner always shows as charging even thought the battery is full diff --git a/app.js b/app.js index f9c1fb6..5936d57 100644 --- a/app.js +++ b/app.js @@ -96,7 +96,7 @@ class XiaomiMiioApp extends Homey.App { new Homey.FlowCardCondition('poweredAirpurifier') .register() .registerRunListener((args, state) => { - if (args.device.setCapabilityValue('onoff')) { + if (args.device.getCapabilityValue('onoff')) { return Promise.resolve(true); } else { return Promise.reject(false); @@ -144,7 +144,7 @@ class XiaomiMiioApp extends Homey.App { new Homey.FlowCardCondition('poweredHumidifier') .register() .registerRunListener((args, state) => { - if (args.device.setCapabilityValue('onoff')) { + if (args.device.getCapabilityValue('onoff')) { return Promise.resolve(true); } else { return Promise.reject(false); diff --git a/app.json b/app.json index 036baa9..11da7da 100644 --- a/app.json +++ b/app.json @@ -9,7 +9,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.8.2", + "version": "2.8.3", "compatibility": "1.x >=1.5.0", "author": { "name": "Jelger Haanstra", diff --git a/drivers/air-monitor/device.js b/drivers/air-monitor/device.js index 20d1e17..a49f17d 100644 --- a/drivers/air-monitor/device.js +++ b/drivers/air-monitor/device.js @@ -36,8 +36,12 @@ class MiAirMonitorDevice extends Homey.Device { var interval = this.getSetting('polling') || 60; this.pollDevice(interval); - }).catch(function (error) { + }).catch((error) => { this.log(error); + this.setUnavailable(Homey.__('unreachable')); + setTimeout(() => { + this.createDevice(); + }, 10000); }); } diff --git a/drivers/gateway/device.js b/drivers/gateway/device.js index bc19e73..9aa527e 100644 --- a/drivers/gateway/device.js +++ b/drivers/gateway/device.js @@ -94,8 +94,12 @@ class GatewayDevice extends Homey.Device { var interval = this.getSetting('polling') || 60; this.pollDevice(interval); - }).catch(function (error) { + }).catch((error) => { this.log(error); + this.setUnavailable(Homey.__('unreachable')); + setTimeout(() => { + this.createDevice(); + }, 10000); }); } diff --git a/drivers/mi-airpurifier/device.js b/drivers/mi-airpurifier/device.js index e90779e..a5441d3 100644 --- a/drivers/mi-airpurifier/device.js +++ b/drivers/mi-airpurifier/device.js @@ -36,8 +36,12 @@ class MiAirPurifierDevice extends Homey.Device { var interval = this.getSetting('polling') || 60; this.pollDevice(interval); - }).catch(function (error) { + }).catch((error) => { this.log(error); + this.setUnavailable(Homey.__('unreachable')); + setTimeout(() => { + this.createDevice(); + }, 10000); }); } diff --git a/drivers/mi-humidifier/device.js b/drivers/mi-humidifier/device.js index 67469d6..58cdc0c 100644 --- a/drivers/mi-humidifier/device.js +++ b/drivers/mi-humidifier/device.js @@ -36,8 +36,12 @@ class MiHumidifierDevice extends Homey.Device { var interval = this.getSetting('polling') || 60; this.pollDevice(interval); - }).catch(function (error) { + }).catch((error) => { this.log(error); + this.setUnavailable(Homey.__('unreachable')); + setTimeout(() => { + this.createDevice(); + }, 10000); }); } diff --git a/drivers/mi-power-plug/device.js b/drivers/mi-power-plug/device.js index 82399a2..53926ec 100644 --- a/drivers/mi-power-plug/device.js +++ b/drivers/mi-power-plug/device.js @@ -35,8 +35,12 @@ class PowerPlugDevice extends Homey.Device { var interval = this.getSetting('polling') || 30; this.pollDevice(interval); - }).catch(function (error) { + }).catch((error) => { this.log(error); + this.setUnavailable(Homey.__('unreachable')); + setTimeout(() => { + this.createDevice(); + }, 10000); }); } diff --git a/drivers/mi-power-strip/device.js b/drivers/mi-power-strip/device.js index 6141186..75d142f 100644 --- a/drivers/mi-power-strip/device.js +++ b/drivers/mi-power-strip/device.js @@ -35,8 +35,12 @@ class PowerStripDevice extends Homey.Device { var interval = this.getSetting('polling') || 30; this.pollDevice(interval); - }).catch(function (error) { + }).catch((error) => { this.log(error); + this.setUnavailable(Homey.__('unreachable')); + setTimeout(() => { + this.createDevice(); + }, 10000); }); } diff --git a/drivers/mi-robot/device.js b/drivers/mi-robot/device.js index 39def29..61f10e9 100644 --- a/drivers/mi-robot/device.js +++ b/drivers/mi-robot/device.js @@ -95,8 +95,12 @@ class MiRobotDevice extends Homey.Device { var interval = this.getSetting('polling') || 60; this.pollDevice(interval); - }).catch(function (error) { + }).catch((error) => { this.log(error); + this.setUnavailable(Homey.__('unreachable')); + setTimeout(() => { + this.createDevice(); + }, 10000); }); } diff --git a/drivers/philips-bulb/device.js b/drivers/philips-bulb/device.js index 719b203..3047413 100644 --- a/drivers/philips-bulb/device.js +++ b/drivers/philips-bulb/device.js @@ -61,8 +61,12 @@ class PhilipsBulbDevice extends Homey.Device { var interval = this.getSetting('polling') || 60; this.pollDevice(interval); - }).catch(function (error) { + }).catch((error) => { this.log(error); + this.setUnavailable(Homey.__('unreachable')); + setTimeout(() => { + this.createDevice(); + }, 10000); }); } diff --git a/package.json b/package.json index dcd14e5..e767ffd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.xiaomi-miio", - "version": "2.8.2", + "version": "2.8.3", "description": "Xiaomi Mi Home", "main": "app.js", "dependencies": {