node-miio 0.4.0 → 0.5.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.
Files changed (144) hide show
  1. package/.claude/skills/release/SKILL.md +11 -0
  2. package/AGENTS.md +17 -2
  3. package/CONTRIBUTING.md +41 -87
  4. package/README.md +43 -7
  5. package/dist/cli/commands/cloud/devices.d.ts +10 -0
  6. package/dist/cli/commands/cloud/login.d.ts +8 -0
  7. package/dist/cli/commands/cloud/logout.d.ts +4 -0
  8. package/dist/cli/commands/cloud.d.ts +5 -0
  9. package/dist/cli/commands/configure.d.ts +18 -0
  10. package/dist/cli/commands/control.d.ts +4 -0
  11. package/dist/cli/commands/discover.d.ts +9 -0
  12. package/dist/cli/commands/inspect.d.ts +4 -0
  13. package/dist/cli/commands/miot-spec.d.ts +10 -0
  14. package/dist/cli/commands/protocol/call.d.ts +9 -0
  15. package/dist/cli/commands/protocol/json-dump.d.ts +8 -0
  16. package/dist/cli/commands/protocol/packet.d.ts +8 -0
  17. package/dist/cli/commands/protocol.d.ts +5 -0
  18. package/dist/cli/commands/tokens/update.d.ts +9 -0
  19. package/dist/cli/commands/tokens.d.ts +5 -0
  20. package/dist/cli/device-finder.d.ts +3 -0
  21. package/dist/cli/index.d.ts +2 -0
  22. package/dist/cli/log.d.ts +9 -0
  23. package/dist/cli/prompt.d.ts +11 -0
  24. package/dist/cli/terminal_qr.d.ts +7 -0
  25. package/dist/lib/check_result.d.ts +6 -0
  26. package/dist/lib/cloud/client.d.ts +142 -0
  27. package/dist/lib/cloud/client.js +2 -5
  28. package/dist/lib/cloud/client.js.map +1 -1
  29. package/dist/lib/cloud/crypto.d.ts +56 -0
  30. package/dist/lib/cloud/errors.d.ts +26 -0
  31. package/dist/lib/cloud/http.d.ts +55 -0
  32. package/dist/lib/cloud/index.d.ts +5 -0
  33. package/dist/lib/cloud/login.d.ts +57 -0
  34. package/dist/lib/cloud/login.js +2 -2
  35. package/dist/lib/cloud/login.js.map +1 -1
  36. package/dist/lib/cloud/session_store.d.ts +27 -0
  37. package/dist/lib/connect_to_device.d.ts +10 -0
  38. package/dist/lib/device.d.ts +151 -0
  39. package/dist/lib/device.js +53 -19
  40. package/dist/lib/device.js.map +1 -1
  41. package/dist/lib/device_info.d.ts +66 -0
  42. package/dist/lib/device_info.js +23 -10
  43. package/dist/lib/device_info.js.map +1 -1
  44. package/dist/lib/devices/air-monitor.d.ts +8 -0
  45. package/dist/lib/devices/air-purifier.d.ts +40 -0
  46. package/dist/lib/devices/capabilities/battery-level.d.ts +22 -0
  47. package/dist/lib/devices/capabilities/buzzer.d.ts +33 -0
  48. package/dist/lib/devices/capabilities/changeable-led-brightness.d.ts +35 -0
  49. package/dist/lib/devices/capabilities/colorable.d.ts +21 -0
  50. package/dist/lib/devices/capabilities/dimmable.d.ts +21 -0
  51. package/dist/lib/devices/capabilities/mode.d.ts +21 -0
  52. package/dist/lib/devices/capabilities/power.d.ts +21 -0
  53. package/dist/lib/devices/capabilities/sensor.d.ts +15 -0
  54. package/dist/lib/devices/capabilities/switchable-led.d.ts +35 -0
  55. package/dist/lib/devices/chuangmi.plug.v1.d.ts +31 -0
  56. package/dist/lib/devices/eyecare-lamp2.d.ts +91 -0
  57. package/dist/lib/devices/gateway/86sw1.d.ts +7 -0
  58. package/dist/lib/devices/gateway/86sw2.d.ts +7 -0
  59. package/dist/lib/devices/gateway/ctrl_ln1.d.ts +8 -0
  60. package/dist/lib/devices/gateway/ctrl_ln2.d.ts +8 -0
  61. package/dist/lib/devices/gateway/ctrl_neutral1.d.ts +8 -0
  62. package/dist/lib/devices/gateway/ctrl_neutral2.d.ts +8 -0
  63. package/dist/lib/devices/gateway/cube.d.ts +6 -0
  64. package/dist/lib/devices/gateway/developer-api.d.ts +15 -0
  65. package/dist/lib/devices/gateway/light-channel.d.ts +10 -0
  66. package/dist/lib/devices/gateway/light-mixin.d.ts +2 -0
  67. package/dist/lib/devices/gateway/magnet.d.ts +6 -0
  68. package/dist/lib/devices/gateway/magnet2.d.ts +5 -0
  69. package/dist/lib/devices/gateway/motion.d.ts +6 -0
  70. package/dist/lib/devices/gateway/motion2.d.ts +6 -0
  71. package/dist/lib/devices/gateway/plug.d.ts +6 -0
  72. package/dist/lib/devices/gateway/sensor_ht.d.ts +5 -0
  73. package/dist/lib/devices/gateway/subdevice.d.ts +70 -0
  74. package/dist/lib/devices/gateway/subdevices.d.ts +49 -0
  75. package/dist/lib/devices/gateway/switch.d.ts +6 -0
  76. package/dist/lib/devices/gateway/switch2.d.ts +6 -0
  77. package/dist/lib/devices/gateway/voltage.d.ts +23 -0
  78. package/dist/lib/devices/gateway/weather.d.ts +5 -0
  79. package/dist/lib/devices/gateway.d.ts +98 -0
  80. package/dist/lib/devices/humidifier.d.ts +20 -0
  81. package/dist/lib/devices/philips-light-bulb.d.ts +8 -0
  82. package/dist/lib/devices/power-plug.d.ts +30 -0
  83. package/dist/lib/devices/power-strip.d.ts +7 -0
  84. package/dist/lib/devices/vacuums/dreamevacuum.d.ts +81 -0
  85. package/dist/lib/devices/vacuums/dreamevacuum.js +10 -2
  86. package/dist/lib/devices/vacuums/dreamevacuum.js.map +1 -1
  87. package/dist/lib/devices/vacuums/mijiavacuum.d.ts +4 -0
  88. package/dist/lib/devices/vacuums/miot-vacuum.d.ts +130 -0
  89. package/dist/lib/devices/vacuums/miot-vacuum.js +2 -0
  90. package/dist/lib/devices/vacuums/miot-vacuum.js.map +1 -1
  91. package/dist/lib/devices/vacuums/vacuum.d.ts +276 -0
  92. package/dist/lib/devices/vacuums/vacuum.js +2 -0
  93. package/dist/lib/devices/vacuums/vacuum.js.map +1 -1
  94. package/dist/lib/devices/vacuums/vacuum_device.d.ts +17 -0
  95. package/dist/lib/devices/vacuums/vacuum_device.js +14 -0
  96. package/dist/lib/devices/vacuums/vacuum_device.js.map +1 -0
  97. package/dist/lib/devices/vacuums/vacuum_errors.d.ts +10 -0
  98. package/dist/lib/devices/vacuums/vacuum_errors.js +25 -0
  99. package/dist/lib/devices/vacuums/vacuum_errors.js.map +1 -0
  100. package/dist/lib/devices/vacuums/vacuum_modes.d.ts +51 -0
  101. package/dist/lib/devices/vacuums/viomivacuum.d.ts +76 -0
  102. package/dist/lib/devices/vacuums/viomivacuum.js +2 -0
  103. package/dist/lib/devices/vacuums/viomivacuum.js.map +1 -1
  104. package/dist/lib/devices/yeelight.color.d.ts +3 -0
  105. package/dist/lib/devices/yeelight.d.ts +159 -0
  106. package/dist/lib/devices/yeelight.mono.d.ts +3 -0
  107. package/dist/lib/discovery.d.ts +53 -0
  108. package/dist/lib/events.d.ts +18 -0
  109. package/dist/lib/events.js +3 -0
  110. package/dist/lib/events.js.map +1 -0
  111. package/dist/lib/index.d.ts +60 -0
  112. package/dist/lib/index.js +5 -1
  113. package/dist/lib/index.js.map +1 -1
  114. package/dist/lib/info_from_hostname.d.ts +13 -0
  115. package/dist/lib/logger.d.ts +43 -0
  116. package/dist/lib/logger.js +62 -0
  117. package/dist/lib/logger.js.map +1 -0
  118. package/dist/lib/management.d.ts +53 -0
  119. package/dist/lib/maps/map_watcher.d.ts +71 -0
  120. package/dist/lib/maps/map_watcher.js +2 -5
  121. package/dist/lib/maps/map_watcher.js.map +1 -1
  122. package/dist/lib/maps/roborock_map.d.ts +83 -0
  123. package/dist/lib/miio_error.d.ts +12 -0
  124. package/dist/lib/miot/miot_api.d.ts +54 -0
  125. package/dist/lib/miot/miot_spec.d.ts +114 -0
  126. package/dist/lib/miot/spec_client.d.ts +125 -0
  127. package/dist/lib/miot/spec_client.js +2 -2
  128. package/dist/lib/miot/spec_client.js.map +1 -1
  129. package/dist/lib/models.d.ts +271 -0
  130. package/dist/lib/network.d.ts +58 -0
  131. package/dist/lib/network.js +5 -2
  132. package/dist/lib/network.js.map +1 -1
  133. package/dist/lib/packet.d.ts +21 -0
  134. package/dist/lib/placeholder.d.ts +7 -0
  135. package/dist/lib/protocol.d.ts +299 -0
  136. package/dist/lib/safeish_json.d.ts +7 -0
  137. package/dist/lib/tokens.d.ts +12 -0
  138. package/dist/types/abstract-things/climate/index.d.ts +431 -0
  139. package/dist/types/abstract-things/electricals/index.d.ts +5 -0
  140. package/dist/types/abstract-things/index.d.ts +206 -0
  141. package/dist/types/abstract-things/lights/index.d.ts +14 -0
  142. package/dist/types/abstract-things/values/index.d.ts +12 -0
  143. package/package.json +6 -3
  144. package/snapshots/vacuum-specs.json.gz +0 -0
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clearErrorOnRecovery = clearErrorOnRecovery;
4
+ /** The states in which a vacuum reports an error */
5
+ const ERROR_STATES = ["error", "charging-error", "charger-offline"];
6
+ /**
7
+ * Clears the error once the vacuum leaves the error states. abstract-things only clears it with `updateError(null)`,
8
+ * which the vacuums never called: once reported, an error was never cleared (`errorChanged` never emitted `null`).
9
+ *
10
+ * It doesn't use `updateError(null)` because that also marks the vacuum as not cleaning (wrong for e.g. `paused`).
11
+ *
12
+ * @param vacuum The vacuum
13
+ * @param state The new state
14
+ */
15
+ function clearErrorOnRecovery(vacuum, state) {
16
+ if (ERROR_STATES.includes(state))
17
+ return;
18
+ // Every vacuum has these (abstract-things' State and Thing), but not every mixin chain is typed
19
+ const stateful = vacuum;
20
+ if (stateful.updateState("error", null)) {
21
+ stateful.emitEvent("errorChanged", null);
22
+ stateful.emitEvent("errorCleared");
23
+ }
24
+ }
25
+ //# sourceMappingURL=vacuum_errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vacuum_errors.js","sourceRoot":"","sources":["../../../../src/lib/devices/vacuums/vacuum_errors.ts"],"names":[],"mappings":";;AAiBA,oDAQC;AAzBD,oDAAoD;AACpD,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;AAOpE;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAAC,MAAc,EAAE,KAAc;IACjE,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAe,CAAC;QAAE,OAAO;IACnD,gGAAgG;IAChG,MAAM,QAAQ,GAAG,MAAuB,CAAC;IACzC,IAAI,QAAQ,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC;QACxC,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QACzC,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACrC,CAAC;AACH,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Fan speed and water level values of the vacuums that don't describe them in a MIoT spec (legacy miIO models).
3
+ *
4
+ * Moved from the `models/` folder of homebridge-xiaomi-roborock-vacuum and matterbridge-xiaomi-roborock (same author,
5
+ * MIT-licensed), based on what users reported for each model and firmware version.
6
+ */
7
+ /** A selectable mode (fan speed or water level) */
8
+ export interface VacuumMode {
9
+ /** Raw value to send to the device (e.g. `changeFanSpeed(value)`) */
10
+ value: number;
11
+ /** Human-readable name */
12
+ name: string;
13
+ }
14
+ export interface VacuumModes {
15
+ fanSpeeds: VacuumMode[];
16
+ waterBoxModes: VacuumMode[];
17
+ }
18
+ export declare const FAN_SPEEDS: {
19
+ gen1: VacuumMode[];
20
+ gen2: VacuumMode[];
21
+ "gen2-no_mop": VacuumMode[];
22
+ "xiaowa-e202-02": VacuumMode[];
23
+ gen3: VacuumMode[];
24
+ gen4: VacuumMode[];
25
+ "gen4+custom": VacuumMode[];
26
+ gen5: VacuumMode[];
27
+ viomi: VacuumMode[];
28
+ dreame: VacuumMode[];
29
+ "dreame.vacuum.mc1808": VacuumMode[];
30
+ };
31
+ export declare const WATER_BOX_MODES: {
32
+ gen1: VacuumMode[];
33
+ "gen1+custom": VacuumMode[];
34
+ dreame: VacuumMode[];
35
+ };
36
+ /**
37
+ * Whether `firmware` is at least `minimum`.
38
+ *
39
+ * @param firmware The firmware version (e.g. `3.5.8_0008`)
40
+ * @param minimum The minimum version (e.g. `3.5.7`)
41
+ * @returns `true` if the firmware is equal to or newer than the minimum. `false` if unknown.
42
+ */
43
+ export declare function firmwareAtLeast(firmware: string | undefined, minimum: string): boolean;
44
+ /**
45
+ * The fan speeds and water levels of a legacy miIO vacuum.
46
+ *
47
+ * @param model The device model
48
+ * @param firmware The firmware version (from `miIO.info`'s `fw_ver`)
49
+ * @returns The modes (copies, safe to modify)
50
+ */
51
+ export declare function resolveVacuumModes(model: string, firmware?: string): VacuumModes;
@@ -0,0 +1,76 @@
1
+ import { ChargingState, AutonomousCharging } from "abstract-things";
2
+ import { Vacuum, AdjustableFanSpeed, AutonomousCleaning, SpotCleaning } from "abstract-things/climate";
3
+ import { MiioApi } from "../../device";
4
+ import { type VacuumMode } from "./vacuum_modes";
5
+ declare const ViomiVacuum_base: new (...args: unknown[]) => Vacuum & MiioApi & {
6
+ propertyUpdated(key: any, value: any): void;
7
+ id: string | null;
8
+ metadata: Record<string, unknown> & {
9
+ types: string[];
10
+ capabilities: string[];
11
+ addCapabilities(...capabilities: string[]): void;
12
+ };
13
+ init(): Promise</*elided*/ any | undefined>;
14
+ initCallback(): Promise<void>;
15
+ destroy(): Promise<void>;
16
+ destroyCallback(): Promise<void>;
17
+ debug(...parts: unknown[]): void;
18
+ matches(...tags: string[]): boolean;
19
+ emitEvent(event: string, data?: unknown, options?: unknown): void;
20
+ on(event: string, listener: (...args: never[]) => void): unknown;
21
+ off(event: string, listener: (...args: never[]) => void): unknown;
22
+ extendWith<T>(...mixins: T[]): T & import("abstract-things").Thing;
23
+ batteryLevel(): Promise<number>;
24
+ updateBatteryLevel(level: number): void;
25
+ } & import("abstract-things").Thing & AutonomousCharging & AutonomousCleaning & SpotCleaning & AdjustableFanSpeed & ChargingState;
26
+ export declare class ViomiVacuum extends ViomiVacuum_base {
27
+ static get type(): string;
28
+ constructor(options: any);
29
+ propertyUpdated<T>(key: string, value: T, oldValue?: T): void;
30
+ /**
31
+ * The fan speeds supported by this model, to be used with {@link changeFanSpeed}.
32
+ *
33
+ * @returns The list of modes
34
+ */
35
+ fanSpeeds(): Promise<VacuumMode[]>;
36
+ /**
37
+ * The water levels supported by this model. Empty if not supported.
38
+ *
39
+ * @returns The list of modes
40
+ */
41
+ waterBoxModes(): Promise<VacuumMode[]>;
42
+ getDeviceInfo(): Promise<import("../../protocol").MiioDeviceInfo>;
43
+ getSerialNumber(): Promise<string>;
44
+ getRoomMap(): Promise<[string, string][]>;
45
+ cleanRooms(listOfRooms: any): Promise<void>;
46
+ resumeCleanRooms(listOfRooms: any): Promise<void>;
47
+ getTimer(): Promise<import("../../protocol").GetTimerResponseTimer[]>;
48
+ /**
49
+ * Start a cleaning session.
50
+ */
51
+ activateCleaning(): Promise<void>;
52
+ /**
53
+ * Pause the current cleaning session.
54
+ */
55
+ pause(): Promise<void>;
56
+ /**
57
+ * Stop the current cleaning session.
58
+ */
59
+ deactivateCleaning(): Promise<void>;
60
+ /**
61
+ * Stop the current cleaning session and return to charge.
62
+ */
63
+ activateCharging(): Promise<void>;
64
+ /**
65
+ * Set the power of the fan.
66
+ * Values reported by users (#216 in homebridge-xiaomi-roborock-vacuum): 0 (Silent), 1 (Standard), 2 (Medium), 3 (Turbo).
67
+ *
68
+ * @param speed
69
+ */
70
+ changeFanSpeed(speed: any): Promise<void>;
71
+ /**
72
+ * Activate the find function, will make the device give off a sound.
73
+ */
74
+ find(): Promise<null>;
75
+ }
76
+ export {};
@@ -7,6 +7,7 @@ const device_1 = require("../../device");
7
7
  const battery_level_1 = require("../capabilities/battery-level");
8
8
  const check_result_1 = require("../../check_result");
9
9
  const vacuum_modes_1 = require("./vacuum_modes");
10
+ const vacuum_errors_1 = require("./vacuum_errors");
10
11
  class ViomiVacuum extends climate_1.Vacuum.with(device_1.MiioApi, battery_level_1.BatteryLevel, abstract_things_1.AutonomousCharging, climate_1.AutonomousCleaning, climate_1.SpotCleaning, climate_1.AdjustableFanSpeed, abstract_things_1.ChargingState) {
11
12
  static get type() {
12
13
  return "miio:vacuum";
@@ -82,6 +83,7 @@ class ViomiVacuum extends climate_1.Vacuum.with(device_1.MiioApi, battery_level_
82
83
  }
83
84
  propertyUpdated(key, value, oldValue) {
84
85
  if (key === "state") {
86
+ (0, vacuum_errors_1.clearErrorOnRecovery)(this, value);
85
87
  // Update charging state
86
88
  this.updateCharging(value === "charging");
87
89
  switch (value) {
@@ -1 +1 @@
1
- {"version":3,"file":"viomivacuum.js","sourceRoot":"","sources":["../../../../src/lib/devices/vacuums/viomivacuum.ts"],"names":[],"mappings":";;;AAAA,qDAAoE;AACpE,qDAKiC;AAEjC,yCAAuC;AACvC,iEAA6D;AAC7D,qDAAiD;AAEjD,iDAAqE;AAErE,MAAa,WAAY,SAAQ,gBAAM,CAAC,IAAI,CAC1C,gBAAO,EACP,4BAAY,EACZ,oCAAkB,EAClB,4BAAkB,EAClB,sBAAY,EACZ,4BAAkB,EAClB,+BAAa,CACd;IACC,MAAM,KAAK,IAAI;QACb,OAAO,aAAa,CAAC;IACvB,CAAC;IACD,YAAY,OAAO;QACjB,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE;YAC/B,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE;gBACZ,QAAQ,CAAC,EAAE,CAAC;oBACV,KAAK,CAAC;wBACJ,OAAO,IAAI,CAAC;oBACd;wBACE,OAAO;4BACL,IAAI,EAAE,CAAC;4BACP,OAAO,EAAE,gBAAgB,GAAG,CAAC;yBAC9B,CAAC;gBACN,CAAC;YACH,CAAC;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE;YAC/B,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE;gBACZ,QAAQ,CAAC,EAAE,CAAC;oBACV,KAAK,CAAC;wBACJ,OAAO,QAAQ,CAAC;oBAClB,KAAK,CAAC;wBACJ,OAAO,YAAY,CAAC;oBACtB,KAAK,CAAC;wBACJ,OAAO,SAAS,CAAC;oBACnB,KAAK,CAAC;wBACJ,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SACnB,CAAC,CAAC,IAAI,CAAC,0BAAW,CAAC,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,KAAK,EAAE;aAChB,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;aAC/D,IAAI,CAAC,GAAG,EAAE,CACT,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE;YAC3B,OAAO,EAAE,CAAC,OAAO,CAAC;YAClB,YAAY,EAAE,IAAI;SACnB,CAAC,CACH;aACA,IAAI,CAAC,0BAAW,CAAC,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,cAAc,CAAC,KAAK;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,EAAE;YACvC,OAAO,EAAE,CAAC,UAAU,CAAC;SACtB,CAAC,CAAC,IAAI,CAAC,0BAAW,CAAC,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC;CACF;AAvPD,kCAuPC"}
@@ -0,0 +1,3 @@
1
+ export = YeelightColor;
2
+ declare class YeelightColor {
3
+ }
@@ -0,0 +1,159 @@
1
+ export const ColorTemperature: new (...args: any[]) => {
2
+ propertyUpdated(key: any, value: any): void;
3
+ changeColor(color: any, options: any): Promise<null>;
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>) & (() => Promise<void>);
14
+ debug: ((...parts: unknown[]) => void) & ((...msgs: 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
+ readonly miioModel?: string;
21
+ readonly _properties: Record<string, unknown>;
22
+ readonly _propertiesToMonitor: string[];
23
+ readonly _propertyDefinitions: Record<string, import("../device").PersistedPropertyDefinition<never, never>>;
24
+ readonly _reversePropertyDefinitions: Record<string, string>;
25
+ readonly management: import("../management").DeviceManagement;
26
+ debugFn?: import("../logger").DebugFn;
27
+ readonly handle: import("../management").DeviceHandle;
28
+ 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>;
29
+ 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?: {
30
+ refresh?: string[];
31
+ refreshDelay?: number;
32
+ sid?: number;
33
+ retries?: number;
34
+ }): Promise<Response>;
35
+ defineProperty<T, V>(name: string, def?: import("../device").Mapper<T, V> | import("../device").PropertyDefinition<T, V> | undefined): void;
36
+ _pushProperty(result: Record<string, unknown>, name: string, value: unknown): void;
37
+ poll(_isInitial?: boolean): Promise<void>;
38
+ _loadProperties(properties?: string[]): Promise<void>;
39
+ setProperty(key: string, value: unknown): void;
40
+ setRawProperty(name: string, value: unknown): void;
41
+ property<T>(key: string): T;
42
+ get connected(): boolean;
43
+ get properties(): Record<string, unknown>;
44
+ miioProperties(): Record<string, unknown>;
45
+ getProperties(props: string[]): {};
46
+ loadProperties(props: string[]): Promise<{}>;
47
+ updatePollDuration(duration: number): void;
48
+ updateMaxPollFailures(failures: number): void;
49
+ updateColor(value: import("abstract-things/values").Color): void;
50
+ } & Thing;
51
+ export const ColorFull: new (...args: any[]) => {
52
+ propertyUpdated(key: any, value: any): void;
53
+ changeColor(color: any, options: any): Promise<null>;
54
+ id: string | null;
55
+ metadata: Record<string, unknown> & {
56
+ types: string[];
57
+ capabilities: string[];
58
+ addCapabilities(...capabilities: string[]): void;
59
+ };
60
+ init(): Promise</*elided*/ any | undefined>;
61
+ initCallback(): Promise<void>;
62
+ destroy(): Promise<void>;
63
+ destroyCallback: (() => Promise<void>) & (() => Promise<void>);
64
+ debug: ((...parts: unknown[]) => void) & ((...msgs: unknown[]) => void);
65
+ matches(...tags: string[]): boolean;
66
+ emitEvent(event: string, data?: unknown, options?: unknown): void;
67
+ on(event: string, listener: (...args: never[]) => void): unknown;
68
+ off(event: string, listener: (...args: never[]) => void): unknown;
69
+ extendWith<T>(...mixins: T[]): T & Thing;
70
+ readonly miioModel?: string;
71
+ readonly _properties: Record<string, unknown>;
72
+ readonly _propertiesToMonitor: string[];
73
+ readonly _propertyDefinitions: Record<string, import("../device").PersistedPropertyDefinition<never, never>>;
74
+ readonly _reversePropertyDefinitions: Record<string, string>;
75
+ readonly management: import("../management").DeviceManagement;
76
+ debugFn?: import("../logger").DebugFn;
77
+ readonly handle: import("../management").DeviceHandle;
78
+ 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>;
79
+ 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?: {
80
+ refresh?: string[];
81
+ refreshDelay?: number;
82
+ sid?: number;
83
+ retries?: number;
84
+ }): Promise<Response>;
85
+ defineProperty<T, V>(name: string, def?: import("../device").Mapper<T, V> | import("../device").PropertyDefinition<T, V> | undefined): void;
86
+ _pushProperty(result: Record<string, unknown>, name: string, value: unknown): void;
87
+ poll(_isInitial?: boolean): Promise<void>;
88
+ _loadProperties(properties?: string[]): Promise<void>;
89
+ setProperty(key: string, value: unknown): void;
90
+ setRawProperty(name: string, value: unknown): void;
91
+ property<T>(key: string): T;
92
+ get connected(): boolean;
93
+ get properties(): Record<string, unknown>;
94
+ miioProperties(): Record<string, unknown>;
95
+ getProperties(props: string[]): {};
96
+ loadProperties(props: string[]): Promise<{}>;
97
+ updatePollDuration(duration: number): void;
98
+ updateMaxPollFailures(failures: number): void;
99
+ updateColor(value: import("abstract-things/values").Color): void;
100
+ } & Thing;
101
+ export const Yeelight: new (options?: any) => {
102
+ propertyUpdated(key: any, value: any): void;
103
+ changePower(power: any): Promise<null>;
104
+ /**
105
+ * Make the current state the default state, meaning the light will restore
106
+ * to this state after power has been cut.
107
+ */
108
+ setDefault(): Promise<null>;
109
+ changeBrightness(brightness: any, options: any): Promise<null>;
110
+ changeName(name: any): Promise<any>;
111
+ id: string | null;
112
+ metadata: Record<string, unknown> & {
113
+ types: string[];
114
+ capabilities: string[];
115
+ addCapabilities(...capabilities: string[]): void;
116
+ };
117
+ init(): Promise</*elided*/ any | undefined>;
118
+ initCallback(): Promise<void>;
119
+ destroy(): Promise<void>;
120
+ destroyCallback: (() => Promise<void>) & (() => Promise<void>);
121
+ debug: ((...parts: unknown[]) => void) & ((...msgs: unknown[]) => void);
122
+ matches(...tags: string[]): boolean;
123
+ emitEvent(event: string, data?: unknown, options?: unknown): void;
124
+ on(event: string, listener: (...args: never[]) => void): unknown;
125
+ off(event: string, listener: (...args: never[]) => void): unknown;
126
+ extendWith<T>(...mixins: T[]): T & Thing;
127
+ readonly miioModel?: string;
128
+ readonly _properties: Record<string, unknown>;
129
+ readonly _propertiesToMonitor: string[];
130
+ readonly _propertyDefinitions: Record<string, import("../device").PersistedPropertyDefinition<never, never>>;
131
+ readonly _reversePropertyDefinitions: Record<string, string>;
132
+ readonly management: import("../management").DeviceManagement;
133
+ debugFn?: import("../logger").DebugFn;
134
+ readonly handle: import("../management").DeviceHandle;
135
+ 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>;
136
+ 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?: {
137
+ refresh?: string[];
138
+ refreshDelay?: number;
139
+ sid?: number;
140
+ retries?: number;
141
+ }): Promise<Response>;
142
+ defineProperty<T, V>(name: string, def?: import("../device").Mapper<T, V> | import("../device").PropertyDefinition<T, V> | undefined): void;
143
+ _pushProperty(result: Record<string, unknown>, name: string, value: unknown): void;
144
+ poll(_isInitial?: boolean): Promise<void>;
145
+ _loadProperties(properties?: string[]): Promise<void>;
146
+ setProperty(key: string, value: unknown): void;
147
+ setRawProperty(name: string, value: unknown): void;
148
+ property<T>(key: string): T;
149
+ get connected(): boolean;
150
+ get properties(): Record<string, unknown>;
151
+ miioProperties(): Record<string, unknown>;
152
+ getProperties(props: string[]): {};
153
+ loadProperties(props: string[]): Promise<{}>;
154
+ updatePollDuration(duration: number): void;
155
+ updateMaxPollFailures(failures: number): void;
156
+ updatePower<T>(value: T): void;
157
+ updateBrightness(value: number): void;
158
+ } & Thing;
159
+ import { Thing } from "abstract-things";
@@ -0,0 +1,3 @@
1
+ export = YeelightMono;
2
+ declare class YeelightMono {
3
+ }
@@ -0,0 +1,53 @@
1
+ import util from "node:util";
2
+ import { TimedServiceDiscovery, BasicServiceDiscovery, type Service } from "tinkerhub-discovery";
3
+ import { type ConnectToDeviceOptions } from "./connect_to_device";
4
+ import type { DeviceInfo } from "./device_info";
5
+ import type { IDevice } from "./device";
6
+ declare const tryAdd: unique symbol;
7
+ export interface BrowserOptions {
8
+ cacheTime?: number;
9
+ tokens?: Record<string, string>;
10
+ }
11
+ interface BrowserService extends Service {
12
+ address: string;
13
+ port: number;
14
+ token: string | Buffer | null;
15
+ autoToken?: boolean;
16
+ model?: string;
17
+ hostname?: string;
18
+ connect: (options?: Partial<ConnectToDeviceOptions>) => Promise<IDevice | undefined>;
19
+ }
20
+ export declare class Browser extends TimedServiceDiscovery<BrowserService> {
21
+ static get type(): string;
22
+ private handle?;
23
+ private readonly manualTokens;
24
+ constructor(options: BrowserOptions);
25
+ _manualToken(id: any): string | null;
26
+ start(): void;
27
+ destroy(): Promise<void>;
28
+ search(): void;
29
+ [tryAdd](device: DeviceInfo): void;
30
+ [util.inspect.custom](): string;
31
+ }
32
+ export interface DevicesOptions extends BrowserOptions {
33
+ token?: string | Buffer;
34
+ filter?: (reg: {
35
+ id: string;
36
+ model: string;
37
+ type: string;
38
+ }) => boolean;
39
+ skipSubDevices?: boolean;
40
+ }
41
+ export declare class Devices extends BasicServiceDiscovery<IDevice & {
42
+ id: string;
43
+ }> {
44
+ static get type(): string;
45
+ private readonly _filter?;
46
+ private readonly _skipSubDevices?;
47
+ private readonly _browser;
48
+ constructor(options: DevicesOptions);
49
+ destroy(): Promise<void>;
50
+ [util.inspect.custom](): string;
51
+ _bindSubDevices(device: any): void;
52
+ }
53
+ export {};
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Payload of the `stateChanged` event (`device.on("stateChanged", ...)`), emitted for every change of `state()`.
3
+ */
4
+ export interface StateChangedEvent {
5
+ key: string;
6
+ value: unknown;
7
+ }
8
+ /**
9
+ * Payload of the `errorChanged` event (`device.on("errorChanged", ...)`): the error, or `null` when it's cleared.
10
+ *
11
+ * abstract-things converts the errors set by the devices (`{ code, message }`) into this shape.
12
+ */
13
+ export type ErrorChangedEvent = {
14
+ /** The error code, e.g. `10` (Roborock) or `"charging-error"` */
15
+ id: number | string;
16
+ /** A human-readable description, if known */
17
+ description?: string;
18
+ } | null;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/lib/events.ts"],"names":[],"mappings":""}
@@ -0,0 +1,60 @@
1
+ /// <reference path="../types/abstract-things/climate/index.d.ts" />
2
+ /// <reference path="../types/abstract-things/electricals/index.d.ts" />
3
+ /// <reference path="../types/abstract-things/index.d.ts" />
4
+ /// <reference path="../types/abstract-things/lights/index.d.ts" />
5
+ /// <reference path="../types/abstract-things/values/index.d.ts" />
6
+ import * as discovery from "./discovery";
7
+ import { models } from "./models";
8
+ import { connectToDevice } from "./connect_to_device";
9
+ import { infoFromHostname } from "./info_from_hostname";
10
+ import type { BrowserOptions, DevicesOptions } from "./discovery";
11
+ export { Device as MiioDevice } from "./device";
12
+ export { MiioError } from "./miio_error";
13
+ export { configureLogging, type MiioLogger } from "./logger";
14
+ export type { StateChangedEvent, ErrorChangedEvent } from "./events";
15
+ export { Vacuum, MOP_ROUTES, type RoborockConsumable, } from "./devices/vacuums/vacuum";
16
+ export { resolveVacuumModes, type VacuumMode, type VacuumModes, } from "./devices/vacuums/vacuum_modes";
17
+ export { MijiaVacuum } from "./devices/vacuums/mijiavacuum";
18
+ export { isVacuum, type VacuumDevice } from "./devices/vacuums/vacuum_device";
19
+ export { ViomiVacuum } from "./devices/vacuums/viomivacuum";
20
+ export { DreameVacuum } from "./devices/vacuums/dreamevacuum";
21
+ export { MiotVacuum, type MiotMode } from "./devices/vacuums/miot-vacuum";
22
+ export { MiotSpecClient, configureMiotSpecs, type MiotSpecOptions, type ResolvedMiotSpec, } from "./miot/spec_client";
23
+ export { MiotSpecIndex, parseUrn, type MiotSpec } from "./miot/miot_spec";
24
+ export { MiotError } from "./miot/miot_api";
25
+ export * from "./cloud/index";
26
+ export { parseRoborockMap, roomAt, roomOfPixel, MapParseError, MM_PER_PIXEL, PIXEL, type RoborockMap, type MapRoom, type MapPoint, type MapRectangle, type MapArea, type MapImage, } from "./maps/roborock_map";
27
+ export { MapWatcher, type MapWatcherDevice, type MapWatcherOptions, type MapWatcherEvents, } from "./maps/map_watcher";
28
+ export {
29
+ /**
30
+ * Get information about the models supported. Can be used to extend the models
31
+ * supported.
32
+ */
33
+ models,
34
+ /**
35
+ * Resolve a device from the given options.
36
+ *
37
+ * Options:
38
+ * `address`, **required** the address to the device as an IP or hostname
39
+ * `port`, optional port number, if not specified the default 54321 will be used
40
+ * `token`, optional token of the device
41
+ */
42
+ connectToDevice as device,
43
+ /**
44
+ * Extract information about a device from its hostname on the local network.
45
+ */
46
+ infoFromHostname, };
47
+ /**
48
+ * Browse for devices available on the network. Will not automatically
49
+ * connect to them.
50
+ *
51
+ * @param options
52
+ */
53
+ export declare function browse(options?: BrowserOptions): discovery.Browser;
54
+ /**
55
+ * Get access to all devices on the current network. Will find and connect to
56
+ * devices automatically.
57
+ *
58
+ * @param options
59
+ */
60
+ export declare function devices(options?: DevicesOptions): discovery.Devices;
package/dist/lib/index.js CHANGED
@@ -36,7 +36,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.infoFromHostname = exports.device = exports.models = exports.MapWatcher = exports.PIXEL = exports.MM_PER_PIXEL = exports.MapParseError = exports.roomOfPixel = exports.roomAt = exports.parseRoborockMap = exports.MiotError = exports.parseUrn = exports.MiotSpecIndex = exports.configureMiotSpecs = exports.MiotSpecClient = exports.MiotVacuum = exports.DreameVacuum = exports.ViomiVacuum = exports.MijiaVacuum = exports.resolveVacuumModes = exports.MOP_ROUTES = exports.Vacuum = exports.MiioError = exports.MiioDevice = void 0;
39
+ exports.infoFromHostname = exports.device = exports.models = exports.MapWatcher = exports.PIXEL = exports.MM_PER_PIXEL = exports.MapParseError = exports.roomOfPixel = exports.roomAt = exports.parseRoborockMap = exports.MiotError = exports.parseUrn = exports.MiotSpecIndex = exports.configureMiotSpecs = exports.MiotSpecClient = exports.MiotVacuum = exports.DreameVacuum = exports.ViomiVacuum = exports.isVacuum = exports.MijiaVacuum = exports.resolveVacuumModes = exports.MOP_ROUTES = exports.Vacuum = exports.configureLogging = exports.MiioError = exports.MiioDevice = void 0;
40
40
  exports.browse = browse;
41
41
  exports.devices = devices;
42
42
  const discovery = __importStar(require("./discovery"));
@@ -50,6 +50,8 @@ var device_1 = require("./device");
50
50
  Object.defineProperty(exports, "MiioDevice", { enumerable: true, get: function () { return device_1.Device; } });
51
51
  var miio_error_1 = require("./miio_error");
52
52
  Object.defineProperty(exports, "MiioError", { enumerable: true, get: function () { return miio_error_1.MiioError; } });
53
+ var logger_1 = require("./logger");
54
+ Object.defineProperty(exports, "configureLogging", { enumerable: true, get: function () { return logger_1.configureLogging; } });
53
55
  var vacuum_1 = require("./devices/vacuums/vacuum");
54
56
  Object.defineProperty(exports, "Vacuum", { enumerable: true, get: function () { return vacuum_1.Vacuum; } });
55
57
  Object.defineProperty(exports, "MOP_ROUTES", { enumerable: true, get: function () { return vacuum_1.MOP_ROUTES; } });
@@ -57,6 +59,8 @@ var vacuum_modes_1 = require("./devices/vacuums/vacuum_modes");
57
59
  Object.defineProperty(exports, "resolveVacuumModes", { enumerable: true, get: function () { return vacuum_modes_1.resolveVacuumModes; } });
58
60
  var mijiavacuum_1 = require("./devices/vacuums/mijiavacuum");
59
61
  Object.defineProperty(exports, "MijiaVacuum", { enumerable: true, get: function () { return mijiavacuum_1.MijiaVacuum; } });
62
+ var vacuum_device_1 = require("./devices/vacuums/vacuum_device");
63
+ Object.defineProperty(exports, "isVacuum", { enumerable: true, get: function () { return vacuum_device_1.isVacuum; } });
60
64
  var viomivacuum_1 = require("./devices/vacuums/viomivacuum");
61
65
  Object.defineProperty(exports, "ViomiVacuum", { enumerable: true, get: function () { return viomivacuum_1.ViomiVacuum; } });
62
66
  var dreamevacuum_1 = require("./devices/vacuums/dreamevacuum");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,w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CAAC,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,OAAwB;IAC9C,OAAO,IAAI,SAAS,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ *
3
+ * @param hostname
4
+ */
5
+ export declare function infoFromHostname(hostname: string): {
6
+ model: string;
7
+ type: string;
8
+ id?: undefined;
9
+ } | {
10
+ model: string;
11
+ id: string;
12
+ type?: undefined;
13
+ } | null;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * A logger that node-miio can send its debug messages to, e.g. the one provided by Homebridge or Matterbridge.
3
+ * Only `debug` is used: node-miio doesn't log anything above that level.
4
+ */
5
+ export interface MiioLogger {
6
+ debug(message: string, ...args: unknown[]): void;
7
+ }
8
+ export type DebugFn = (...msgs: unknown[]) => void;
9
+ /**
10
+ * Sends node-miio's debug messages to a logger, in addition to the `debug` package (`DEBUG=miio*`, used by the CLI).
11
+ *
12
+ * This is the global logger, used for messages that aren't about a specific device (network, MIoT specs, cloud…).
13
+ * Use the `logger` option of `device()` for the messages of a specific device.
14
+ *
15
+ * @param options The options
16
+ * @param options.logger The logger, or `undefined` to stop sending messages to it
17
+ */
18
+ export declare function configureLogging(options: {
19
+ logger?: MiioLogger;
20
+ }): void;
21
+ /**
22
+ * Removes secrets (tokens, passwords) from a log message, so users can share their logs safely.
23
+ *
24
+ * @param message The message
25
+ * @returns The message, with the secrets replaced by `***`
26
+ */
27
+ export declare function redact(message: string): string;
28
+ /**
29
+ * Masks a token: only its first 4 characters are kept, enough to tell tokens apart.
30
+ *
31
+ * @param token The token as hex
32
+ * @returns The masked token
33
+ */
34
+ export declare function maskToken(token?: string): string;
35
+ /**
36
+ * Creates a debug function that logs to the `debug` package under `namespace`, and to a {@link MiioLogger}:
37
+ * the one returned by `getLogger` (e.g. the device's), or the global one (see {@link configureLogging}).
38
+ *
39
+ * @param namespace The `debug` namespace (e.g. `miio:network`)
40
+ * @param getLogger Returns the logger to use instead of the global one, if any
41
+ * @returns The debug function
42
+ */
43
+ export declare function createDebug(namespace: string, getLogger?: () => MiioLogger | undefined): DebugFn;