node-miio 0.14.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +25 -0
- package/README.md +5 -6
- package/dist/lib/connect_to_device.d.ts +2 -2
- package/dist/lib/device.d.ts +36 -60
- package/dist/lib/device.js +81 -24
- package/dist/lib/device.js.map +1 -1
- package/dist/lib/device_info.d.ts +1 -1
- package/dist/lib/device_info.js.map +1 -1
- package/dist/lib/devices/air-monitor.d.ts +8 -2
- package/dist/lib/devices/air-monitor.js +6 -3
- package/dist/lib/devices/air-monitor.js.map +1 -1
- package/dist/lib/devices/air-purifier.d.ts +14 -6
- package/dist/lib/devices/air-purifier.js +7 -2
- package/dist/lib/devices/air-purifier.js.map +1 -1
- package/dist/lib/devices/capabilities/battery-level.d.ts +5 -22
- package/dist/lib/devices/capabilities/battery-level.js +6 -5
- package/dist/lib/devices/capabilities/battery-level.js.map +1 -1
- package/dist/lib/devices/capabilities/buzzer.d.ts +24 -30
- package/dist/lib/devices/capabilities/buzzer.js +32 -49
- package/dist/lib/devices/capabilities/buzzer.js.map +1 -1
- package/dist/lib/devices/capabilities/changeable-led-brightness.d.ts +13 -29
- package/dist/lib/devices/capabilities/changeable-led-brightness.js +16 -24
- package/dist/lib/devices/capabilities/changeable-led-brightness.js.map +1 -1
- package/dist/lib/devices/capabilities/colorable.d.ts +5 -21
- package/dist/lib/devices/capabilities/colorable.js +6 -6
- package/dist/lib/devices/capabilities/colorable.js.map +1 -1
- package/dist/lib/devices/capabilities/device_capability.d.ts +7 -0
- package/dist/lib/devices/capabilities/device_capability.js +10 -0
- package/dist/lib/devices/capabilities/device_capability.js.map +1 -0
- package/dist/lib/devices/capabilities/dimmable.d.ts +5 -21
- package/dist/lib/devices/capabilities/dimmable.js +6 -6
- package/dist/lib/devices/capabilities/dimmable.js.map +1 -1
- package/dist/lib/devices/capabilities/mode.d.ts +5 -21
- package/dist/lib/devices/capabilities/mode.js +6 -5
- package/dist/lib/devices/capabilities/mode.js.map +1 -1
- package/dist/lib/devices/capabilities/power.d.ts +5 -21
- package/dist/lib/devices/capabilities/power.js +6 -5
- package/dist/lib/devices/capabilities/power.js.map +1 -1
- package/dist/lib/devices/capabilities/sensor.d.ts +29 -15
- package/dist/lib/devices/capabilities/sensor.js +56 -41
- package/dist/lib/devices/capabilities/sensor.js.map +1 -1
- package/dist/lib/devices/capabilities/switchable-led.d.ts +13 -29
- package/dist/lib/devices/capabilities/switchable-led.js +18 -30
- package/dist/lib/devices/capabilities/switchable-led.js.map +1 -1
- package/dist/lib/devices/chuangmi.plug.v1.d.ts +10 -29
- package/dist/lib/devices/chuangmi.plug.v1.js +39 -31
- package/dist/lib/devices/chuangmi.plug.v1.js.map +1 -1
- package/dist/lib/devices/eyecare-lamp2.d.ts +29 -59
- package/dist/lib/devices/eyecare-lamp2.js +49 -38
- package/dist/lib/devices/eyecare-lamp2.js.map +1 -1
- package/dist/lib/devices/gateway/controllers.d.ts +60 -0
- package/dist/lib/devices/gateway/controllers.js +137 -0
- package/dist/lib/devices/gateway/controllers.js.map +1 -0
- package/dist/lib/devices/gateway/ctrl_ln1.d.ts +5 -7
- package/dist/lib/devices/gateway/ctrl_ln1.js +8 -33
- package/dist/lib/devices/gateway/ctrl_ln1.js.map +1 -1
- package/dist/lib/devices/gateway/ctrl_ln2.d.ts +5 -7
- package/dist/lib/devices/gateway/ctrl_ln2.js +8 -41
- package/dist/lib/devices/gateway/ctrl_ln2.js.map +1 -1
- package/dist/lib/devices/gateway/ctrl_neutral1.d.ts +5 -7
- package/dist/lib/devices/gateway/ctrl_neutral1.js +8 -33
- package/dist/lib/devices/gateway/ctrl_neutral1.js.map +1 -1
- package/dist/lib/devices/gateway/ctrl_neutral2.d.ts +5 -7
- package/dist/lib/devices/gateway/ctrl_neutral2.js +8 -41
- package/dist/lib/devices/gateway/ctrl_neutral2.js.map +1 -1
- package/dist/lib/devices/gateway/gateway-light.d.ts +27 -0
- package/dist/lib/devices/gateway/gateway-light.js +64 -0
- package/dist/lib/devices/gateway/gateway-light.js.map +1 -0
- package/dist/lib/devices/gateway/light-channel.d.ts +29 -7
- package/dist/lib/devices/gateway/light-channel.js +58 -8
- package/dist/lib/devices/gateway/light-channel.js.map +1 -1
- package/dist/lib/devices/gateway/plug.d.ts +10 -5
- package/dist/lib/devices/gateway/plug.js +16 -12
- package/dist/lib/devices/gateway/plug.js.map +1 -1
- package/dist/lib/devices/gateway/sensors.d.ts +37 -0
- package/dist/lib/devices/gateway/sensors.js +86 -0
- package/dist/lib/devices/gateway/sensors.js.map +1 -0
- package/dist/lib/devices/gateway/subdevice.d.ts +80 -60
- package/dist/lib/devices/gateway/subdevice.js +112 -127
- package/dist/lib/devices/gateway/subdevice.js.map +1 -1
- package/dist/lib/devices/gateway/subdevices.d.ts +6 -49
- package/dist/lib/devices/gateway/subdevices.js +27 -15
- package/dist/lib/devices/gateway/subdevices.js.map +1 -1
- package/dist/lib/devices/gateway/voltage.d.ts +8 -23
- package/dist/lib/devices/gateway/voltage.js +11 -12
- package/dist/lib/devices/gateway/voltage.js.map +1 -1
- package/dist/lib/devices/gateway.d.ts +61 -67
- package/dist/lib/devices/gateway.js +127 -111
- package/dist/lib/devices/gateway.js.map +1 -1
- package/dist/lib/devices/humidifier.d.ts +23 -10
- package/dist/lib/devices/humidifier.js +33 -36
- package/dist/lib/devices/humidifier.js.map +1 -1
- package/dist/lib/devices/philips-light-bulb.d.ts +14 -6
- package/dist/lib/devices/philips-light-bulb.js +23 -21
- package/dist/lib/devices/philips-light-bulb.js.map +1 -1
- package/dist/lib/devices/power-plug.d.ts +9 -28
- package/dist/lib/devices/power-plug.js +15 -8
- package/dist/lib/devices/power-plug.js.map +1 -1
- package/dist/lib/devices/power-strip.d.ts +11 -5
- package/dist/lib/devices/power-strip.js +17 -9
- package/dist/lib/devices/power-strip.js.map +1 -1
- package/dist/lib/devices/vacuums/dreamevacuum.d.ts +3 -24
- package/dist/lib/devices/vacuums/dreamevacuum.js +4 -5
- package/dist/lib/devices/vacuums/dreamevacuum.js.map +1 -1
- package/dist/lib/devices/vacuums/miot-vacuum.d.ts +3 -27
- package/dist/lib/devices/vacuums/miot-vacuum.js +3 -6
- package/dist/lib/devices/vacuums/miot-vacuum.js.map +1 -1
- package/dist/lib/devices/vacuums/vacuum.d.ts +6 -26
- package/dist/lib/devices/vacuums/vacuum.js +13 -8
- package/dist/lib/devices/vacuums/vacuum.js.map +1 -1
- package/dist/lib/devices/vacuums/vacuum_device.d.ts +1 -1
- package/dist/lib/devices/vacuums/vacuum_device.js +3 -3
- package/dist/lib/devices/vacuums/vacuum_device.js.map +1 -1
- package/dist/lib/devices/vacuums/vacuum_errors.d.ts +4 -3
- package/dist/lib/devices/vacuums/vacuum_errors.js +5 -7
- package/dist/lib/devices/vacuums/vacuum_errors.js.map +1 -1
- package/dist/lib/devices/vacuums/vacuum_thing.d.ts +13 -0
- package/dist/lib/devices/vacuums/vacuum_thing.js +19 -0
- package/dist/lib/devices/vacuums/vacuum_thing.js.map +1 -0
- package/dist/lib/devices/vacuums/viomivacuum.d.ts +3 -24
- package/dist/lib/devices/vacuums/viomivacuum.js +4 -5
- package/dist/lib/devices/vacuums/viomivacuum.js.map +1 -1
- package/dist/lib/devices/yeelight.color.d.ts +13 -2
- package/dist/lib/devices/yeelight.color.js +101 -3
- package/dist/lib/devices/yeelight.color.js.map +1 -1
- package/dist/lib/devices/yeelight.d.ts +36 -154
- package/dist/lib/devices/yeelight.js +36 -144
- package/dist/lib/devices/yeelight.js.map +1 -1
- package/dist/lib/devices/yeelight.mono.d.ts +13 -2
- package/dist/lib/devices/yeelight.mono.js +34 -3
- package/dist/lib/devices/yeelight.mono.js.map +1 -1
- package/dist/lib/discovery.js +2 -2
- package/dist/lib/discovery.js.map +1 -1
- package/dist/lib/events.d.ts +1 -1
- package/dist/lib/index.d.ts +0 -5
- package/dist/lib/models.d.ts +26 -239
- package/dist/lib/models.js +26 -29
- package/dist/lib/models.js.map +1 -1
- package/dist/lib/protocol.d.ts +10 -2
- package/dist/lib/things/capabilities/actions.d.ts +21 -0
- package/dist/lib/things/capabilities/actions.js +36 -0
- package/dist/lib/things/capabilities/actions.js.map +1 -0
- package/dist/lib/things/capabilities/battery-level.d.ts +13 -0
- package/dist/lib/things/capabilities/battery-level.js +26 -0
- package/dist/lib/things/capabilities/battery-level.js.map +1 -0
- package/dist/lib/things/capabilities/charging.d.ts +20 -0
- package/dist/lib/things/capabilities/charging.js +40 -0
- package/dist/lib/things/capabilities/charging.js.map +1 -0
- package/dist/lib/things/capabilities/children.d.ts +78 -0
- package/dist/lib/things/capabilities/children.js +173 -0
- package/dist/lib/things/capabilities/children.js.map +1 -0
- package/dist/lib/things/capabilities/cleaning.d.ts +40 -0
- package/dist/lib/things/capabilities/cleaning.js +85 -0
- package/dist/lib/things/capabilities/cleaning.js.map +1 -0
- package/dist/lib/things/capabilities/error-state.d.ts +15 -0
- package/dist/lib/things/capabilities/error-state.js +33 -0
- package/dist/lib/things/capabilities/error-state.js.map +1 -0
- package/dist/lib/things/capabilities/fan-speed.d.ts +36 -0
- package/dist/lib/things/capabilities/fan-speed.js +59 -0
- package/dist/lib/things/capabilities/fan-speed.js.map +1 -0
- package/dist/lib/things/capabilities/index.d.ts +14 -0
- package/dist/lib/things/capabilities/index.js +31 -0
- package/dist/lib/things/capabilities/index.js.map +1 -0
- package/dist/lib/things/capabilities/lights/brightness.d.ts +44 -0
- package/dist/lib/things/capabilities/lights/brightness.js +87 -0
- package/dist/lib/things/capabilities/lights/brightness.js.map +1 -0
- package/dist/lib/things/capabilities/lights/color-temperature.d.ts +21 -0
- package/dist/lib/things/capabilities/lights/color-temperature.js +43 -0
- package/dist/lib/things/capabilities/lights/color-temperature.js.map +1 -0
- package/dist/lib/things/capabilities/lights/colorable.d.ts +37 -0
- package/dist/lib/things/capabilities/lights/colorable.js +57 -0
- package/dist/lib/things/capabilities/lights/colorable.js.map +1 -0
- package/dist/lib/things/capabilities/lights/fading.d.ts +13 -0
- package/dist/lib/things/capabilities/lights/fading.js +23 -0
- package/dist/lib/things/capabilities/lights/fading.js.map +1 -0
- package/dist/lib/things/capabilities/lights/index.d.ts +5 -0
- package/dist/lib/things/capabilities/lights/index.js +22 -0
- package/dist/lib/things/capabilities/lights/index.js.map +1 -0
- package/dist/lib/things/capabilities/lights/light.d.ts +25 -0
- package/dist/lib/things/capabilities/lights/light.js +23 -0
- package/dist/lib/things/capabilities/lights/light.js.map +1 -0
- package/dist/lib/things/capabilities/mode.d.ts +45 -0
- package/dist/lib/things/capabilities/mode.js +75 -0
- package/dist/lib/things/capabilities/mode.js.map +1 -0
- package/dist/lib/things/capabilities/nameable.d.ts +18 -0
- package/dist/lib/things/capabilities/nameable.js +28 -0
- package/dist/lib/things/capabilities/nameable.js.map +1 -0
- package/dist/lib/things/capabilities/power.d.ts +40 -0
- package/dist/lib/things/capabilities/power.js +68 -0
- package/dist/lib/things/capabilities/power.js.map +1 -0
- package/dist/lib/things/capabilities/sensors.d.ts +91 -0
- package/dist/lib/things/capabilities/sensors.js +198 -0
- package/dist/lib/things/capabilities/sensors.js.map +1 -0
- package/dist/lib/things/capabilities/target-humidity.d.ts +36 -0
- package/dist/lib/things/capabilities/target-humidity.js +59 -0
- package/dist/lib/things/capabilities/target-humidity.js.map +1 -0
- package/dist/lib/things/capability.d.ts +24 -0
- package/dist/lib/things/capability.js +21 -0
- package/dist/lib/things/capability.js.map +1 -0
- package/dist/lib/things/color.d.ts +66 -0
- package/dist/lib/things/color.js +303 -0
- package/dist/lib/things/color.js.map +1 -0
- package/dist/lib/things/compose.d.ts +25 -0
- package/dist/lib/things/compose.js +105 -0
- package/dist/lib/things/compose.js.map +1 -0
- package/dist/lib/things/index.d.ts +14 -0
- package/dist/lib/things/index.js +39 -0
- package/dist/lib/things/index.js.map +1 -0
- package/dist/lib/things/registry.d.ts +19 -0
- package/dist/lib/things/registry.js +18 -0
- package/dist/lib/things/registry.js.map +1 -0
- package/dist/lib/things/thing.d.ts +110 -0
- package/dist/lib/things/thing.js +325 -0
- package/dist/lib/things/thing.js.map +1 -0
- package/dist/lib/things/values.d.ts +123 -0
- package/dist/lib/things/values.js +258 -0
- package/dist/lib/things/values.js.map +1 -0
- package/docs/devices/vacuum.md +1 -2
- package/package.json +4 -3
- package/snapshots/vacuum-specs.json.gz +0 -0
- package/dist/lib/devices/gateway/86sw1.d.ts +0 -7
- package/dist/lib/devices/gateway/86sw1.js +0 -20
- package/dist/lib/devices/gateway/86sw1.js.map +0 -1
- package/dist/lib/devices/gateway/86sw2.d.ts +0 -7
- package/dist/lib/devices/gateway/86sw2.js +0 -36
- package/dist/lib/devices/gateway/86sw2.js.map +0 -1
- package/dist/lib/devices/gateway/cube.d.ts +0 -6
- package/dist/lib/devices/gateway/cube.js +0 -49
- package/dist/lib/devices/gateway/cube.js.map +0 -1
- package/dist/lib/devices/gateway/light-mixin.d.ts +0 -2
- package/dist/lib/devices/gateway/light-mixin.js +0 -59
- package/dist/lib/devices/gateway/light-mixin.js.map +0 -1
- package/dist/lib/devices/gateway/magnet.d.ts +0 -6
- package/dist/lib/devices/gateway/magnet.js +0 -23
- package/dist/lib/devices/gateway/magnet.js.map +0 -1
- package/dist/lib/devices/gateway/magnet2.d.ts +0 -5
- package/dist/lib/devices/gateway/magnet2.js +0 -9
- package/dist/lib/devices/gateway/magnet2.js.map +0 -1
- package/dist/lib/devices/gateway/motion.d.ts +0 -6
- package/dist/lib/devices/gateway/motion.js +0 -21
- package/dist/lib/devices/gateway/motion.js.map +0 -1
- package/dist/lib/devices/gateway/motion2.d.ts +0 -6
- package/dist/lib/devices/gateway/motion2.js +0 -25
- package/dist/lib/devices/gateway/motion2.js.map +0 -1
- package/dist/lib/devices/gateway/sensor_ht.d.ts +0 -5
- package/dist/lib/devices/gateway/sensor_ht.js +0 -13
- package/dist/lib/devices/gateway/sensor_ht.js.map +0 -1
- package/dist/lib/devices/gateway/switch.d.ts +0 -6
- package/dist/lib/devices/gateway/switch.js +0 -24
- package/dist/lib/devices/gateway/switch.js.map +0 -1
- package/dist/lib/devices/gateway/switch2.d.ts +0 -6
- package/dist/lib/devices/gateway/switch2.js +0 -19
- package/dist/lib/devices/gateway/switch2.js.map +0 -1
- package/dist/lib/devices/gateway/weather.d.ts +0 -5
- package/dist/lib/devices/gateway/weather.js +0 -16
- package/dist/lib/devices/gateway/weather.js.map +0 -1
- package/dist/types/abstract-things/climate/index.d.ts +0 -431
- package/dist/types/abstract-things/electricals/index.d.ts +0 -5
- package/dist/types/abstract-things/index.d.ts +0 -206
- package/dist/types/abstract-things/lights/index.d.ts +0 -14
- package/dist/types/abstract-things/values/index.d.ts +0 -12
|
@@ -1,20 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EyecareLamp2 = void 0;
|
|
4
|
+
const device_1 = require("../device");
|
|
5
|
+
const compose_1 = require("../things/compose");
|
|
6
|
+
const thing_1 = require("../things/thing");
|
|
7
|
+
const children_1 = require("../things/capabilities/children");
|
|
8
|
+
const power_1 = require("../things/capabilities/power");
|
|
9
|
+
const light_1 = require("../things/capabilities/lights/light");
|
|
10
|
+
const brightness_1 = require("../things/capabilities/lights/brightness");
|
|
11
|
+
const values_1 = require("../things/values");
|
|
12
|
+
const dimmable_1 = require("./capabilities/dimmable");
|
|
13
|
+
const power_2 = require("./capabilities/power");
|
|
14
|
+
/** The ambient (secondary) light of the lamp */
|
|
15
|
+
class AmbientLight extends (0, compose_1.compose)(thing_1.MiioThing, light_1.Light, brightness_1.Dimmable, power_1.SwitchablePower) {
|
|
16
|
+
parent;
|
|
17
|
+
constructor(parent) {
|
|
18
|
+
super();
|
|
19
|
+
this.parent = parent;
|
|
20
|
+
this.id = parent.id + ":ambient";
|
|
21
|
+
}
|
|
22
|
+
changePower(power) {
|
|
23
|
+
return this.parent.setAmbientPower(power);
|
|
24
|
+
}
|
|
25
|
+
changeBrightness(brightness) {
|
|
26
|
+
return this.parent.setAmbientBrightness(brightness);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
class EyecareLamp2 extends (0, compose_1.compose)(device_1.MiioApi, light_1.Light, power_2.Power, dimmable_1.Dimmable, children_1.Children) {
|
|
30
|
+
static get type() {
|
|
31
|
+
return "miio:eyecare-lamp2";
|
|
32
|
+
}
|
|
33
|
+
ambient;
|
|
34
|
+
constructor(handle) {
|
|
35
|
+
super(handle);
|
|
11
36
|
this.defineProperty("power", {
|
|
12
37
|
name: "power",
|
|
13
38
|
mapper: (v) => v === "on",
|
|
14
39
|
});
|
|
15
40
|
this.defineProperty("bright", {
|
|
16
41
|
name: "brightness",
|
|
17
|
-
mapper: parseInt,
|
|
42
|
+
mapper: (v) => parseInt(v, 10),
|
|
18
43
|
});
|
|
19
44
|
// Get if the
|
|
20
45
|
this.defineProperty("notifystatus", {
|
|
@@ -29,7 +54,7 @@ module.exports = class EyecareLamp2 extends (Light.with(MiioPower, MiioDimmable,
|
|
|
29
54
|
// Brightness of the secondary light
|
|
30
55
|
this.defineProperty("ambvalue", {
|
|
31
56
|
name: "ambientBrightness",
|
|
32
|
-
mapper: parseInt,
|
|
57
|
+
mapper: (v) => parseInt(v, 10),
|
|
33
58
|
});
|
|
34
59
|
// If the main light is on
|
|
35
60
|
this.defineProperty("eyecare", {
|
|
@@ -50,14 +75,13 @@ module.exports = class EyecareLamp2 extends (Light.with(MiioPower, MiioDimmable,
|
|
|
50
75
|
}
|
|
51
76
|
},
|
|
52
77
|
});
|
|
53
|
-
this.setModes(["study", "reading", "phone"]);
|
|
54
78
|
this.defineProperty("bls", {
|
|
55
79
|
name: "bls",
|
|
56
80
|
mapper: (v) => v === "on",
|
|
57
81
|
});
|
|
58
82
|
this.defineProperty("dvalue", {
|
|
59
83
|
name: "dvalue",
|
|
60
|
-
mapper: parseInt,
|
|
84
|
+
mapper: (v) => parseInt(v, 10),
|
|
61
85
|
});
|
|
62
86
|
this.ambient = new AmbientLight(this);
|
|
63
87
|
this.addChild(this.ambient);
|
|
@@ -70,8 +94,7 @@ module.exports = class EyecareLamp2 extends (Light.with(MiioPower, MiioDimmable,
|
|
|
70
94
|
changeBrightness(brightness) {
|
|
71
95
|
return this.call("set_bright", [brightness], {
|
|
72
96
|
refresh: true,
|
|
73
|
-
|
|
74
|
-
}).then(MiioApi.checkOk);
|
|
97
|
+
}).then(device_1.MiioApi.checkOk);
|
|
75
98
|
}
|
|
76
99
|
/**
|
|
77
100
|
* Is eyeCare active?
|
|
@@ -82,7 +105,7 @@ module.exports = class EyecareLamp2 extends (Light.with(MiioPower, MiioDimmable,
|
|
|
82
105
|
/**
|
|
83
106
|
* Enable the eyeCare
|
|
84
107
|
*
|
|
85
|
-
* @param
|
|
108
|
+
* @param enable Whether to enable it
|
|
86
109
|
*/
|
|
87
110
|
setEyeCare(enable) {
|
|
88
111
|
return this.call("set_eyecare", [enable ? "on" : "off"], {
|
|
@@ -113,18 +136,18 @@ module.exports = class EyecareLamp2 extends (Light.with(MiioPower, MiioDimmable,
|
|
|
113
136
|
}
|
|
114
137
|
*/
|
|
115
138
|
setAmbientPower(power) {
|
|
116
|
-
return
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
.then(MiioApi.checkOk));
|
|
139
|
+
return this.call("enable_amb", [power ? "on" : "off"], {
|
|
140
|
+
refresh: ["ambientPower"],
|
|
141
|
+
}).then(device_1.MiioApi.checkOk);
|
|
120
142
|
}
|
|
121
143
|
setAmbientBrightness(brightness) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
144
|
+
const value = (0, values_1.percentage)(brightness, { min: 0, max: 100 });
|
|
145
|
+
return this.call("set_amb_bright", [value], {
|
|
146
|
+
refresh: ["ambientBrightness"],
|
|
147
|
+
}).then(device_1.MiioApi.checkOk);
|
|
125
148
|
}
|
|
126
|
-
propertyUpdated(key, value) {
|
|
127
|
-
super.propertyUpdated(key, value);
|
|
149
|
+
propertyUpdated(key, value, oldValue) {
|
|
150
|
+
super.propertyUpdated(key, value, oldValue);
|
|
128
151
|
switch (key) {
|
|
129
152
|
case "ambientPower":
|
|
130
153
|
this.ambient.updatePower(value);
|
|
@@ -134,18 +157,6 @@ module.exports = class EyecareLamp2 extends (Light.with(MiioPower, MiioDimmable,
|
|
|
134
157
|
break;
|
|
135
158
|
}
|
|
136
159
|
}
|
|
137
|
-
};
|
|
138
|
-
class AmbientLight extends Light.with(Dimmable, SwitchablePower) {
|
|
139
|
-
constructor(parent) {
|
|
140
|
-
super();
|
|
141
|
-
this.parent = parent;
|
|
142
|
-
this.id = parent.id + ":ambient";
|
|
143
|
-
}
|
|
144
|
-
changePower(power) {
|
|
145
|
-
return this.parent.setAmbientPower(power);
|
|
146
|
-
}
|
|
147
|
-
changeBrightness(brightness) {
|
|
148
|
-
return this.parent.setAmbientBrightness(brightness);
|
|
149
|
-
}
|
|
150
160
|
}
|
|
161
|
+
exports.EyecareLamp2 = EyecareLamp2;
|
|
151
162
|
//# sourceMappingURL=eyecare-lamp2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eyecare-lamp2.js","sourceRoot":"","sources":["../../../src/lib/devices/eyecare-lamp2.
|
|
1
|
+
{"version":3,"file":"eyecare-lamp2.js","sourceRoot":"","sources":["../../../src/lib/devices/eyecare-lamp2.ts"],"names":[],"mappings":";;;AAAA,sCAAoC;AACpC,+CAA4C;AAC5C,2CAA4C;AAC5C,8DAA2D;AAC3D,wDAA+D;AAC/D,+DAA4D;AAC5D,yEAAoE;AACpE,6CAA8C;AAE9C,sDAAmE;AACnE,gDAA0D;AAE1D,gDAAgD;AAChD,MAAM,YAAa,SAAQ,IAAA,iBAAO,EAChC,iBAAS,EACT,aAAK,EACL,qBAAQ,EACR,uBAAe,CAChB;IAC8B;IAA7B,YAA6B,MAAoB;QAC/C,KAAK,EAAE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C;SAC/B,CAAC,CAAC,IAAI,CAAC,gBAAO,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED,eAAe,CAAC,GAAW,EAAE,KAAc,EAAE,QAAkB;QAC7D,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAE5C,QAAQ,GAAG,EAAE,CAAC;YACZ,KAAK,cAAc;gBACjB,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAgB,CAAC,CAAC;gBAC3C,MAAM;YACR,KAAK,mBAAmB;gBACtB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAe,CAAC,CAAC;gBAC/C,MAAM;QACV,CAAC;IACH,CAAC;CACF;AA/JD,oCA+JC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Actions } from "../../things/capabilities/actions";
|
|
2
|
+
import { SubDevice, type SubDeviceInfo, type SubDeviceParent } from "./subdevice";
|
|
3
|
+
import { VoltageBattery } from "./voltage";
|
|
4
|
+
declare const ActionSubDevice_base: typeof SubDevice & (abstract new (...args: any[]) => import("../../things/compose").Composed<typeof SubDevice, [typeof Actions]>);
|
|
5
|
+
/** Reports the actions of the sub-device (`emitAction`) for a key of the reported data */
|
|
6
|
+
declare abstract class ActionSubDevice extends ActionSubDevice_base {
|
|
7
|
+
/**
|
|
8
|
+
* @param parent The gateway
|
|
9
|
+
* @param info The sub-device
|
|
10
|
+
* @param model The model
|
|
11
|
+
* @param actions The supported actions
|
|
12
|
+
*/
|
|
13
|
+
constructor(parent: SubDeviceParent, info: SubDeviceInfo, model: string, actions: string[]);
|
|
14
|
+
/**
|
|
15
|
+
* Emits an action if the data reports it.
|
|
16
|
+
*
|
|
17
|
+
* @param value The reported value
|
|
18
|
+
* @param prefix A prefix for the action (e.g. the button)
|
|
19
|
+
*/
|
|
20
|
+
protected reportAction(value: unknown, prefix?: string): void;
|
|
21
|
+
}
|
|
22
|
+
/** Wireless wall switch with one button (`lumi.86sw1`) */
|
|
23
|
+
export declare class Switch1 extends ActionSubDevice {
|
|
24
|
+
static get types(): string[];
|
|
25
|
+
readonly type = "controller";
|
|
26
|
+
constructor(parent: SubDeviceParent, info: SubDeviceInfo);
|
|
27
|
+
_report(data: Record<string, unknown>): void;
|
|
28
|
+
}
|
|
29
|
+
/** Wireless wall switch with two buttons (`lumi.86sw2`) */
|
|
30
|
+
export declare class Switch2 extends ActionSubDevice {
|
|
31
|
+
static get types(): string[];
|
|
32
|
+
readonly type = "controller";
|
|
33
|
+
constructor(parent: SubDeviceParent, info: SubDeviceInfo);
|
|
34
|
+
_report(data: Record<string, unknown>): void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Cube controller (`lumi.cube`). Emits the actions: `alert` (woken up after being idle), `flip90`, `flip180`, `move`
|
|
38
|
+
* (slid on its surface), `tap_twice`, `shake_air`, `free_fall` and `rotate` (with the `amount`).
|
|
39
|
+
*/
|
|
40
|
+
export declare class Cube extends ActionSubDevice {
|
|
41
|
+
static get types(): string[];
|
|
42
|
+
constructor(parent: SubDeviceParent, info: SubDeviceInfo);
|
|
43
|
+
_report(data: Record<string, unknown>): void;
|
|
44
|
+
}
|
|
45
|
+
declare const Button_base: typeof ActionSubDevice & (abstract new (...args: any[]) => import("../../things/compose").Composed<typeof ActionSubDevice, [typeof VoltageBattery]>);
|
|
46
|
+
/** Wireless button, with a battery (`lumi.switch`, `lumi.switch.v2`) */
|
|
47
|
+
declare abstract class Button extends Button_base {
|
|
48
|
+
static get types(): string[];
|
|
49
|
+
constructor(parent: SubDeviceParent, info: SubDeviceInfo, model: string, actions: string[]);
|
|
50
|
+
_report(data: Record<string, unknown>): void;
|
|
51
|
+
}
|
|
52
|
+
/** Wireless button (`lumi.switch`) */
|
|
53
|
+
export declare class Switch extends Button {
|
|
54
|
+
constructor(parent: SubDeviceParent, info: SubDeviceInfo);
|
|
55
|
+
}
|
|
56
|
+
/** Aqara wireless button (`lumi.switch.v2`) */
|
|
57
|
+
export declare class SwitchV2 extends Button {
|
|
58
|
+
constructor(parent: SubDeviceParent, info: SubDeviceInfo);
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwitchV2 = exports.Switch = exports.Cube = exports.Switch2 = exports.Switch1 = void 0;
|
|
4
|
+
const compose_1 = require("../../things/compose");
|
|
5
|
+
const actions_1 = require("../../things/capabilities/actions");
|
|
6
|
+
const subdevice_1 = require("./subdevice");
|
|
7
|
+
const voltage_1 = require("./voltage");
|
|
8
|
+
/** Reports the actions of the sub-device (`emitAction`) for a key of the reported data */
|
|
9
|
+
class ActionSubDevice extends (0, compose_1.compose)(subdevice_1.SubDevice, actions_1.Actions) {
|
|
10
|
+
/**
|
|
11
|
+
* @param parent The gateway
|
|
12
|
+
* @param info The sub-device
|
|
13
|
+
* @param model The model
|
|
14
|
+
* @param actions The supported actions
|
|
15
|
+
*/
|
|
16
|
+
constructor(parent, info, model, actions) {
|
|
17
|
+
super(parent, info);
|
|
18
|
+
this.miioModel = model;
|
|
19
|
+
this.updateActions(actions);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Emits an action if the data reports it.
|
|
23
|
+
*
|
|
24
|
+
* @param value The reported value
|
|
25
|
+
* @param prefix A prefix for the action (e.g. the button)
|
|
26
|
+
*/
|
|
27
|
+
reportAction(value, prefix = "") {
|
|
28
|
+
if (value === undefined)
|
|
29
|
+
return;
|
|
30
|
+
const action = prefix + String(value);
|
|
31
|
+
this.debug("Action performed:", action);
|
|
32
|
+
this.emitAction(action);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** Wireless wall switch with one button (`lumi.86sw1`) */
|
|
36
|
+
class Switch1 extends ActionSubDevice {
|
|
37
|
+
static get types() {
|
|
38
|
+
return ["controller", "wall-controller"];
|
|
39
|
+
}
|
|
40
|
+
type = "controller";
|
|
41
|
+
constructor(parent, info) {
|
|
42
|
+
super(parent, info, "lumi.86sw1", ["click", "double_click"]);
|
|
43
|
+
}
|
|
44
|
+
_report(data) {
|
|
45
|
+
super._report(data);
|
|
46
|
+
this.reportAction(data["channel_0"]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.Switch1 = Switch1;
|
|
50
|
+
/** Wireless wall switch with two buttons (`lumi.86sw2`) */
|
|
51
|
+
class Switch2 extends ActionSubDevice {
|
|
52
|
+
static get types() {
|
|
53
|
+
return ["controller", "wall-controller"];
|
|
54
|
+
}
|
|
55
|
+
type = "controller";
|
|
56
|
+
constructor(parent, info) {
|
|
57
|
+
super(parent, info, "lumi.86sw2", [
|
|
58
|
+
"btn0-click",
|
|
59
|
+
"btn0-double_click",
|
|
60
|
+
"btn1-click",
|
|
61
|
+
"btn1-double_click",
|
|
62
|
+
"both_click",
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
65
|
+
_report(data) {
|
|
66
|
+
super._report(data);
|
|
67
|
+
this.reportAction(data["channel_0"], "btn0-");
|
|
68
|
+
this.reportAction(data["channel_1"], "btn1-");
|
|
69
|
+
this.reportAction(data["dual_channel"]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.Switch2 = Switch2;
|
|
73
|
+
/**
|
|
74
|
+
* Cube controller (`lumi.cube`). Emits the actions: `alert` (woken up after being idle), `flip90`, `flip180`, `move`
|
|
75
|
+
* (slid on its surface), `tap_twice`, `shake_air`, `free_fall` and `rotate` (with the `amount`).
|
|
76
|
+
*/
|
|
77
|
+
class Cube extends ActionSubDevice {
|
|
78
|
+
static get types() {
|
|
79
|
+
return ["controller"];
|
|
80
|
+
}
|
|
81
|
+
constructor(parent, info) {
|
|
82
|
+
super(parent, info, "lumi.cube", [
|
|
83
|
+
"alert",
|
|
84
|
+
"flip90",
|
|
85
|
+
"flip180",
|
|
86
|
+
"move",
|
|
87
|
+
"tap_twice",
|
|
88
|
+
"shake_air",
|
|
89
|
+
"free_fall",
|
|
90
|
+
"rotate",
|
|
91
|
+
]);
|
|
92
|
+
}
|
|
93
|
+
_report(data) {
|
|
94
|
+
super._report(data);
|
|
95
|
+
this.reportAction(data.status);
|
|
96
|
+
if (typeof data.rotate === "string") {
|
|
97
|
+
const amount = parseInt(data.rotate.substring(0, data.rotate.indexOf(",")), 10);
|
|
98
|
+
this.debug("Action performed:", "rotate", amount);
|
|
99
|
+
this.emitAction("rotate", { amount });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.Cube = Cube;
|
|
104
|
+
/** Wireless button, with a battery (`lumi.switch`, `lumi.switch.v2`) */
|
|
105
|
+
class Button extends (0, compose_1.compose)(ActionSubDevice, voltage_1.VoltageBattery) {
|
|
106
|
+
static get types() {
|
|
107
|
+
return ["controller", "button"];
|
|
108
|
+
}
|
|
109
|
+
constructor(parent, info, model, actions) {
|
|
110
|
+
super(parent, info, model, actions);
|
|
111
|
+
this.defineProperty("voltage");
|
|
112
|
+
}
|
|
113
|
+
_report(data) {
|
|
114
|
+
super._report(data);
|
|
115
|
+
this.reportAction(data.status);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/** Wireless button (`lumi.switch`) */
|
|
119
|
+
class Switch extends Button {
|
|
120
|
+
constructor(parent, info) {
|
|
121
|
+
super(parent, info, "lumi.switch", [
|
|
122
|
+
"click",
|
|
123
|
+
"double_click",
|
|
124
|
+
"long_click_press",
|
|
125
|
+
"long_click_release",
|
|
126
|
+
]);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.Switch = Switch;
|
|
130
|
+
/** Aqara wireless button (`lumi.switch.v2`) */
|
|
131
|
+
class SwitchV2 extends Button {
|
|
132
|
+
constructor(parent, info) {
|
|
133
|
+
super(parent, info, "lumi.switch.v2", ["click", "double_click"]);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exports.SwitchV2 = SwitchV2;
|
|
137
|
+
//# sourceMappingURL=controll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AAE,cAAc,CAAC,CAAC,CAAC;IACnE,CAAC;CACF;AAJD,4BAIC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
changePowerChannel(channel: any, power: any): any;
|
|
7
|
-
propertyUpdated(key: any, value: any): void;
|
|
1
|
+
import { ChannelSwitch } from "./light-channel";
|
|
2
|
+
import type { SubDeviceInfo, SubDeviceParent } from "./subdevice";
|
|
3
|
+
/** Single-channel light switch (live+neutral wire version) */
|
|
4
|
+
export declare class CtrlLN1 extends ChannelSwitch {
|
|
5
|
+
constructor(parent: SubDeviceParent, info: SubDeviceInfo);
|
|
8
6
|
}
|
|
@@ -1,37 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Single-channel L-N version of light switch.
|
|
8
|
-
*/
|
|
9
|
-
module.exports = class CtrlLN1 extends WallSwitch.with(SubDevice, Children) {
|
|
10
|
-
static get type() {
|
|
11
|
-
return "miio:power-switch";
|
|
12
|
-
}
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CtrlLN1 = void 0;
|
|
4
|
+
const light_channel_1 = require("./light-channel");
|
|
5
|
+
/** Single-channel light switch (live+neutral wire version) */
|
|
6
|
+
class CtrlLN1 extends light_channel_1.ChannelSwitch {
|
|
13
7
|
constructor(parent, info) {
|
|
14
|
-
super(parent, info);
|
|
15
|
-
this.miioModel = "lumi.ctrl_ln1";
|
|
16
|
-
this.defineProperty("channel_0", {
|
|
17
|
-
name: "powerChannel0",
|
|
18
|
-
mapper: (v) => v === "on",
|
|
19
|
-
});
|
|
20
|
-
this.addChild(new LightChannel(this, 0));
|
|
21
|
-
}
|
|
22
|
-
changePowerChannel(channel, power) {
|
|
23
|
-
return this.call("toggle_ctrl_neutral", [
|
|
24
|
-
"neutral_" + channel,
|
|
25
|
-
power ? "on" : "off",
|
|
26
|
-
]);
|
|
27
|
-
}
|
|
28
|
-
propertyUpdated(key, value) {
|
|
29
|
-
super.propertyUpdated(key, value);
|
|
30
|
-
switch (key) {
|
|
31
|
-
case "powerChannel0":
|
|
32
|
-
this.child("0").updatePower(value);
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
8
|
+
super(parent, info, "lumi.ctrl_ln1", 1);
|
|
35
9
|
}
|
|
36
|
-
}
|
|
10
|
+
}
|
|
11
|
+
exports.CtrlLN1 = CtrlLN1;
|
|
37
12
|
//# sourceMappingURL=ctrl_ln1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ctrl_ln1.js","sourceRoot":"","sources":["../../../../src/lib/devices/gateway/ctrl_ln1.
|
|
1
|
+
{"version":3,"file":"ctrl_ln1.js","sourceRoot":"","sources":["../../../../src/lib/devices/gateway/ctrl_ln1.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAGhD,8DAA8D;AAC9D,MAAa,OAAQ,SAAQ,6BAAa;IACxC,YAAY,MAAuB,EAAE,IAAmB;QACtD,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC;IAC1C,CAAC;CACF;AAJD,0BAIC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
changePowerChannel(channel: any, power: any): any;
|
|
7
|
-
propertyUpdated(key: any, value: any): void;
|
|
1
|
+
import { ChannelSwitch } from "./light-channel";
|
|
2
|
+
import type { SubDeviceInfo, SubDeviceParent } from "./subdevice";
|
|
3
|
+
/** Two-channel light switch (live+neutral wire version) */
|
|
4
|
+
export declare class CtrlLN2 extends ChannelSwitch {
|
|
5
|
+
constructor(parent: SubDeviceParent, info: SubDeviceInfo);
|
|
8
6
|
}
|
|
@@ -1,45 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Dual-channel L-N version of light switch.
|
|
8
|
-
*/
|
|
9
|
-
module.exports = class CtrlLN2 extends WallSwitch.with(SubDevice, Children) {
|
|
10
|
-
static get type() {
|
|
11
|
-
return "miio:power-switch";
|
|
12
|
-
}
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CtrlLN2 = void 0;
|
|
4
|
+
const light_channel_1 = require("./light-channel");
|
|
5
|
+
/** Two-channel light switch (live+neutral wire version) */
|
|
6
|
+
class CtrlLN2 extends light_channel_1.ChannelSwitch {
|
|
13
7
|
constructor(parent, info) {
|
|
14
|
-
super(parent, info);
|
|
15
|
-
this.miioModel = "lumi.ctrl_ln2";
|
|
16
|
-
this.defineProperty("channel_0", {
|
|
17
|
-
name: "powerChannel0",
|
|
18
|
-
mapper: (v) => v === "on",
|
|
19
|
-
});
|
|
20
|
-
this.defineProperty("channel_1", {
|
|
21
|
-
name: "powerChannel1",
|
|
22
|
-
mapper: (v) => v === "on",
|
|
23
|
-
});
|
|
24
|
-
this.addChild(new LightChannel(this, 0));
|
|
25
|
-
this.addChild(new LightChannel(this, 1));
|
|
26
|
-
}
|
|
27
|
-
changePowerChannel(channel, power) {
|
|
28
|
-
return this.call("toggle_ctrl_neutral", [
|
|
29
|
-
"neutral_" + channel,
|
|
30
|
-
power ? "on" : "off",
|
|
31
|
-
]);
|
|
32
|
-
}
|
|
33
|
-
propertyUpdated(key, value) {
|
|
34
|
-
super.propertyUpdated(key, value);
|
|
35
|
-
switch (key) {
|
|
36
|
-
case "powerChannel0":
|
|
37
|
-
this.child("0").updatePower(value);
|
|
38
|
-
break;
|
|
39
|
-
case "powerChannel1":
|
|
40
|
-
this.child("1").updatePower(value);
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
8
|
+
super(parent, info, "lumi.ctrl_ln2", 2);
|
|
43
9
|
}
|
|
44
|
-
}
|
|
10
|
+
}
|
|
11
|
+
exports.CtrlLN2 = CtrlLN2;
|
|
45
12
|
//# sourceMappingURL=ctrl_ln2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ctrl_ln2.js","sourceRoot":"","sources":["../../../../src/lib/devices/gateway/ctrl_ln2.
|
|
1
|
+
{"version":3,"file":"ctrl_ln2.js","sourceRoot":"","sources":["../../../../src/lib/devices/gateway/ctrl_ln2.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAGhD,2DAA2D;AAC3D,MAAa,OAAQ,SAAQ,6BAAa;IACxC,YAAY,MAAuB,EAAE,IAAmB;QACtD,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC;IAC1C,CAAC;CACF;AAJD,0BAIC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
changePowerChannel(channel: any, power: any): any;
|
|
7
|
-
propertyUpdated(key: any, value: any): void;
|
|
1
|
+
import { ChannelSwitch } from "./light-channel";
|
|
2
|
+
import type { SubDeviceInfo, SubDeviceParent } from "./subdevice";
|
|
3
|
+
/** Single-channel light switch */
|
|
4
|
+
export declare class CtrlNeutral1 extends ChannelSwitch {
|
|
5
|
+
constructor(parent: SubDeviceParent, info: SubDeviceInfo);
|
|
8
6
|
}
|
|
@@ -1,37 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Single-channel light switch.
|
|
8
|
-
*/
|
|
9
|
-
module.exports = class CtrlNeutral1 extends (WallSwitch.with(SubDevice, Children)) {
|
|
10
|
-
static get type() {
|
|
11
|
-
return "miio:power-switch";
|
|
12
|
-
}
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CtrlNeutral1 = void 0;
|
|
4
|
+
const light_channel_1 = require("./light-channel");
|
|
5
|
+
/** Single-channel light switch */
|
|
6
|
+
class CtrlNeutral1 extends light_channel_1.ChannelSwitch {
|
|
13
7
|
constructor(parent, info) {
|
|
14
|
-
super(parent, info);
|
|
15
|
-
this.miioModel = "lumi.ctrl_neutral1";
|
|
16
|
-
this.defineProperty("channel_0", {
|
|
17
|
-
name: "powerChannel0",
|
|
18
|
-
mapper: (v) => v === "on",
|
|
19
|
-
});
|
|
20
|
-
this.addChild(new LightChannel(this, 0));
|
|
21
|
-
}
|
|
22
|
-
changePowerChannel(channel, power) {
|
|
23
|
-
return this.call("toggle_ctrl_neutral", [
|
|
24
|
-
"neutral_" + channel,
|
|
25
|
-
power ? "on" : "off",
|
|
26
|
-
]);
|
|
27
|
-
}
|
|
28
|
-
propertyUpdated(key, value) {
|
|
29
|
-
super.propertyUpdated(key, value);
|
|
30
|
-
switch (key) {
|
|
31
|
-
case "powerChannel0":
|
|
32
|
-
this.child("0").updatePower(value);
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
8
|
+
super(parent, info, "lumi.ctrl_neutral1", 1);
|
|
35
9
|
}
|
|
36
|
-
}
|
|
10
|
+
}
|
|
11
|
+
exports.CtrlNeutral1 = CtrlNeutral1;
|
|
37
12
|
//# sourceMappingURL=ctrl_neutral1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ctrl_neutral1.js","sourceRoot":"","sources":["../../../../src/lib/devices/gateway/ctrl_neutral1.
|
|
1
|
+
{"version":3,"file":"ctrl_neutral1.js","sourceRoot":"","sources":["../../../../src/lib/devices/gateway/ctrl_neutral1.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAGhD,kCAAkC;AAClC,MAAa,YAAa,SAAQ,6BAAa;IAC7C,YAAY,MAAuB,EAAE,IAAmB;QACtD,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;CACF;AAJD,oCAIC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
changePowerChannel(channel: any, power: any): any;
|
|
7
|
-
propertyUpdated(key: any, value: any): void;
|
|
1
|
+
import { ChannelSwitch } from "./light-channel";
|
|
2
|
+
import type { SubDeviceInfo, SubDeviceParent } from "./subdevice";
|
|
3
|
+
/** Two-channel light switch */
|
|
4
|
+
export declare class CtrlNeutral2 extends ChannelSwitch {
|
|
5
|
+
constructor(parent: SubDeviceParent, info: SubDeviceInfo);
|
|
8
6
|
}
|