From 5af9259ccd4c17516c32174fe5000f6ca6993714 Mon Sep 17 00:00:00 2001 From: jghaanstra Date: Fri, 6 Apr 2018 17:58:03 +0200 Subject: [PATCH] Release 2.6.3 --- APPSTORE.md | 45 +++------------------------------- app.json | 35 ++++++++++++++++++++++++-- drivers/gateway/device.js | 8 ++++-- drivers/philips-bulb/device.js | 2 +- package.json | 2 +- 5 files changed, 45 insertions(+), 47 deletions(-) diff --git a/APPSTORE.md b/APPSTORE.md index a663427..23c7b62 100644 --- a/APPSTORE.md +++ b/APPSTORE.md @@ -23,45 +23,8 @@ This Homey app supports direct control for Yeelights. Before being able to add y ## 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. -## Supported Cards -### Yeelights -* Default flow cards for light capabilities class -* [ACTIONS] Change brightness over time, Temperature/brightness scene, Color/brightness scene, Custom command (advanced), Set default on state - -### Xiaomi Philips Light Bulbs -* Default flow cards for light capabilities class - -### Xiaomi Mi Robot Vacuumcleaner -* Default flow cards for vacuumcleaner_state capabilities class -* [ACTIONS] Find the robot, Set fanspeed - -### Xiaomi Mi Air Purifiers -* [CONDITIONS] Powered -* [ACTIONS] Power on/off, Set speed - -### Xiaomi Mi Humidifiers -* [CONDITIONS] Powered -* [ACTIONS] Power on/off, Set speed - -### Xiaomi Single Power Plug -* Default flow cards for on/off, measure power and meter power capabilities class - ## Changelog -### 2018-03-15 -- v2.6.2 -* NEW: add support for the Xiaomi Gateway Light - alarm not supported yet and subdevices are supported directly with the Xiaomi ZigBee app -* FIX: fix for pairing wizard Philips Light Bulbs -* FIX: small fix in Yeelights driver - -### 2018-03-04 -- v2.6.1 -* CHANGE: updated device class of Mi Power Plug and Mi Power Strip to "socket" (this require re-pairing of these devices) -* FIX: solved small device naming issue in pair wizard - -### 2018-02-18 -- v2.6.0 -* NEW: add support for PM2.5 sensor -* NEW: add basic support for WiFi power strips (power load and power consumed are not available for now) -* UPDATE: update miio library to 0.15.6 which fixes: - * Power and color temperature setting fixed for Philips Light Bulbs - * Refreshing of vacuumcleaner state after starting and stopping cleaning -* FIX: update vacuumcleaner state directly when using onoff capability -* FIX: fix flow cards not showing (un)succesful execution status -* FIX: possible fix for showing temperature for purifiers and humidifiers +### 2018-04-06 -- v2.6.3 +* UPDATE: changed device class from Xiaomi Gateway to light (repair if you want to use the light flow cards) +* NEW: added trigger card for changes in luminance for Xiaomi Gateway +* FIX: fixed an error with setting the light temperature for the Philips Bulbs diff --git a/app.json b/app.json index dab47f3..0474680 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.6.2", + "version": "2.6.3", "compatibility": "1.x >=1.5.0", "author": { "name": "Jelger Haanstra", @@ -674,7 +674,7 @@ "large": "drivers/gateway/assets/images/large.jpg", "small": "drivers/gateway/assets/images/small.jpg" }, - "class": "other", + "class": "light", "capabilities": [ "onoff", "dim", @@ -752,6 +752,37 @@ } ], "flow": { + "triggers": [ + { + "id": "gatewayLuminance", + "title": { + "en": "Luminance has changed", + "nl": "De helderheid is veranderd" + }, + "tokens": [ + { + "name": "luminance", + "type": "number", + "title": { + "en": "luminance", + "nl": "helderheid" + }, + "example": 0 + } + ], + "args": [ + { + "name": "device", + "type": "device", + "placeholder": { + "en": "Select Gateway", + "nl": "Selecteer Gateway" + }, + "filter": "driver_id=gateway" + } + ] + } + ], "conditions": [ { "id": "poweredAirpurifier", diff --git a/drivers/gateway/device.js b/drivers/gateway/device.js index ca6b810..9040c86 100644 --- a/drivers/gateway/device.js +++ b/drivers/gateway/device.js @@ -8,6 +8,8 @@ const tinycolor = require("tinycolor2"); class GatewayDevice extends Homey.Device { onInit() { + new Homey.FlowCardTriggerDevice('gatewayLuminance').register(); + this.createDevice(); this.registerCapabilityListener('onoff', this.onCapabilityOnoff.bind(this)); @@ -65,9 +67,11 @@ class GatewayDevice extends Homey.Device { this.miio = miiodevice; this.miio.light = miiodevice.child('light'); - miiodevice.on('illuminanceChanged', illuminance => { + this.miio.on('illuminanceChanged', illuminance => { + console.log(illuminance); if (this.getCapabilityValue('measure_luminance') != illuminance.value) { this.setCapabilityValue('measure_luminance', illuminance.value); + Homey.ManagerFlow.getCard('trigger', 'gatewayLuminance').trigger(this, {luminance: illuminance.value}, {}) } }); @@ -100,7 +104,7 @@ class GatewayDevice extends Homey.Device { const getData = async () => { try { const power = await this.miio.light.power(); - const brightness = await this.miio.light.brightness() + const brightness = await this.miio.light.brightness(); if (this.getCapabilityValue('onoff') != power) { this.setCapabilityValue('onoff', power); diff --git a/drivers/philips-bulb/device.js b/drivers/philips-bulb/device.js index 016c453..58a4da1 100644 --- a/drivers/philips-bulb/device.js +++ b/drivers/philips-bulb/device.js @@ -36,7 +36,7 @@ class PhilipsBulbDevice extends Homey.Device { onCapabilityLightTemperature(value, opts, callback) { var colorvalue = util.denormalize(value, 3000, 5700); var colortemp = ''+ colorvalue +'K'; - device.color(colortemp) + this.miio.color(colortemp) .then(result => { callback(null, value) }) .catch(error => { callback(error, false) }); } diff --git a/package.json b/package.json index 99311c5..f300fcf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.xiaomi-miio", - "version": "2.6.2", + "version": "2.6.3", "description": "Xiaomi Mi Home", "main": "app.js", "dependencies": {