node-miio 0.3.0-beta.1 → 0.3.0-beta.4
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/AGENTS.md +115 -0
- package/README.md +41 -2
- package/dist/cli/commands/configure.js +60 -0
- package/dist/cli/commands/configure.js.map +1 -0
- package/dist/cli/commands/control.js +47 -0
- package/dist/cli/commands/control.js.map +1 -0
- package/dist/cli/commands/discover.js +32 -0
- package/dist/cli/commands/discover.js.map +1 -0
- package/dist/cli/commands/inspect.js +183 -0
- package/dist/cli/commands/inspect.js.map +1 -0
- package/dist/cli/commands/miot-spec.js +60 -0
- package/dist/cli/commands/miot-spec.js.map +1 -0
- package/dist/cli/commands/protocol/call.js +59 -0
- package/dist/cli/commands/protocol/call.js.map +1 -0
- package/dist/cli/commands/protocol/json-dump.js +56 -0
- package/dist/cli/commands/protocol/json-dump.js.map +1 -0
- package/dist/cli/commands/protocol/packet.js +30 -0
- package/dist/cli/commands/protocol/packet.js.map +1 -0
- package/dist/cli/commands/protocol.js +49 -0
- package/dist/cli/commands/protocol.js.map +1 -0
- package/dist/cli/commands/tokens/update.js +53 -0
- package/dist/cli/commands/tokens/update.js.map +1 -0
- package/dist/cli/commands/tokens.js +44 -0
- package/dist/cli/commands/tokens.js.map +1 -0
- package/dist/cli/device-finder.js +72 -0
- package/dist/cli/device-finder.js.map +1 -0
- package/dist/cli/index.js +64 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/log.js +69 -0
- package/dist/cli/log.js.map +1 -0
- package/dist/lib/check_result.js +18 -0
- package/dist/lib/check_result.js.map +1 -0
- package/dist/lib/connect_to_device.js +123 -0
- package/dist/lib/connect_to_device.js.map +1 -0
- package/dist/lib/device.js +259 -0
- package/dist/lib/device.js.map +1 -0
- package/dist/lib/device_info.js +297 -0
- package/dist/lib/device_info.js.map +1 -0
- package/dist/lib/devices/air-monitor.js +42 -0
- package/dist/lib/devices/air-monitor.js.map +1 -0
- package/dist/lib/devices/air-purifier.js +144 -0
- package/dist/lib/devices/air-purifier.js.map +1 -0
- package/dist/lib/devices/capabilities/battery-level.js +13 -0
- package/dist/lib/devices/capabilities/battery-level.js.map +1 -0
- package/dist/lib/devices/capabilities/buzzer.js +69 -0
- package/dist/lib/devices/capabilities/buzzer.js.map +1 -0
- package/dist/lib/devices/capabilities/changeable-led-brightness.js +44 -0
- package/dist/lib/devices/capabilities/changeable-led-brightness.js.map +1 -0
- package/dist/lib/devices/capabilities/colorable.js +14 -0
- package/dist/lib/devices/capabilities/colorable.js.map +1 -0
- package/dist/lib/devices/capabilities/dimmable.js +14 -0
- package/dist/lib/devices/capabilities/dimmable.js.map +1 -0
- package/dist/lib/devices/capabilities/mode.js +13 -0
- package/dist/lib/devices/capabilities/mode.js.map +1 -0
- package/dist/lib/devices/capabilities/power.js +13 -0
- package/dist/lib/devices/capabilities/power.js.map +1 -0
- package/dist/lib/devices/capabilities/sensor.js +46 -0
- package/dist/lib/devices/capabilities/sensor.js.map +1 -0
- package/dist/lib/devices/capabilities/switchable-led.js +48 -0
- package/dist/lib/devices/capabilities/switchable-led.js.map +1 -0
- package/dist/lib/devices/chuangmi.plug.v1.js +47 -0
- package/dist/lib/devices/chuangmi.plug.v1.js.map +1 -0
- package/dist/lib/devices/eyecare-lamp2.js +151 -0
- package/dist/lib/devices/eyecare-lamp2.js.map +1 -0
- package/dist/lib/devices/gateway/86sw1.js +20 -0
- package/dist/lib/devices/gateway/86sw1.js.map +1 -0
- package/dist/lib/devices/gateway/86sw2.js +36 -0
- package/dist/lib/devices/gateway/86sw2.js.map +1 -0
- package/dist/lib/devices/gateway/ctrl_ln1.js +37 -0
- package/dist/lib/devices/gateway/ctrl_ln1.js.map +1 -0
- package/dist/lib/devices/gateway/ctrl_ln2.js +45 -0
- package/dist/lib/devices/gateway/ctrl_ln2.js.map +1 -0
- package/dist/lib/devices/gateway/ctrl_neutral1.js +37 -0
- package/dist/lib/devices/gateway/ctrl_neutral1.js.map +1 -0
- package/dist/lib/devices/gateway/ctrl_neutral2.js +45 -0
- package/dist/lib/devices/gateway/ctrl_neutral2.js.map +1 -0
- package/dist/lib/devices/gateway/cube.js +49 -0
- package/dist/lib/devices/gateway/cube.js.map +1 -0
- package/dist/lib/devices/gateway/developer-api.js +104 -0
- package/dist/lib/devices/gateway/developer-api.js.map +1 -0
- package/dist/lib/devices/gateway/light-channel.js +24 -0
- package/dist/lib/devices/gateway/light-channel.js.map +1 -0
- package/dist/lib/devices/gateway/light-mixin.js +59 -0
- package/dist/lib/devices/gateway/light-mixin.js.map +1 -0
- package/dist/lib/devices/gateway/magnet.js +23 -0
- package/dist/lib/devices/gateway/magnet.js.map +1 -0
- package/dist/lib/devices/gateway/magnet2.js +9 -0
- package/dist/lib/devices/gateway/magnet2.js.map +1 -0
- package/dist/lib/devices/gateway/motion.js +21 -0
- package/dist/lib/devices/gateway/motion.js.map +1 -0
- package/dist/lib/devices/gateway/motion2.js +25 -0
- package/dist/lib/devices/gateway/motion2.js.map +1 -0
- package/dist/lib/devices/gateway/plug.js +34 -0
- package/dist/lib/devices/gateway/plug.js.map +1 -0
- package/dist/lib/devices/gateway/sensor_ht.js +13 -0
- package/dist/lib/devices/gateway/sensor_ht.js.map +1 -0
- package/dist/lib/devices/gateway/subdevice.js +203 -0
- package/dist/lib/devices/gateway/subdevice.js.map +1 -0
- package/dist/lib/devices/gateway/subdevices.js +33 -0
- package/dist/lib/devices/gateway/subdevices.js.map +1 -0
- package/dist/lib/devices/gateway/switch.js +24 -0
- package/dist/lib/devices/gateway/switch.js.map +1 -0
- package/dist/lib/devices/gateway/switch2.js +19 -0
- package/dist/lib/devices/gateway/switch2.js.map +1 -0
- package/dist/lib/devices/gateway/voltage.js +21 -0
- package/dist/lib/devices/gateway/voltage.js.map +1 -0
- package/dist/lib/devices/gateway/weather.js +16 -0
- package/dist/lib/devices/gateway/weather.js.map +1 -0
- package/dist/lib/devices/gateway.js +212 -0
- package/dist/lib/devices/gateway.js.map +1 -0
- package/dist/lib/devices/humidifier.js +141 -0
- package/dist/lib/devices/humidifier.js.map +1 -0
- package/dist/lib/devices/philips-light-bulb.js +63 -0
- package/dist/lib/devices/philips-light-bulb.js.map +1 -0
- package/dist/lib/devices/power-plug.js +22 -0
- package/dist/lib/devices/power-plug.js.map +1 -0
- package/dist/lib/devices/power-strip.js +27 -0
- package/dist/lib/devices/power-strip.js.map +1 -0
- package/dist/lib/devices/vacuums/dreamevacuum.js +312 -0
- package/dist/lib/devices/vacuums/dreamevacuum.js.map +1 -0
- package/dist/lib/devices/vacuums/mijiavacuum.js +21 -0
- package/dist/lib/devices/vacuums/mijiavacuum.js.map +1 -0
- package/dist/lib/devices/vacuums/miot-vacuum.js +395 -0
- package/dist/lib/devices/vacuums/miot-vacuum.js.map +1 -0
- package/dist/lib/devices/vacuums/vacuum.js +669 -0
- package/dist/lib/devices/vacuums/vacuum.js.map +1 -0
- package/dist/lib/devices/vacuums/vacuum_modes.js +171 -0
- package/dist/lib/devices/vacuums/vacuum_modes.js.map +1 -0
- package/dist/lib/devices/vacuums/viomivacuum.js +222 -0
- package/dist/lib/devices/vacuums/viomivacuum.js.map +1 -0
- package/dist/lib/devices/yeelight.color.js +5 -0
- package/dist/lib/devices/yeelight.color.js.map +1 -0
- package/dist/lib/devices/yeelight.js +242 -0
- package/dist/lib/devices/yeelight.js.map +1 -0
- package/dist/lib/devices/yeelight.mono.js +5 -0
- package/dist/lib/devices/yeelight.mono.js.map +1 -0
- package/dist/lib/discovery.js +147 -0
- package/dist/lib/discovery.js.map +1 -0
- package/dist/lib/index.js +89 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/info_from_hostname.js +27 -0
- package/dist/lib/info_from_hostname.js.map +1 -0
- package/dist/lib/management.js +101 -0
- package/dist/lib/management.js.map +1 -0
- package/dist/lib/miio_error.js +23 -0
- package/dist/lib/miio_error.js.map +1 -0
- package/dist/lib/miot/miot_api.js +73 -0
- package/dist/lib/miot/miot_api.js.map +1 -0
- package/dist/lib/miot/miot_spec.js +105 -0
- package/dist/lib/miot/miot_spec.js.map +1 -0
- package/dist/lib/miot/spec_client.js +290 -0
- package/dist/lib/miot/spec_client.js.map +1 -0
- package/dist/lib/models.js +69 -0
- package/dist/lib/models.js.map +1 -0
- package/dist/lib/network.js +194 -0
- package/dist/lib/network.js.map +1 -0
- package/dist/lib/packet.js +177 -0
- package/dist/lib/packet.js.map +1 -0
- package/dist/lib/placeholder.js +16 -0
- package/dist/lib/placeholder.js.map +1 -0
- package/dist/lib/protocol.js +3 -0
- package/dist/lib/protocol.js.map +1 -0
- package/dist/lib/safeish_json.js +22 -0
- package/dist/lib/safeish_json.js.map +1 -0
- package/dist/lib/tokens.js +30 -0
- package/dist/lib/tokens.js.map +1 -0
- package/docs/devices/vacuum.md +53 -3
- package/example.js +1 -1
- package/package.json +49 -16
- package/snapshots/vacuum-specs.json.gz +0 -0
- package/.editorconfig +0 -26
- package/.eslintrc +0 -32
- package/.github/release.yml +0 -20
- package/.github/workflows/build.yml +0 -50
- package/.github/workflows/codecov.yml +0 -35
- package/.github/workflows/codeql.yml +0 -24
- package/.github/workflows/publish-dev-from-main.yml +0 -92
- package/.github/workflows/publish-release-to-npm.yml +0 -45
- package/cli/commands/configure.js +0 -69
- package/cli/commands/control.js +0 -54
- package/cli/commands/discover.js +0 -36
- package/cli/commands/inspect.js +0 -197
- package/cli/commands/protocol/call.js +0 -66
- package/cli/commands/protocol/json-dump.js +0 -52
- package/cli/commands/protocol/packet.js +0 -29
- package/cli/commands/protocol.js +0 -8
- package/cli/commands/tokens/update.js +0 -58
- package/cli/commands/tokens.js +0 -8
- package/cli/device-finder.js +0 -69
- package/cli/index.js +0 -9
- package/cli/log.js +0 -89
- package/lib/checkResult.js +0 -13
- package/lib/connectToDevice.js +0 -66
- package/lib/device.js +0 -290
- package/lib/device_info.js +0 -329
- package/lib/device_info.test.js +0 -337
- package/lib/devices/air-monitor.js +0 -53
- package/lib/devices/air-purifier.js +0 -162
- package/lib/devices/capabilities/battery-level.js +0 -16
- package/lib/devices/capabilities/buzzer.js +0 -78
- package/lib/devices/capabilities/changeable-led-brightness.js +0 -48
- package/lib/devices/capabilities/colorable.js +0 -14
- package/lib/devices/capabilities/dimmable.js +0 -14
- package/lib/devices/capabilities/mode.js +0 -13
- package/lib/devices/capabilities/power.js +0 -14
- package/lib/devices/capabilities/sensor.js +0 -50
- package/lib/devices/capabilities/switchable-led.js +0 -49
- package/lib/devices/chuangmi.plug.v1.js +0 -61
- package/lib/devices/eyecare-lamp2.js +0 -179
- package/lib/devices/gateway/86sw1.js +0 -28
- package/lib/devices/gateway/86sw2.js +0 -44
- package/lib/devices/gateway/ctrl_ln1.js +0 -44
- package/lib/devices/gateway/ctrl_ln2.js +0 -53
- package/lib/devices/gateway/ctrl_neutral1.js +0 -44
- package/lib/devices/gateway/ctrl_neutral2.js +0 -53
- package/lib/devices/gateway/cube.js +0 -55
- package/lib/devices/gateway/developer-api.js +0 -120
- package/lib/devices/gateway/light-channel.js +0 -32
- package/lib/devices/gateway/light-mixin.js +0 -71
- package/lib/devices/gateway/magnet.js +0 -29
- package/lib/devices/gateway/magnet2.js +0 -13
- package/lib/devices/gateway/motion.js +0 -27
- package/lib/devices/gateway/motion2.js +0 -31
- package/lib/devices/gateway/plug.js +0 -45
- package/lib/devices/gateway/sensor_ht.js +0 -17
- package/lib/devices/gateway/subdevice.js +0 -227
- package/lib/devices/gateway/subdevices.js +0 -37
- package/lib/devices/gateway/switch.js +0 -29
- package/lib/devices/gateway/switch2.js +0 -27
- package/lib/devices/gateway/voltage.js +0 -28
- package/lib/devices/gateway/weather.js +0 -22
- package/lib/devices/gateway.js +0 -244
- package/lib/devices/humidifier.js +0 -162
- package/lib/devices/philips-light-bulb.js +0 -73
- package/lib/devices/power-plug.js +0 -26
- package/lib/devices/power-strip.js +0 -38
- package/lib/devices/vacuums/dreamevacuum.js +0 -349
- package/lib/devices/vacuums/mijiavacuum.js +0 -22
- package/lib/devices/vacuums/vacuum.js +0 -518
- package/lib/devices/vacuums/viomivacuum.js +0 -250
- package/lib/devices/yeelight.color.js +0 -6
- package/lib/devices/yeelight.js +0 -286
- package/lib/devices/yeelight.mono.js +0 -9
- package/lib/discovery.js +0 -192
- package/lib/index.js +0 -40
- package/lib/infoFromHostname.js +0 -24
- package/lib/management.js +0 -102
- package/lib/models.js +0 -76
- package/lib/network.js +0 -234
- package/lib/packet.js +0 -191
- package/lib/placeholder.js +0 -12
- package/lib/safeishJSON.js +0 -14
- package/lib/tokens.js +0 -129
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.network = void 0;
|
|
7
|
+
const node_events_1 = __importDefault(require("node:events"));
|
|
8
|
+
const node_dgram_1 = __importDefault(require("node:dgram"));
|
|
9
|
+
const debug_1 = __importDefault(require("debug"));
|
|
10
|
+
const packet_1 = require("./packet");
|
|
11
|
+
const device_info_1 = require("./device_info");
|
|
12
|
+
const miio_error_1 = require("./miio_error");
|
|
13
|
+
const PORT = 54321;
|
|
14
|
+
/**
|
|
15
|
+
* Class for keeping track of the current network of devices. This is used to
|
|
16
|
+
* track a few things:
|
|
17
|
+
*
|
|
18
|
+
* 1) Mapping between addresses and device identifiers. Used when connecting to
|
|
19
|
+
* a device directly via IP or hostname.
|
|
20
|
+
*
|
|
21
|
+
* 2) Mapping between id and detailed device info such as the model.
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
class Network extends node_events_1.default {
|
|
25
|
+
packet = new packet_1.Packet(true);
|
|
26
|
+
addresses = new Map();
|
|
27
|
+
devices = new Map();
|
|
28
|
+
references = 0;
|
|
29
|
+
debug;
|
|
30
|
+
_socket = null;
|
|
31
|
+
constructor() {
|
|
32
|
+
super();
|
|
33
|
+
this.debug = (0, debug_1.default)("miio:network");
|
|
34
|
+
}
|
|
35
|
+
search() {
|
|
36
|
+
this.packet.handshake();
|
|
37
|
+
const data = Buffer.from(this.packet.raw);
|
|
38
|
+
this.socket.send(data, 0, data.length, PORT, "255.255.255.255");
|
|
39
|
+
// Broadcast an extra time in 500 milliseconds in case the first brodcast misses a few devices
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
this.socket.send(data, 0, data.length, PORT, "255.255.255.255");
|
|
42
|
+
}, 500);
|
|
43
|
+
}
|
|
44
|
+
findDevice(id, rinfo) {
|
|
45
|
+
// First step, check if we know about the device based on id
|
|
46
|
+
let device = this.devices.get(id);
|
|
47
|
+
if (!device && rinfo) {
|
|
48
|
+
// If we have info about the address, try to resolve again
|
|
49
|
+
device = this.addresses.get(rinfo.address);
|
|
50
|
+
if (!device) {
|
|
51
|
+
// No device found, keep track of this one
|
|
52
|
+
device = new device_info_1.DeviceInfo(this, id, rinfo.address, rinfo.port);
|
|
53
|
+
this.devices.set(id, device);
|
|
54
|
+
this.addresses.set(rinfo.address, device);
|
|
55
|
+
return device;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return device;
|
|
59
|
+
}
|
|
60
|
+
async findDeviceViaAddress(options) {
|
|
61
|
+
if (!this.socket) {
|
|
62
|
+
throw new Error("Implementation issue: Using network without a reference");
|
|
63
|
+
}
|
|
64
|
+
let device = this.addresses.get(options.address);
|
|
65
|
+
if (!device) {
|
|
66
|
+
// No device was found at the address, try to discover it
|
|
67
|
+
device = new device_info_1.DeviceInfo(this, void 0, options.address, options.port || PORT);
|
|
68
|
+
this.addresses.set(options.address, device);
|
|
69
|
+
}
|
|
70
|
+
// Update the token if we have one
|
|
71
|
+
if (typeof options.token === "string") {
|
|
72
|
+
device.token = Buffer.from(options.token, "hex");
|
|
73
|
+
}
|
|
74
|
+
else if (options.token instanceof Buffer) {
|
|
75
|
+
device.token = options.token;
|
|
76
|
+
}
|
|
77
|
+
// Set the model if provided
|
|
78
|
+
if (!device.model && options.model) {
|
|
79
|
+
device.model = options.model;
|
|
80
|
+
}
|
|
81
|
+
// Perform a handshake with the device to see if we can connect
|
|
82
|
+
try {
|
|
83
|
+
await device.handshake();
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
// Supress missing tokens - enrich should take care of that
|
|
87
|
+
if (!((0, miio_error_1.isMiioError)(err) && err.code === "missing-token")) {
|
|
88
|
+
throw err;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const cachedDevice = this.cacheDevice(device);
|
|
92
|
+
await cachedDevice?.enrich();
|
|
93
|
+
return cachedDevice;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Caches the device if not previously cached (could be the reason of failures when reconnecting?)
|
|
97
|
+
*
|
|
98
|
+
* @param device {@link DeviceInfo}
|
|
99
|
+
* @returns New device or the previously cached one
|
|
100
|
+
*/
|
|
101
|
+
cacheDevice(device) {
|
|
102
|
+
const deviceId = device.id || null;
|
|
103
|
+
if (!this.devices.has(deviceId)) {
|
|
104
|
+
// This is a new device, keep track of it
|
|
105
|
+
this.devices.set(deviceId, device);
|
|
106
|
+
}
|
|
107
|
+
// Sanity, make sure that the device in the map is returned
|
|
108
|
+
return this.devices.get(deviceId);
|
|
109
|
+
}
|
|
110
|
+
createSocket() {
|
|
111
|
+
this._socket = node_dgram_1.default.createSocket("udp4");
|
|
112
|
+
// Bind the socket and when it is ready mark it for broadcasting
|
|
113
|
+
this._socket.bind();
|
|
114
|
+
this._socket.on("listening", () => {
|
|
115
|
+
this._socket?.setBroadcast(true);
|
|
116
|
+
const address = this._socket?.address();
|
|
117
|
+
this.debug("Network bound to port", address?.port);
|
|
118
|
+
});
|
|
119
|
+
// On any incoming message, parse it, update the discovery
|
|
120
|
+
this._socket.on("message", async (msg, rinfo) => {
|
|
121
|
+
const buf = Buffer.from(msg);
|
|
122
|
+
try {
|
|
123
|
+
this.packet.raw = buf;
|
|
124
|
+
}
|
|
125
|
+
catch (_e) {
|
|
126
|
+
this.debug("Could not handle incoming message");
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (!this.packet.deviceId) {
|
|
130
|
+
this.debug("No device identifier in incoming packet");
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const device = this.findDevice(this.packet.deviceId, rinfo);
|
|
134
|
+
device?.onMessage(buf);
|
|
135
|
+
if (!this.packet.data) {
|
|
136
|
+
if (!device?.enriched) {
|
|
137
|
+
// This is the first time we see this device
|
|
138
|
+
await device?.enrich().catch(() => { });
|
|
139
|
+
}
|
|
140
|
+
this.emit("device", device);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
list() {
|
|
145
|
+
return this.devices.values();
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get a reference to the network. Helps with locking of a socket.
|
|
149
|
+
*/
|
|
150
|
+
ref() {
|
|
151
|
+
this.debug("Grabbing reference to network");
|
|
152
|
+
this.references++;
|
|
153
|
+
this.updateSocket();
|
|
154
|
+
let released = false;
|
|
155
|
+
return {
|
|
156
|
+
release: () => {
|
|
157
|
+
if (released)
|
|
158
|
+
return;
|
|
159
|
+
this.debug("Releasing reference to network");
|
|
160
|
+
released = true;
|
|
161
|
+
this.references--;
|
|
162
|
+
this.updateSocket();
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Update wether the socket is available or not. Instead of always keeping
|
|
168
|
+
* a socket we track if it is available to allow Node to exit if no
|
|
169
|
+
* discovery or device is being used.
|
|
170
|
+
*/
|
|
171
|
+
updateSocket() {
|
|
172
|
+
if (this.references === 0) {
|
|
173
|
+
// No more references, kill the socket
|
|
174
|
+
if (this._socket) {
|
|
175
|
+
this.debug("Network no longer active, destroying socket");
|
|
176
|
+
this._socket.close();
|
|
177
|
+
this._socket = null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
else if (this.references === 1 && !this._socket) {
|
|
181
|
+
// This is the first reference, create the socket
|
|
182
|
+
this.debug("Making network active, creating socket");
|
|
183
|
+
this.createSocket();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
get socket() {
|
|
187
|
+
if (!this._socket) {
|
|
188
|
+
throw new Error("Network communication is unavailable, device might be destroyed");
|
|
189
|
+
}
|
|
190
|
+
return this._socket;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.network = new Network();
|
|
194
|
+
//# sourceMappingURL=network.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/lib/network.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AAEb,8DAAuC;AACvC,4DAA+B;AAE/B,kDAA0B;AAE1B,qCAAkC;AAClC,+CAA2C;AAC3C,6CAA2C;AAE3C,MAAM,IAAI,GAAG,KAAK,CAAC;AASnB;;;;;;;;;GASG;AACH,MAAM,OAAQ,SAAQ,qBAAY;IACf,MAAM,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,SAAS,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC1C,OAAO,GAAG,IAAI,GAAG,EAA6B,CAAC;IACxD,UAAU,GAAG,CAAC,CAAC;IACf,KAAK,CAA8B;IACnC,OAAO,GAAwB,IAAI,CAAC;IAE5C;QACE,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,KAAK,GAAG,IAAA,eAAK,EAAC,cAAc,CAAC,CAAC;IACrC,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC;QAEhE,8FAA8F;QAC9F,UAAU,CAAC,GA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,CAAC;aAAM,IAAI,IAAI,CAAC,UAAU,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClD,iDAAiD;YACjD,IAAI,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;YACrD,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;IAED,IAAI,MAAM;QACR,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAEY,QAAA,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Packet = void 0;
|
|
7
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
8
|
+
const debug_1 = __importDefault(require("debug"));
|
|
9
|
+
const debug = (0, debug_1.default)("miio:packet");
|
|
10
|
+
class Packet {
|
|
11
|
+
discovery;
|
|
12
|
+
header;
|
|
13
|
+
_token = null;
|
|
14
|
+
_tokenKey;
|
|
15
|
+
_tokenIV;
|
|
16
|
+
_serverStampTime = 0;
|
|
17
|
+
_serverStamp;
|
|
18
|
+
data = null;
|
|
19
|
+
constructor(discovery = false) {
|
|
20
|
+
this.discovery = discovery;
|
|
21
|
+
this.header = Buffer.alloc(2 + 2 + 4 + 4 + 4 + 16);
|
|
22
|
+
this.header[0] = 0x21;
|
|
23
|
+
this.header[1] = 0x31;
|
|
24
|
+
for (let i = 4; i < 32; i++) {
|
|
25
|
+
this.header[i] = 0xff;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
handshake() {
|
|
29
|
+
this.data = null;
|
|
30
|
+
}
|
|
31
|
+
handleHandshakeReply() {
|
|
32
|
+
if (this._token === null) {
|
|
33
|
+
const token = this.checksum;
|
|
34
|
+
if (token.toString("hex").match(/^[fF0]+$/)) {
|
|
35
|
+
// Device did not return its token so we set our token to null
|
|
36
|
+
this._token = null;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.token = this.checksum;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
get needsHandshake() {
|
|
44
|
+
/*
|
|
45
|
+
* Handshake if we:
|
|
46
|
+
* 1) do not have a token
|
|
47
|
+
* 2) it has been longer then 120 seconds since last received message
|
|
48
|
+
*/
|
|
49
|
+
return !this._token || Date.now() - this._serverStampTime > 120000;
|
|
50
|
+
}
|
|
51
|
+
get raw() {
|
|
52
|
+
if (this.data) {
|
|
53
|
+
// Send a command to the device
|
|
54
|
+
if (!this._token) {
|
|
55
|
+
throw new Error("Token is required to send commands");
|
|
56
|
+
}
|
|
57
|
+
for (let i = 4; i < 8; i++) {
|
|
58
|
+
this.header[i] = 0x00;
|
|
59
|
+
}
|
|
60
|
+
// Update the stamp to match server
|
|
61
|
+
if (this._serverStampTime) {
|
|
62
|
+
const secondsPassed = Math.floor((Date.now() - this._serverStampTime) / 1000);
|
|
63
|
+
try {
|
|
64
|
+
this.header.writeUInt32BE(this._serverStamp + secondsPassed, 12);
|
|
65
|
+
}
|
|
66
|
+
catch (_err) {
|
|
67
|
+
// If it fails to post the difference in seconds, just use the same stamp it previously had
|
|
68
|
+
this.header.writeUInt32BE(this._serverStamp, 12);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Encrypt the data
|
|
72
|
+
const cipher = node_crypto_1.default.createCipheriv("aes-128-cbc",
|
|
73
|
+
// if there is a token, this pair exists
|
|
74
|
+
this._tokenKey, this._tokenIV);
|
|
75
|
+
const encrypted = Buffer.concat([
|
|
76
|
+
cipher.update(this.data),
|
|
77
|
+
cipher.final(),
|
|
78
|
+
]);
|
|
79
|
+
// Set the length
|
|
80
|
+
this.header.writeUInt16BE(32 + encrypted.length, 2);
|
|
81
|
+
// Calculate the checksum
|
|
82
|
+
const digest = node_crypto_1.default
|
|
83
|
+
.createHash("md5")
|
|
84
|
+
.update(this.header.slice(0, 16))
|
|
85
|
+
.update(this._token)
|
|
86
|
+
.update(encrypted)
|
|
87
|
+
.digest();
|
|
88
|
+
digest.copy(this.header, 16);
|
|
89
|
+
debug("->", this.header);
|
|
90
|
+
return Buffer.concat([this.header, encrypted]);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
// Handshake
|
|
94
|
+
this.header.writeUInt16BE(32, 2);
|
|
95
|
+
for (let i = 4; i < 32; i++) {
|
|
96
|
+
this.header[i] = 0xff;
|
|
97
|
+
}
|
|
98
|
+
debug("->", this.header);
|
|
99
|
+
return this.header;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
set raw(msg) {
|
|
103
|
+
msg.copy(this.header, 0, 0, 32);
|
|
104
|
+
debug("<-", this.header);
|
|
105
|
+
const stamp = this.stamp;
|
|
106
|
+
if (stamp > 0) {
|
|
107
|
+
// If the device returned a stamp, store it
|
|
108
|
+
this._serverStamp = this.stamp;
|
|
109
|
+
this._serverStampTime = Date.now();
|
|
110
|
+
}
|
|
111
|
+
const encrypted = msg.slice(32);
|
|
112
|
+
if (this.discovery) {
|
|
113
|
+
// This packet is only intended to be used for discovery
|
|
114
|
+
this.data = (encrypted.length > 0);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
// Normal packet, decrypt data
|
|
118
|
+
if (encrypted.length > 0) {
|
|
119
|
+
if (!this._token) {
|
|
120
|
+
debug("<- No token set, unable to handle packet");
|
|
121
|
+
this.data = null;
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const digest = node_crypto_1.default
|
|
125
|
+
.createHash("md5")
|
|
126
|
+
.update(this.header.slice(0, 16))
|
|
127
|
+
.update(this._token)
|
|
128
|
+
.update(encrypted)
|
|
129
|
+
.digest();
|
|
130
|
+
const checksum = this.checksum;
|
|
131
|
+
if (!checksum.equals(digest)) {
|
|
132
|
+
debug("<- Invalid packet, checksum was", checksum, "should be", digest);
|
|
133
|
+
this.data = null;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
const decipher = node_crypto_1.default.createDecipheriv("aes-128-cbc",
|
|
137
|
+
// if there is a token, this pair exists
|
|
138
|
+
this._tokenKey, this._tokenIV);
|
|
139
|
+
this.data = Buffer.concat([
|
|
140
|
+
decipher.update(encrypted),
|
|
141
|
+
decipher.final(),
|
|
142
|
+
]);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
this.data = null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
get token() {
|
|
151
|
+
return this._token;
|
|
152
|
+
}
|
|
153
|
+
set token(t) {
|
|
154
|
+
if (t === null) {
|
|
155
|
+
this._token = null;
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
this._token = Buffer.from(t);
|
|
159
|
+
this._tokenKey = node_crypto_1.default.createHash("md5").update(t).digest();
|
|
160
|
+
this._tokenIV = node_crypto_1.default
|
|
161
|
+
.createHash("md5")
|
|
162
|
+
.update(this._tokenKey)
|
|
163
|
+
.update(t)
|
|
164
|
+
.digest();
|
|
165
|
+
}
|
|
166
|
+
get checksum() {
|
|
167
|
+
return this.header.slice(16);
|
|
168
|
+
}
|
|
169
|
+
get deviceId() {
|
|
170
|
+
return this.header.readUInt32BE(8);
|
|
171
|
+
}
|
|
172
|
+
get stamp() {
|
|
173
|
+
return this.header.readUInt32BE(12);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.Packet = Packet;
|
|
177
|
+
//# sourceMappingURL=packet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packet.js","sourceRoot":"","sources":["../../src/lib/packet.ts"],"names":[],"m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D,wBAsMC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Placeholder = void 0;
|
|
4
|
+
const device_1 = require("./device");
|
|
5
|
+
class Placeholder extends device_1.MiioApi {
|
|
6
|
+
handle;
|
|
7
|
+
static get type() {
|
|
8
|
+
return "placeholder";
|
|
9
|
+
}
|
|
10
|
+
constructor(handle) {
|
|
11
|
+
super(handle);
|
|
12
|
+
this.handle = handle;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.Placeholder = Placeholder;
|
|
16
|
+
//# sourceMappingURL=placeholder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placeholder.js","sourceRoot":"","sources":["../../src/lib/placeholder.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,qCAAmC;AAGnC,MAAa,WAAY,SAAQ,gBAAO;IAKV;IAJ5B,MAAM,KAAK,IAAI;QACb,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,YAA4B,MAAoB;QAC9C,KAAK,CAAC,MAAM,CAAC,CAAC;QADY,WAAM,GAAN,MAAM,CAAc;IAEhD,CAAC;CACF;AARD,kCAQC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/lib/protocol.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.safeishJSON = safeishJSON;
|
|
4
|
+
/**
|
|
5
|
+
* Safer JSON parser
|
|
6
|
+
*
|
|
7
|
+
* @param str The string to parse into a JSON
|
|
8
|
+
* @returns The parsed JSON
|
|
9
|
+
*/
|
|
10
|
+
function safeishJSON(str) {
|
|
11
|
+
try {
|
|
12
|
+
return JSON.parse(str);
|
|
13
|
+
}
|
|
14
|
+
catch (_error) {
|
|
15
|
+
// Case 1: Load for subdevices fail as they return empty values
|
|
16
|
+
str = str.replace("[,]", "[null,null]");
|
|
17
|
+
// for aqara body sensor (lumi.motion.aq2)
|
|
18
|
+
str = str.replace("[,,]", "[null,null,null]");
|
|
19
|
+
return JSON.parse(str);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=safeish_json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safeish_json.js","sourceRoot":"","sources":["../../src/lib/safeish_json.ts"],"names":[],"mappings":";;AAMA,kCAWC;AAjBD;;;;;GAKG;AACH,SAAgB,WAAW,CAAI,GAAW;IACxC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,+DAA+D;QAC/D,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QACxC,0CAA0C;QAC1C,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;QAE9C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.tokens = void 0;
|
|
7
|
+
const node_persist_1 = __importDefault(require("node-persist"));
|
|
8
|
+
/**
|
|
9
|
+
* Shared storage for tokens of devices. Keeps a simple JSON file synced
|
|
10
|
+
* with tokens connected to device ids.
|
|
11
|
+
*/
|
|
12
|
+
class Tokens {
|
|
13
|
+
initialized = false;
|
|
14
|
+
async get(deviceId) {
|
|
15
|
+
if (!this.initialized) {
|
|
16
|
+
this.initialized = true;
|
|
17
|
+
await node_persist_1.default.init();
|
|
18
|
+
}
|
|
19
|
+
return node_persist_1.default.getItem(deviceId);
|
|
20
|
+
}
|
|
21
|
+
async update(deviceId, token) {
|
|
22
|
+
if (!this.initialized) {
|
|
23
|
+
this.initialized = true;
|
|
24
|
+
await node_persist_1.default.init();
|
|
25
|
+
}
|
|
26
|
+
return node_persist_1.default.setItem(deviceId, token);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.tokens = new Tokens();
|
|
30
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/lib/tokens.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAmC;AAEnC;;;GAGG;AACH,MAAM,MAAM;IACF,WAAW,GAAG,KAAK,CAAC;IAE5B,KAAK,CAAC,GAAG,CAAC,QAAgB;QACxB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YACxB,MAAM,sBAAO,CAAC,IAAI,EAAE,CAAC;QACvB,CAAC;QACD,OAAO,sBAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,QAAgB,EAAE,KAAa;QAC1C,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YACxB,MAAM,sBAAO,CAAC,IAAI,EAAE,CAAC;QACvB,CAAC;QACD,OAAO,sBAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;CACF;AAEY,QAAA,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC"}
|
package/docs/devices/vacuum.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# Robot Vacuums
|
|
2
2
|
|
|
3
|
-
* **Devices**:
|
|
4
|
-
*
|
|
3
|
+
* **Devices**:
|
|
4
|
+
* Roborock / Mi Robot Vacuum (legacy miIO): `rockrobo.vacuum.*`, `roborock.vacuum.*` (class `Vacuum`)
|
|
5
|
+
* Viomi (legacy miIO): older `viomi.vacuum.*` such as v6/v7/v8 (class `ViomiVacuum`)
|
|
6
|
+
* Any MIoT vacuum (Xiaomi, Dreame, Mijia, ijai, newer Viomi…), driven by its spec (class `MiotVacuum`, see the README)
|
|
5
7
|
|
|
6
8
|
Robot vacuums are mapped into a device of type [`vacuum`][vacuum]. The device
|
|
7
9
|
will support many different capabilities, such as autonomous cleaning, getting
|
|
@@ -12,7 +14,8 @@ the cleaning state and more.
|
|
|
12
14
|
### Check if device is a vacuum
|
|
13
15
|
|
|
14
16
|
```javascript
|
|
15
|
-
|
|
17
|
+
// Note: abstract-things spells the type as "vaccuum"
|
|
18
|
+
if(device.matches('type:vaccuum')) {
|
|
16
19
|
/*
|
|
17
20
|
* This device is a vacuum.
|
|
18
21
|
*/
|
|
@@ -78,3 +81,50 @@ device.batteryLevel()
|
|
|
78
81
|
// With async/wait
|
|
79
82
|
const level = await device.batteryLevel();
|
|
80
83
|
```
|
|
84
|
+
|
|
85
|
+
### Fan speeds and water levels
|
|
86
|
+
|
|
87
|
+
Every vacuum class lists the values supported by the model (and firmware, for legacy Roborock models):
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
const speeds = await device.fanSpeeds();
|
|
91
|
+
// [{ value: 105, name: "Soft" }, { value: 101, name: "Quiet" }, ...]
|
|
92
|
+
await device.changeFanSpeed(speeds[1].value);
|
|
93
|
+
|
|
94
|
+
const waterLevels = await device.waterBoxModes(); // [] if not supported
|
|
95
|
+
if (waterLevels.length) await device.setWaterBoxMode(waterLevels[1].value);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Roborock-only features
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
// Clean rooms (segment ids from getRoomMap()), twice
|
|
102
|
+
await device.cleanRooms([16, 17], { repeat: 2 });
|
|
103
|
+
|
|
104
|
+
// Do Not Disturb
|
|
105
|
+
await device.getDoNotDisturb(); // { enabled: true, start: "22:00", end: "08:00" }
|
|
106
|
+
await device.setDoNotDisturb("22:00", "08:00");
|
|
107
|
+
await device.disableDoNotDisturb();
|
|
108
|
+
|
|
109
|
+
// Carpet mode (suction boost on carpets)
|
|
110
|
+
await device.setCarpetMode(true);
|
|
111
|
+
|
|
112
|
+
// Mop route (S7 and newer)
|
|
113
|
+
const { MOP_ROUTES } = require("node-miio");
|
|
114
|
+
await device.setMopRoute(MOP_ROUTES.deep);
|
|
115
|
+
|
|
116
|
+
// Multi-floor maps
|
|
117
|
+
const maps = await device.getMaps(); // [{ id: 0, name: "Ground floor" }, ...]
|
|
118
|
+
await device.loadMap(maps[1].id);
|
|
119
|
+
|
|
120
|
+
// Docks with mop washing
|
|
121
|
+
await device.startMopWash();
|
|
122
|
+
|
|
123
|
+
// Consumables and volume
|
|
124
|
+
await device.resetConsumable("filter_work_time");
|
|
125
|
+
await device.setSoundVolume(50);
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
> These commands follow the community-documented miIO protocol and are not tested on every model.
|
|
129
|
+
> Please report which ones work on yours.
|
|
130
|
+
|
package/example.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-miio",
|
|
3
|
-
"version": "0.3.0-beta.
|
|
3
|
+
"version": "0.3.0-beta.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Control Mi Home devices, such as Mi Robot Vacuums, Mi Air Purifiers, Mi Smart Home Gateway (Aqara) and more",
|
|
6
6
|
"author": "https://github.com/afharo",
|
|
7
|
-
"homepage": "https://github.com/afharo/miio/blob/main/README.md",
|
|
8
|
-
"
|
|
7
|
+
"homepage": "https://github.com/afharo/node-miio/blob/main/README.md",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/afharo/node-miio.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/afharo/node-miio/issues"
|
|
14
|
+
},
|
|
15
|
+
"main": "dist/lib/index.js",
|
|
9
16
|
"keywords": [
|
|
10
17
|
"xiaomi",
|
|
11
18
|
"mi",
|
|
@@ -15,31 +22,57 @@
|
|
|
15
22
|
"mijia"
|
|
16
23
|
],
|
|
17
24
|
"bin": {
|
|
18
|
-
"miio": "
|
|
25
|
+
"node-miio": "dist/cli/index.js"
|
|
19
26
|
},
|
|
20
27
|
"scripts": {
|
|
28
|
+
"clean": "rimraf ./dist",
|
|
29
|
+
"build": "npm run clean && tsc",
|
|
30
|
+
"snapshot": "node scripts/update-spec-snapshot.mjs",
|
|
31
|
+
"prepublishOnly": "npm run build",
|
|
32
|
+
"postpublish": "npm run clean",
|
|
33
|
+
"preversion": "npm run lint && npm run build && npm test",
|
|
34
|
+
"version": "git add .",
|
|
35
|
+
"postversion": "git push && git push --tags",
|
|
21
36
|
"test": "jest",
|
|
22
37
|
"test:verbose": "jest --verbose",
|
|
23
38
|
"test:watch": "jest --watch -verbose",
|
|
24
39
|
"test:coverage": "jest --verbose --coverage",
|
|
25
|
-
"lint": "eslint ."
|
|
40
|
+
"lint": "eslint --max-warnings=0 ."
|
|
26
41
|
},
|
|
27
42
|
"engines": {
|
|
28
|
-
"node": ">=
|
|
43
|
+
"node": ">=22.12.0"
|
|
29
44
|
},
|
|
30
45
|
"dependencies": {
|
|
31
46
|
"abstract-things": "^0.9.0",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"yargs": "15.4.1"
|
|
47
|
+
"chalk": "^4.1.2",
|
|
48
|
+
"debug": "^4.4.3",
|
|
49
|
+
"deep-equal": "^2.2.3",
|
|
50
|
+
"node-persist": "^4.0.4",
|
|
51
|
+
"tinkerhub-discovery": "^0.6.0",
|
|
52
|
+
"yargs": "^18.2.0"
|
|
39
53
|
},
|
|
40
54
|
"devDependencies": {
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
55
|
+
"@babel/core": "^7.29.13",
|
|
56
|
+
"@babel/preset-env": "^7.29.14",
|
|
57
|
+
"@babel/preset-typescript": "^7.29.7",
|
|
58
|
+
"@eslint/js": "9.39.5",
|
|
59
|
+
"@types/deep-equal": "^1.0.4",
|
|
60
|
+
"@types/jest": "^30.0.0",
|
|
61
|
+
"@types/node": "^24.19.2",
|
|
62
|
+
"@types/node-persist": "^3.1.8",
|
|
63
|
+
"babel-jest": "^30.5.2",
|
|
64
|
+
"eslint": "^9.39.5",
|
|
65
|
+
"eslint-config-prettier": "10.1.8",
|
|
66
|
+
"eslint-plugin-import": "2.32.0",
|
|
67
|
+
"eslint-plugin-jest": "29.17.0",
|
|
68
|
+
"eslint-plugin-jsdoc": "54.7.0",
|
|
69
|
+
"eslint-plugin-n": "17.24.0",
|
|
70
|
+
"eslint-plugin-prettier": "5.5.7",
|
|
71
|
+
"eslint-plugin-promise": "7.3.0",
|
|
72
|
+
"eslint-plugin-unused-imports": "^4.4.1",
|
|
73
|
+
"jest": "^30.5.2",
|
|
74
|
+
"rimraf": "^6.1.4",
|
|
75
|
+
"typescript": "^5.9.3",
|
|
76
|
+
"typescript-eslint": "8.72.2"
|
|
44
77
|
}
|
|
45
78
|
}
|
|
Binary file
|