From 55c2016b419bd4bb2b3f49804e79d93592df6be2 Mon Sep 17 00:00:00 2001 From: Maxmudjon Date: Sun, 25 Oct 2020 05:32:08 +0500 Subject: [PATCH] v1.1.8 added Air Fresh VA4 and Aqara D1 Wirelles Switches --- drivers/ctrl_ln2.aq1/driver.js | 20 +++++++++---------- drivers/db86_switch_advanced/driver.js | 12 +++++------ drivers/sb86_switch/driver.js | 12 +++++------ node_modules/mimorelinks/libs/DeviceParser.js | 4 +++- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/drivers/ctrl_ln2.aq1/driver.js b/drivers/ctrl_ln2.aq1/driver.js index 3b4feeb..d7fd60d 100644 --- a/drivers/ctrl_ln2.aq1/driver.js +++ b/drivers/ctrl_ln2.aq1/driver.js @@ -4,29 +4,29 @@ const model = ["ctrl_ln2.aq1", "switch_b2nacn02"]; const initToggleFlowTriggers = (on, off, toggle) => ({ on: new Homey.FlowCardTriggerDevice(on).register(), off: new Homey.FlowCardTriggerDevice(off).register(), - toggle: new Homey.FlowCardTriggerDevice(toggle).register() + toggle: new Homey.FlowCardTriggerDevice(toggle).register(), }); -const initFlowCondition = name => new Homey.FlowCardCondition(name).register(); +const initFlowCondition = (name) => new Homey.FlowCardCondition(name).register(); const initToggleFlowAction = (on, off) => ({ on: new Homey.FlowCardAction(on).register(), - off: new Homey.FlowCardAction(off).register() + off: new Homey.FlowCardAction(off).register(), }); class DoubleSwitchLN extends Homey.Driver { onInit() { this.triggers = { left_switch: initToggleFlowTriggers("left_switch_on", "left_switch_off", "left_switch_toggle"), - right_switch: initToggleFlowTriggers("right_switch_on", "right_switch_off", "right_switch_toggle") + right_switch: initToggleFlowTriggers("right_switch_on", "right_switch_off", "right_switch_toggle"), }; this.conditions = { left_switch: initFlowCondition("left_switch_active"), - right_switch: initFlowCondition("right_switch_active") + right_switch: initFlowCondition("right_switch_active"), }; this.actions = { left_switch: initToggleFlowAction("left_switch_on", "left_switch_off"), - right_switch: initToggleFlowAction("right_switch_on", "right_switch_off") + right_switch: initToggleFlowAction("right_switch_on", "right_switch_off"), }; } @@ -34,15 +34,15 @@ class DoubleSwitchLN extends Homey.Driver { if (Homey.app.mihub.hubs) { Homey.app.mihub .getDevicesByModel(model) - .then(devices => + .then((devices) => callback( null, - devices.map(device => { + devices.map((device) => { return { name: device.name + " | " + device.sid, data: { - sid: device.sid - } + sid: device.sid, + }, }; }) ) diff --git a/drivers/db86_switch_advanced/driver.js b/drivers/db86_switch_advanced/driver.js index 4c610f4..98a5f79 100644 --- a/drivers/db86_switch_advanced/driver.js +++ b/drivers/db86_switch_advanced/driver.js @@ -1,5 +1,5 @@ const Homey = require("homey"); -const model = ["remote.b286acn01"]; +const model = ["remote.b286acn01", "lumi.remote.b286acn02", "remote.b286acn02"]; class DoubleButton86SwitchAdvanced extends Homey.Driver { onInit() { @@ -10,7 +10,7 @@ class DoubleButton86SwitchAdvanced extends Homey.Driver { right_click: new Homey.FlowCardTriggerDevice("right_click_button_switch").register(), right_double_click: new Homey.FlowCardTriggerDevice("right_double_click_click_button_switch").register(), right_long_click_press: new Homey.FlowCardTriggerDevice("right_long_click_press_click_button_switch").register(), - both_click: new Homey.FlowCardTriggerDevice("both_click_click_press_click_button_switch").register() + both_click: new Homey.FlowCardTriggerDevice("both_click_click_press_click_button_switch").register(), }; } @@ -18,15 +18,15 @@ class DoubleButton86SwitchAdvanced extends Homey.Driver { if (Homey.app.mihub.hubs) { Homey.app.mihub .getDevicesByModel(model) - .then(devices => + .then((devices) => callback( null, - devices.map(device => { + devices.map((device) => { return { name: device.name + " | " + device.sid, data: { - sid: device.sid - } + sid: device.sid, + }, }; }) ) diff --git a/drivers/sb86_switch/driver.js b/drivers/sb86_switch/driver.js index b12fcc3..3314157 100644 --- a/drivers/sb86_switch/driver.js +++ b/drivers/sb86_switch/driver.js @@ -1,10 +1,10 @@ const Homey = require("homey"); -const model = ["86sw1"]; +const model = ["86sw1", "lumi.remote.b186acn02", "remote.b186acn02"]; class DoubleButton86Switch extends Homey.Driver { onInit() { this.triggers = { - click: new Homey.FlowCardTriggerDevice("click_sb86_switch").register() + click: new Homey.FlowCardTriggerDevice("click_sb86_switch").register(), }; } @@ -12,15 +12,15 @@ class DoubleButton86Switch extends Homey.Driver { if (Homey.app.mihub.hubs) { Homey.app.mihub .getDevicesByModel(model) - .then(devices => + .then((devices) => callback( null, - devices.map(device => { + devices.map((device) => { return { name: device.name + " | " + device.sid, data: { - sid: device.sid - } + sid: device.sid, + }, }; }) ) diff --git a/node_modules/mimorelinks/libs/DeviceParser.js b/node_modules/mimorelinks/libs/DeviceParser.js index 2e6622f..4531426 100644 --- a/node_modules/mimorelinks/libs/DeviceParser.js +++ b/node_modules/mimorelinks/libs/DeviceParser.js @@ -90,7 +90,9 @@ const DEVICE_MAP = { switch_b2lacn02: { name: "Aqara Wall Switch D1 (No Neutral, Double Rocker)", modelCode: "QBKG22LM" }, switch_b2nacn02: { name: "Aqara Wall Switch D1 (With Neutral, Double Rocker)", modelCode: "QBKG24LM" }, switch_l3acn3: { name: "Aqara Wall Switch D1 (No Neutral, Triple Rocker)", modelCode: "QBKG25LM" }, - switch_n3acn3: { name: "Aqara Wall Switch D1 (With Neutral, Triple Rocker)", modelCode: "QBKG26LM" } + switch_n3acn3: { name: "Aqara Wall Switch D1 (With Neutral, Triple Rocker)", modelCode: "QBKG26LM" }, + "remote.b186acn02": {name: "Aqara D1 Wirelles Single Switch", modelCode: "WXKG06LM" }, + "remote.b286acn02": {name: "Aqara D1 Wirelles Double Switch", modelCode: "WXKG07LM" } }; const STATUS = {