node-miio 0.4.0 → 0.6.0
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/.claude/skills/release/SKILL.md +11 -0
- package/AGENTS.md +17 -2
- package/CONTRIBUTING.md +41 -87
- package/README.md +43 -7
- package/dist/cli/commands/cloud/devices.d.ts +10 -0
- package/dist/cli/commands/cloud/login.d.ts +8 -0
- package/dist/cli/commands/cloud/logout.d.ts +4 -0
- package/dist/cli/commands/cloud/map.d.ts +10 -0
- package/dist/cli/commands/cloud/map.js +131 -0
- package/dist/cli/commands/cloud/map.js.map +1 -0
- package/dist/cli/commands/cloud.d.ts +5 -0
- package/dist/cli/commands/cloud.js +3 -1
- package/dist/cli/commands/cloud.js.map +1 -1
- package/dist/cli/commands/configure.d.ts +18 -0
- package/dist/cli/commands/control.d.ts +4 -0
- package/dist/cli/commands/discover.d.ts +9 -0
- package/dist/cli/commands/inspect.d.ts +4 -0
- package/dist/cli/commands/miot-spec.d.ts +10 -0
- package/dist/cli/commands/protocol/call.d.ts +9 -0
- package/dist/cli/commands/protocol/json-dump.d.ts +8 -0
- package/dist/cli/commands/protocol/packet.d.ts +8 -0
- package/dist/cli/commands/protocol.d.ts +5 -0
- package/dist/cli/commands/tokens/update.d.ts +9 -0
- package/dist/cli/commands/tokens.d.ts +5 -0
- package/dist/cli/device-finder.d.ts +3 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/log.d.ts +9 -0
- package/dist/cli/prompt.d.ts +11 -0
- package/dist/cli/terminal_qr.d.ts +7 -0
- package/dist/lib/check_result.d.ts +6 -0
- package/dist/lib/cloud/client.d.ts +142 -0
- package/dist/lib/cloud/client.js +2 -5
- package/dist/lib/cloud/client.js.map +1 -1
- package/dist/lib/cloud/crypto.d.ts +56 -0
- package/dist/lib/cloud/errors.d.ts +26 -0
- package/dist/lib/cloud/http.d.ts +55 -0
- package/dist/lib/cloud/index.d.ts +5 -0
- package/dist/lib/cloud/login.d.ts +57 -0
- package/dist/lib/cloud/login.js +2 -2
- package/dist/lib/cloud/login.js.map +1 -1
- package/dist/lib/cloud/session_store.d.ts +27 -0
- package/dist/lib/connect_to_device.d.ts +10 -0
- package/dist/lib/device.d.ts +151 -0
- package/dist/lib/device.js +53 -19
- package/dist/lib/device.js.map +1 -1
- package/dist/lib/device_info.d.ts +66 -0
- package/dist/lib/device_info.js +23 -10
- package/dist/lib/device_info.js.map +1 -1
- package/dist/lib/devices/air-monitor.d.ts +8 -0
- package/dist/lib/devices/air-purifier.d.ts +40 -0
- package/dist/lib/devices/capabilities/battery-level.d.ts +22 -0
- package/dist/lib/devices/capabilities/buzzer.d.ts +33 -0
- package/dist/lib/devices/capabilities/changeable-led-brightness.d.ts +35 -0
- package/dist/lib/devices/capabilities/colorable.d.ts +21 -0
- package/dist/lib/devices/capabilities/dimmable.d.ts +21 -0
- package/dist/lib/devices/capabilities/mode.d.ts +21 -0
- package/dist/lib/devices/capabilities/power.d.ts +21 -0
- package/dist/lib/devices/capabilities/sensor.d.ts +15 -0
- package/dist/lib/devices/capabilities/switchable-led.d.ts +35 -0
- package/dist/lib/devices/chuangmi.plug.v1.d.ts +31 -0
- package/dist/lib/devices/eyecare-lamp2.d.ts +91 -0
- package/dist/lib/devices/gateway/86sw1.d.ts +7 -0
- package/dist/lib/devices/gateway/86sw2.d.ts +7 -0
- package/dist/lib/devices/gateway/ctrl_ln1.d.ts +8 -0
- package/dist/lib/devices/gateway/ctrl_ln2.d.ts +8 -0
- package/dist/lib/devices/gateway/ctrl_neutral1.d.ts +8 -0
- package/dist/lib/devices/gateway/ctrl_neutral2.d.ts +8 -0
- package/dist/lib/devices/gateway/cube.d.ts +6 -0
- package/dist/lib/devices/gateway/developer-api.d.ts +15 -0
- package/dist/lib/devices/gateway/light-channel.d.ts +10 -0
- package/dist/lib/devices/gateway/light-mixin.d.ts +2 -0
- package/dist/lib/devices/gateway/magnet.d.ts +6 -0
- package/dist/lib/devices/gateway/magnet2.d.ts +5 -0
- package/dist/lib/devices/gateway/motion.d.ts +6 -0
- package/dist/lib/devices/gateway/motion2.d.ts +6 -0
- package/dist/lib/devices/gateway/plug.d.ts +6 -0
- package/dist/lib/devices/gateway/sensor_ht.d.ts +5 -0
- package/dist/lib/devices/gateway/subdevice.d.ts +70 -0
- package/dist/lib/devices/gateway/subdevices.d.ts +49 -0
- package/dist/lib/devices/gateway/switch.d.ts +6 -0
- package/dist/lib/devices/gateway/switch2.d.ts +6 -0
- package/dist/lib/devices/gateway/voltage.d.ts +23 -0
- package/dist/lib/devices/gateway/weather.d.ts +5 -0
- package/dist/lib/devices/gateway.d.ts +98 -0
- package/dist/lib/devices/humidifier.d.ts +20 -0
- package/dist/lib/devices/philips-light-bulb.d.ts +8 -0
- package/dist/lib/devices/power-plug.d.ts +30 -0
- package/dist/lib/devices/power-strip.d.ts +7 -0
- package/dist/lib/devices/vacuums/dreamevacuum.d.ts +81 -0
- package/dist/lib/devices/vacuums/dreamevacuum.js +10 -2
- package/dist/lib/devices/vacuums/dreamevacuum.js.map +1 -1
- package/dist/lib/devices/vacuums/mijiavacuum.d.ts +4 -0
- package/dist/lib/devices/vacuums/miot-vacuum.d.ts +130 -0
- package/dist/lib/devices/vacuums/miot-vacuum.js +2 -0
- package/dist/lib/devices/vacuums/miot-vacuum.js.map +1 -1
- package/dist/lib/devices/vacuums/vacuum.d.ts +276 -0
- package/dist/lib/devices/vacuums/vacuum.js +2 -0
- package/dist/lib/devices/vacuums/vacuum.js.map +1 -1
- package/dist/lib/devices/vacuums/vacuum_device.d.ts +17 -0
- package/dist/lib/devices/vacuums/vacuum_device.js +14 -0
- package/dist/lib/devices/vacuums/vacuum_device.js.map +1 -0
- package/dist/lib/devices/vacuums/vacuum_errors.d.ts +10 -0
- package/dist/lib/devices/vacuums/vacuum_errors.js +25 -0
- package/dist/lib/devices/vacuums/vacuum_errors.js.map +1 -0
- package/dist/lib/devices/vacuums/vacuum_modes.d.ts +51 -0
- package/dist/lib/devices/vacuums/viomivacuum.d.ts +76 -0
- package/dist/lib/devices/vacuums/viomivacuum.js +2 -0
- package/dist/lib/devices/vacuums/viomivacuum.js.map +1 -1
- package/dist/lib/devices/yeelight.color.d.ts +3 -0
- package/dist/lib/devices/yeelight.d.ts +159 -0
- package/dist/lib/devices/yeelight.mono.d.ts +3 -0
- package/dist/lib/discovery.d.ts +53 -0
- package/dist/lib/events.d.ts +18 -0
- package/dist/lib/events.js +3 -0
- package/dist/lib/events.js.map +1 -0
- package/dist/lib/index.d.ts +60 -0
- package/dist/lib/index.js +5 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/info_from_hostname.d.ts +13 -0
- package/dist/lib/logger.d.ts +43 -0
- package/dist/lib/logger.js +62 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/management.d.ts +53 -0
- package/dist/lib/maps/map_watcher.d.ts +71 -0
- package/dist/lib/maps/map_watcher.js +2 -5
- package/dist/lib/maps/map_watcher.js.map +1 -1
- package/dist/lib/maps/roborock_map.d.ts +83 -0
- package/dist/lib/miio_error.d.ts +12 -0
- package/dist/lib/miot/miot_api.d.ts +54 -0
- package/dist/lib/miot/miot_spec.d.ts +114 -0
- package/dist/lib/miot/spec_client.d.ts +125 -0
- package/dist/lib/miot/spec_client.js +2 -2
- package/dist/lib/miot/spec_client.js.map +1 -1
- package/dist/lib/models.d.ts +271 -0
- package/dist/lib/network.d.ts +58 -0
- package/dist/lib/network.js +5 -2
- package/dist/lib/network.js.map +1 -1
- package/dist/lib/packet.d.ts +21 -0
- package/dist/lib/placeholder.d.ts +7 -0
- package/dist/lib/protocol.d.ts +299 -0
- package/dist/lib/safeish_json.d.ts +7 -0
- package/dist/lib/tokens.d.ts +12 -0
- package/dist/types/abstract-things/climate/index.d.ts +431 -0
- package/dist/types/abstract-things/electricals/index.d.ts +5 -0
- package/dist/types/abstract-things/index.d.ts +206 -0
- package/dist/types/abstract-things/lights/index.d.ts +14 -0
- package/dist/types/abstract-things/values/index.d.ts +12 -0
- package/docs/cloud.md +5 -1
- package/package.json +6 -3
- package/snapshots/vacuum-specs.json.gz +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Thing } from "abstract-things";
|
|
2
|
+
export declare const Dimmable: new (...args: unknown[]) => {
|
|
3
|
+
propertyUpdated(key: any, value: any): void;
|
|
4
|
+
id: string | null;
|
|
5
|
+
metadata: Record<string, unknown> & {
|
|
6
|
+
types: string[];
|
|
7
|
+
capabilities: string[];
|
|
8
|
+
addCapabilities(...capabilities: string[]): void;
|
|
9
|
+
};
|
|
10
|
+
init(): Promise</*elided*/ any | undefined>;
|
|
11
|
+
initCallback(): Promise<void>;
|
|
12
|
+
destroy(): Promise<void>;
|
|
13
|
+
destroyCallback(): Promise<void>;
|
|
14
|
+
debug(...parts: unknown[]): void;
|
|
15
|
+
matches(...tags: string[]): boolean;
|
|
16
|
+
emitEvent(event: string, data?: unknown, options?: unknown): void;
|
|
17
|
+
on(event: string, listener: (...args: never[]) => void): unknown;
|
|
18
|
+
off(event: string, listener: (...args: never[]) => void): unknown;
|
|
19
|
+
extendWith<T>(...mixins: T[]): T & Thing;
|
|
20
|
+
updateBrightness(value: number): void;
|
|
21
|
+
} & Thing;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Thing } from "abstract-things";
|
|
2
|
+
export declare const Mode: new (...args: unknown[]) => {
|
|
3
|
+
propertyUpdated(key: any, value: any): void;
|
|
4
|
+
id: string | null;
|
|
5
|
+
metadata: Record<string, unknown> & {
|
|
6
|
+
types: string[];
|
|
7
|
+
capabilities: string[];
|
|
8
|
+
addCapabilities(...capabilities: string[]): void;
|
|
9
|
+
};
|
|
10
|
+
init(): Promise</*elided*/ any | undefined>;
|
|
11
|
+
initCallback(): Promise<void>;
|
|
12
|
+
destroy(): Promise<void>;
|
|
13
|
+
destroyCallback(): Promise<void>;
|
|
14
|
+
debug(...parts: unknown[]): void;
|
|
15
|
+
matches(...tags: string[]): boolean;
|
|
16
|
+
emitEvent(event: string, data?: unknown, options?: unknown): void;
|
|
17
|
+
on(event: string, listener: (...args: never[]) => void): unknown;
|
|
18
|
+
off(event: string, listener: (...args: never[]) => void): unknown;
|
|
19
|
+
extendWith<T>(...mixins: T[]): T & Thing;
|
|
20
|
+
updateMode<T>(value: T): void;
|
|
21
|
+
} & Thing;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Thing } from "abstract-things";
|
|
2
|
+
export declare const Power: new (...args: unknown[]) => {
|
|
3
|
+
propertyUpdated<T>(key: string, value: T): void;
|
|
4
|
+
id: string | null;
|
|
5
|
+
metadata: Record<string, unknown> & {
|
|
6
|
+
types: string[];
|
|
7
|
+
capabilities: string[];
|
|
8
|
+
addCapabilities(...capabilities: string[]): void;
|
|
9
|
+
};
|
|
10
|
+
init(): Promise</*elided*/ any | undefined>;
|
|
11
|
+
initCallback(): Promise<void>;
|
|
12
|
+
destroy(): Promise<void>;
|
|
13
|
+
destroyCallback(): Promise<void>;
|
|
14
|
+
debug(...parts: unknown[]): void;
|
|
15
|
+
matches(...tags: string[]): boolean;
|
|
16
|
+
emitEvent(event: string, data?: unknown, options?: unknown): void;
|
|
17
|
+
on(event: string, listener: (...args: never[]) => void): unknown;
|
|
18
|
+
off(event: string, listener: (...args: never[]) => void): unknown;
|
|
19
|
+
extendWith<T>(...mixins: T[]): T & Thing;
|
|
20
|
+
updatePower<T>(value: T): void;
|
|
21
|
+
} & Thing;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const Temperature: new (...args: unknown[]) => any;
|
|
2
|
+
export const Humidity: new (...args: unknown[]) => any;
|
|
3
|
+
export const Illuminance: new (...args: unknown[]) => any;
|
|
4
|
+
export const AQI: new (...args: unknown[]) => any;
|
|
5
|
+
export const AtmosphericPressure: new (...args: unknown[]) => any;
|
|
6
|
+
export const PowerLoad: new (...args: unknown[]) => any;
|
|
7
|
+
export const PowerConsumed: new (...args: unknown[]) => any;
|
|
8
|
+
export { mixin as extend };
|
|
9
|
+
/**
|
|
10
|
+
* Setup sensor support for a device.
|
|
11
|
+
*
|
|
12
|
+
* @param {object} device The device
|
|
13
|
+
* @param {object} options The sensor options
|
|
14
|
+
*/
|
|
15
|
+
declare function mixin(device: object, options: object): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Thing } from "abstract-things";
|
|
2
|
+
export declare const SwitchableLED: new (...args: unknown[]) => {
|
|
3
|
+
propertyUpdated(key: any, value: any): void;
|
|
4
|
+
/**
|
|
5
|
+
* Get or set if the LED should be on.
|
|
6
|
+
*
|
|
7
|
+
* @param power Optional power to set LED to
|
|
8
|
+
*/
|
|
9
|
+
led(power: any): any;
|
|
10
|
+
/**
|
|
11
|
+
* Set if the LED should be on when the device is running.
|
|
12
|
+
*
|
|
13
|
+
* @param power
|
|
14
|
+
*/
|
|
15
|
+
changeLED(power: any): any;
|
|
16
|
+
id: string | null;
|
|
17
|
+
metadata: Record<string, unknown> & {
|
|
18
|
+
types: string[];
|
|
19
|
+
capabilities: string[];
|
|
20
|
+
addCapabilities(...capabilities: string[]): void;
|
|
21
|
+
};
|
|
22
|
+
init(): Promise</*elided*/ any | undefined>;
|
|
23
|
+
initCallback(): Promise<void>;
|
|
24
|
+
destroy(): Promise<void>;
|
|
25
|
+
destroyCallback(): Promise<void>;
|
|
26
|
+
debug(...parts: unknown[]): void;
|
|
27
|
+
matches(...tags: string[]): boolean;
|
|
28
|
+
emitEvent(event: string, data?: unknown, options?: unknown): void;
|
|
29
|
+
on(event: string, listener: (...args: never[]) => void): unknown;
|
|
30
|
+
off(event: string, listener: (...args: never[]) => void): unknown;
|
|
31
|
+
extendWith<T>(...mixins: T[]): T & Thing;
|
|
32
|
+
state(): Promise<Record<string, unknown>>;
|
|
33
|
+
getState<T>(name: string): T;
|
|
34
|
+
updateState<T>(name: string, value: T): boolean;
|
|
35
|
+
} & Thing;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export = exports;
|
|
2
|
+
declare const exports_base: new (...args: unknown[]) => Thing & PowerPlug & PowerOutlet & MiioApi & {
|
|
3
|
+
propertyUpdated<T>(key: string, value: T): void;
|
|
4
|
+
id: string | null;
|
|
5
|
+
metadata: Record<string, unknown> & {
|
|
6
|
+
types: string[];
|
|
7
|
+
capabilities: string[];
|
|
8
|
+
addCapabilities(...capabilities: string[]): void;
|
|
9
|
+
};
|
|
10
|
+
init(): Promise</*elided*/ any | undefined>;
|
|
11
|
+
initCallback(): Promise<void>;
|
|
12
|
+
destroy(): Promise<void>;
|
|
13
|
+
destroyCallback(): Promise<void>;
|
|
14
|
+
debug(...parts: unknown[]): void;
|
|
15
|
+
matches(...tags: string[]): boolean;
|
|
16
|
+
emitEvent(event: string, data?: unknown, options?: unknown): void;
|
|
17
|
+
on(event: string, listener: (...args: never[]) => void): unknown;
|
|
18
|
+
off(event: string, listener: (...args: never[]) => void): unknown;
|
|
19
|
+
extendWith<T>(...mixins: T[]): T & Thing;
|
|
20
|
+
updatePower<T>(value: T): void;
|
|
21
|
+
};
|
|
22
|
+
declare class exports extends exports_base {
|
|
23
|
+
static get type(): string;
|
|
24
|
+
constructor(options: any);
|
|
25
|
+
setName(name: any): any;
|
|
26
|
+
propertyUpdated(key: any, value: any): void;
|
|
27
|
+
}
|
|
28
|
+
import { Thing } from "abstract-things";
|
|
29
|
+
import { PowerPlug } from "abstract-things/electrical";
|
|
30
|
+
import { PowerOutlet } from "abstract-things/electrical";
|
|
31
|
+
import { MiioApi } from "../device";
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export = EyecareLamp2;
|
|
2
|
+
declare const EyecareLamp2_base: new (...args: unknown[]) => import("abstract-things").Thing & {
|
|
3
|
+
propertyUpdated<T>(key: string, value: T): void;
|
|
4
|
+
id: string | null;
|
|
5
|
+
metadata: Record<string, unknown> & {
|
|
6
|
+
types: string[];
|
|
7
|
+
capabilities: string[];
|
|
8
|
+
addCapabilities(...capabilities: string[]): void;
|
|
9
|
+
};
|
|
10
|
+
init(): Promise</*elided*/ any | undefined>;
|
|
11
|
+
initCallback(): Promise<void>;
|
|
12
|
+
destroy(): Promise<void>;
|
|
13
|
+
destroyCallback(): Promise<void>;
|
|
14
|
+
debug(...parts: unknown[]): void;
|
|
15
|
+
matches(...tags: string[]): boolean;
|
|
16
|
+
emitEvent(event: string, data?: unknown, options?: unknown): void;
|
|
17
|
+
on(event: string, listener: (...args: never[]) => void): unknown;
|
|
18
|
+
off(event: string, listener: (...args: never[]) => void): unknown;
|
|
19
|
+
extendWith<T>(...mixins: T[]): T & import("abstract-things").Thing;
|
|
20
|
+
updatePower<T>(value: T): void;
|
|
21
|
+
} & {
|
|
22
|
+
propertyUpdated(key: any, value: any): void;
|
|
23
|
+
id: string | null;
|
|
24
|
+
metadata: Record<string, unknown> & {
|
|
25
|
+
types: string[];
|
|
26
|
+
capabilities: string[];
|
|
27
|
+
addCapabilities(...capabilities: string[]): void;
|
|
28
|
+
};
|
|
29
|
+
init(): Promise</*elided*/ any | undefined>;
|
|
30
|
+
initCallback(): Promise<void>;
|
|
31
|
+
destroy(): Promise<void>;
|
|
32
|
+
destroyCallback(): Promise<void>;
|
|
33
|
+
debug(...parts: unknown[]): void;
|
|
34
|
+
matches(...tags: string[]): boolean;
|
|
35
|
+
emitEvent(event: string, data?: unknown, options?: unknown): void;
|
|
36
|
+
on(event: string, listener: (...args: never[]) => void): unknown;
|
|
37
|
+
off(event: string, listener: (...args: never[]) => void): unknown;
|
|
38
|
+
extendWith<T>(...mixins: T[]): T & import("abstract-things").Thing;
|
|
39
|
+
updateBrightness(value: number): void;
|
|
40
|
+
} & Children & MiioApi;
|
|
41
|
+
declare class EyecareLamp2 extends EyecareLamp2_base {
|
|
42
|
+
constructor(options: any);
|
|
43
|
+
ambient: AmbientLight;
|
|
44
|
+
changePower(power: any): Promise<unknown>;
|
|
45
|
+
changeBrightness(brightness: any): Promise<null>;
|
|
46
|
+
/**
|
|
47
|
+
* Is eyeCare active?
|
|
48
|
+
*/
|
|
49
|
+
eyeCare(): Promise<any>;
|
|
50
|
+
/**
|
|
51
|
+
* Enable the eyeCare
|
|
52
|
+
*
|
|
53
|
+
* @param {boolean} enable Whether to enable it
|
|
54
|
+
*/
|
|
55
|
+
setEyeCare(enable: boolean): Promise<null>;
|
|
56
|
+
/**
|
|
57
|
+
* Set the current eyeCare mode
|
|
58
|
+
*
|
|
59
|
+
changeMode(mode) {
|
|
60
|
+
|
|
61
|
+
switch (mode) {
|
|
62
|
+
case 'study':
|
|
63
|
+
mode = 1;
|
|
64
|
+
break;
|
|
65
|
+
case 'reading':
|
|
66
|
+
mode = 2;
|
|
67
|
+
break;
|
|
68
|
+
case 'phone':
|
|
69
|
+
mode = 3;
|
|
70
|
+
break;
|
|
71
|
+
default:
|
|
72
|
+
return Promise.reject(new Error('Invalid EyeCare Mode: ' + mode));
|
|
73
|
+
}
|
|
74
|
+
return this.call('set_user_scene', [mode], {
|
|
75
|
+
refresh: true
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
*/
|
|
79
|
+
setAmbientPower(power: any): any;
|
|
80
|
+
setAmbientBrightness(brightness: any): any;
|
|
81
|
+
propertyUpdated(key: any, value: any): void;
|
|
82
|
+
}
|
|
83
|
+
import { Children } from "abstract-things";
|
|
84
|
+
import { MiioApi } from "../device";
|
|
85
|
+
declare class AmbientLight {
|
|
86
|
+
constructor(parent: any);
|
|
87
|
+
parent: any;
|
|
88
|
+
id: string;
|
|
89
|
+
changePower(power: any): any;
|
|
90
|
+
changeBrightness(brightness: any): any;
|
|
91
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export = DeveloperApi;
|
|
2
|
+
declare class DeveloperApi extends EventEmitter<[never]> {
|
|
3
|
+
constructor(parent: any, address: any);
|
|
4
|
+
address: any;
|
|
5
|
+
port: number;
|
|
6
|
+
debug: (...args: any[]) => void;
|
|
7
|
+
socket: dgram.Socket;
|
|
8
|
+
destroy(): void;
|
|
9
|
+
send(data: any): void;
|
|
10
|
+
read(sid: any): void;
|
|
11
|
+
_onMessage(msg: any): void;
|
|
12
|
+
sid: any;
|
|
13
|
+
}
|
|
14
|
+
import EventEmitter = require("events");
|
|
15
|
+
import dgram = require("node:dgram");
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
declare const _exports: new (parent?: any, info?: any) => {
|
|
2
|
+
miioModel: any;
|
|
3
|
+
id: any;
|
|
4
|
+
internalId: any;
|
|
5
|
+
_properties: {};
|
|
6
|
+
_propertiesToMonitor: any[];
|
|
7
|
+
_propertyDefinitions: {};
|
|
8
|
+
_parent: any;
|
|
9
|
+
_report(data: any): void;
|
|
10
|
+
management: SubDeviceManagement;
|
|
11
|
+
hasCapability(name: any): boolean;
|
|
12
|
+
initCallback(): Promise<any>;
|
|
13
|
+
destroyCallback(): Promise<any>;
|
|
14
|
+
_currentRead: {} | null | undefined;
|
|
15
|
+
get properties(): {};
|
|
16
|
+
property(key: any): any;
|
|
17
|
+
/**
|
|
18
|
+
* Define a property and how the value should be mapped. All defined
|
|
19
|
+
* properties are monitored if #monitor() is called.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} name The raw property name
|
|
22
|
+
* @param {object} def How the value is mapped
|
|
23
|
+
*/
|
|
24
|
+
defineProperty(name: string, def: object): void;
|
|
25
|
+
setProperty(key: any, value: any): void;
|
|
26
|
+
propertyUpdated(_key: any, _value: any, _oldValue: any): void;
|
|
27
|
+
getProperties(props?: any[]): {};
|
|
28
|
+
/**
|
|
29
|
+
* Stub for loadProperties to match full device.
|
|
30
|
+
*
|
|
31
|
+
* @param {string[]} props The properties to load
|
|
32
|
+
*/
|
|
33
|
+
loadProperties(props: string[]): any;
|
|
34
|
+
/**
|
|
35
|
+
* Call a method for this sub device.
|
|
36
|
+
*
|
|
37
|
+
* @param {string} method The method
|
|
38
|
+
* @param {Array} args The arguments
|
|
39
|
+
* @param {object} options Call options
|
|
40
|
+
*/
|
|
41
|
+
call(method: string, args: any[], options: object): any;
|
|
42
|
+
[util.inspect.custom](depth: any, options: any): string;
|
|
43
|
+
metadata: Record<string, unknown> & {
|
|
44
|
+
types: string[];
|
|
45
|
+
capabilities: string[];
|
|
46
|
+
addCapabilities(...capabilities: string[]): void;
|
|
47
|
+
};
|
|
48
|
+
init(): Promise</*elided*/ any | undefined>;
|
|
49
|
+
destroy(): Promise<void>;
|
|
50
|
+
debug(...parts: unknown[]): void;
|
|
51
|
+
matches(...tags: string[]): boolean;
|
|
52
|
+
emitEvent(event: string, data?: unknown, options?: unknown): void;
|
|
53
|
+
on(event: string, listener: (...args: never[]) => void): unknown;
|
|
54
|
+
off(event: string, listener: (...args: never[]) => void): unknown;
|
|
55
|
+
extendWith<T>(...mixins: T[]): T & Thing;
|
|
56
|
+
} & Thing;
|
|
57
|
+
export = _exports;
|
|
58
|
+
declare class SubDeviceManagement {
|
|
59
|
+
constructor(device: any, parent: any);
|
|
60
|
+
_device: any;
|
|
61
|
+
parent: any;
|
|
62
|
+
get token(): null;
|
|
63
|
+
get model(): any;
|
|
64
|
+
info(): Promise<{
|
|
65
|
+
id: any;
|
|
66
|
+
model: any;
|
|
67
|
+
}>;
|
|
68
|
+
}
|
|
69
|
+
import util = require("node:util");
|
|
70
|
+
import { Thing } from "abstract-things";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
declare const _exports: {
|
|
2
|
+
1: {
|
|
3
|
+
new (parent: any, info: any): import("./switch");
|
|
4
|
+
};
|
|
5
|
+
2: {
|
|
6
|
+
new (parent: any, info: any): import("./motion");
|
|
7
|
+
};
|
|
8
|
+
3: {
|
|
9
|
+
new (parent: any, info: any): import("./magnet");
|
|
10
|
+
};
|
|
11
|
+
7: {
|
|
12
|
+
new (parent: any, info: any): import("./ctrl_neutral2");
|
|
13
|
+
get type(): string;
|
|
14
|
+
};
|
|
15
|
+
8: {
|
|
16
|
+
new (parent: any, info: any): import("./cube");
|
|
17
|
+
};
|
|
18
|
+
9: {
|
|
19
|
+
new (parent: any, info: any): import("./ctrl_neutral1");
|
|
20
|
+
get type(): string;
|
|
21
|
+
};
|
|
22
|
+
10: {
|
|
23
|
+
new (parent: any, info: any): import("./sensor_ht");
|
|
24
|
+
};
|
|
25
|
+
11: {
|
|
26
|
+
new (parent: any, info: any): import("./plug");
|
|
27
|
+
};
|
|
28
|
+
19: {
|
|
29
|
+
new (parent: any, info: any): import("./weather");
|
|
30
|
+
};
|
|
31
|
+
20: {
|
|
32
|
+
new (parent: any, info: any): import("./ctrl_ln1");
|
|
33
|
+
get type(): string;
|
|
34
|
+
};
|
|
35
|
+
21: {
|
|
36
|
+
new (parent: any, info: any): import("./ctrl_ln2");
|
|
37
|
+
get type(): string;
|
|
38
|
+
};
|
|
39
|
+
51: {
|
|
40
|
+
new (parent: any, info: any): import("./switch2");
|
|
41
|
+
};
|
|
42
|
+
52: {
|
|
43
|
+
new (parent: any, info: any): import("./motion2");
|
|
44
|
+
};
|
|
45
|
+
53: {
|
|
46
|
+
new (...args: any[]): import("./magnet2");
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export = _exports;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const _exports: new (...args: any[]) => {
|
|
2
|
+
propertyUpdated(key: any, value: any, oldValue: any): void;
|
|
3
|
+
id: string | null;
|
|
4
|
+
metadata: Record<string, unknown> & {
|
|
5
|
+
types: string[];
|
|
6
|
+
capabilities: string[];
|
|
7
|
+
addCapabilities(...capabilities: string[]): void;
|
|
8
|
+
};
|
|
9
|
+
init(): Promise</*elided*/ any | undefined>;
|
|
10
|
+
initCallback(): Promise<void>;
|
|
11
|
+
destroy(): Promise<void>;
|
|
12
|
+
destroyCallback(): Promise<void>;
|
|
13
|
+
debug(...parts: unknown[]): void;
|
|
14
|
+
matches(...tags: string[]): boolean;
|
|
15
|
+
emitEvent(event: string, data?: unknown, options?: unknown): void;
|
|
16
|
+
on(event: string, listener: (...args: never[]) => void): unknown;
|
|
17
|
+
off(event: string, listener: (...args: never[]) => void): unknown;
|
|
18
|
+
extendWith<T>(...mixins: T[]): T & Thing;
|
|
19
|
+
batteryLevel(): Promise<number>;
|
|
20
|
+
updateBatteryLevel(level: number): void;
|
|
21
|
+
} & Thing;
|
|
22
|
+
export = _exports;
|
|
23
|
+
import { Thing } from "abstract-things";
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export { Gateway as Basic };
|
|
2
|
+
export const WithLightAndSensor: any;
|
|
3
|
+
/**
|
|
4
|
+
* Abstraction over a Mi Smart Home Gateway.
|
|
5
|
+
*
|
|
6
|
+
* This device is very different from most other miIO-devices in that it has
|
|
7
|
+
* devices on its own. There seems to be a way to talk to these devices by
|
|
8
|
+
* setting `sid` in the requests, which means we can poll them. The problem
|
|
9
|
+
* is that certain devices also send events, but these seem to only be
|
|
10
|
+
* accessible over a local developer connection.
|
|
11
|
+
*
|
|
12
|
+
* So to work around this we activate the local developer connection and use
|
|
13
|
+
* that together with the regular calls for changing things on the gateway.
|
|
14
|
+
*/
|
|
15
|
+
declare const Gateway: new (options?: any) => {
|
|
16
|
+
extraChildren: any[];
|
|
17
|
+
_monitorInterval: number;
|
|
18
|
+
syncer: any;
|
|
19
|
+
_report(properties: any): void;
|
|
20
|
+
initCallback(): Promise<void>;
|
|
21
|
+
_deviceListTimer: NodeJS.Timeout | undefined;
|
|
22
|
+
destroyCallback(): Promise<void>;
|
|
23
|
+
addExtraChild(child: any): void;
|
|
24
|
+
_updateDeviceList(): Promise<any>;
|
|
25
|
+
/**
|
|
26
|
+
* Either resolve the developer key or setup a new one.
|
|
27
|
+
*/
|
|
28
|
+
_findDeveloperKey(): Promise<any>;
|
|
29
|
+
/**
|
|
30
|
+
* Set the developer key and start listenting for events from the gateway.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} key The developer key
|
|
33
|
+
*/
|
|
34
|
+
_setDeveloperKey(key: string): Promise<any>;
|
|
35
|
+
_developerKey: string | undefined;
|
|
36
|
+
devApi: DeveloperApi | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Start the process of adding a device. Allows Zigbee devices to join for
|
|
39
|
+
* 30 seconds.
|
|
40
|
+
*/
|
|
41
|
+
addDevice(): Promise<undefined>;
|
|
42
|
+
/**
|
|
43
|
+
* Stop allowing devices to join.
|
|
44
|
+
*/
|
|
45
|
+
stopAddDevice(): Promise<undefined>;
|
|
46
|
+
/**
|
|
47
|
+
* Remove a device from the gateway using the identifier of the device.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} id The device id
|
|
50
|
+
*/
|
|
51
|
+
removeDevice(id: string): Promise<undefined>;
|
|
52
|
+
id: string | null;
|
|
53
|
+
metadata: Record<string, unknown> & {
|
|
54
|
+
types: string[];
|
|
55
|
+
capabilities: string[];
|
|
56
|
+
addCapabilities(...capabilities: string[]): void;
|
|
57
|
+
};
|
|
58
|
+
init(): Promise</*elided*/ any | undefined>;
|
|
59
|
+
destroy(): Promise<void>;
|
|
60
|
+
debug: ((...parts: unknown[]) => void) & ((...msgs: unknown[]) => void);
|
|
61
|
+
matches(...tags: string[]): boolean;
|
|
62
|
+
propertyUpdated: ((key: string, value: unknown, oldValue?: unknown) => void) & ((_key: string, _value: unknown, _oldValue: unknown) => void);
|
|
63
|
+
emitEvent(event: string, data?: unknown, options?: unknown): void;
|
|
64
|
+
on(event: string, listener: (...args: never[]) => void): unknown;
|
|
65
|
+
off(event: string, listener: (...args: never[]) => void): unknown;
|
|
66
|
+
extendWith<T>(...mixins: T[]): T & Thing;
|
|
67
|
+
readonly miioModel?: string;
|
|
68
|
+
readonly _properties: Record<string, unknown>;
|
|
69
|
+
readonly _propertiesToMonitor: string[];
|
|
70
|
+
readonly _propertyDefinitions: Record<string, import("../device").PersistedPropertyDefinition<never, never>>;
|
|
71
|
+
readonly _reversePropertyDefinitions: Record<string, string>;
|
|
72
|
+
readonly management: import("../management").DeviceManagement;
|
|
73
|
+
debugFn?: import("../logger").DebugFn;
|
|
74
|
+
readonly handle: import("../management").DeviceHandle;
|
|
75
|
+
miioCall<Method extends keyof import("../protocol").Protocol, Params extends import("../protocol").Protocol[Method]["params"], Response extends import("../protocol").Protocol[Method]["response"]>(method: Method, args: Params): Promise<Response>;
|
|
76
|
+
call<Method extends keyof import("../protocol").Protocol, Params extends import("../protocol").Protocol[Method]["params"], Response extends import("../protocol").Protocol[Method]["response"]>(method: Method, args: Params, options?: {
|
|
77
|
+
refresh?: string[];
|
|
78
|
+
refreshDelay?: number;
|
|
79
|
+
sid?: number;
|
|
80
|
+
retries?: number;
|
|
81
|
+
}): Promise<Response>;
|
|
82
|
+
defineProperty<T, V>(name: string, def?: import("../device").Mapper<T, V> | import("../device").PropertyDefinition<T, V> | undefined): void;
|
|
83
|
+
_pushProperty(result: Record<string, unknown>, name: string, value: unknown): void;
|
|
84
|
+
poll(_isInitial?: boolean): Promise<void>;
|
|
85
|
+
_loadProperties(properties?: string[]): Promise<void>;
|
|
86
|
+
setProperty(key: string, value: unknown): void;
|
|
87
|
+
setRawProperty(name: string, value: unknown): void;
|
|
88
|
+
property<T>(key: string): T;
|
|
89
|
+
get connected(): boolean;
|
|
90
|
+
get properties(): Record<string, unknown>;
|
|
91
|
+
miioProperties(): Record<string, unknown>;
|
|
92
|
+
getProperties(props: string[]): {};
|
|
93
|
+
loadProperties(props: string[]): Promise<{}>;
|
|
94
|
+
updatePollDuration(duration: number): void;
|
|
95
|
+
updateMaxPollFailures(failures: number): void;
|
|
96
|
+
} & Thing;
|
|
97
|
+
import DeveloperApi = require("./gateway/developer-api");
|
|
98
|
+
import { Thing } from "abstract-things";
|