meross-cli 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/CHANGELOG.md +19 -0
- package/README.md +24 -5
- package/cli/commands/control/execute.js +36 -6
- package/cli/commands/control/params/index.js +16 -12
- package/cli/commands/control/params/light.js +55 -25
- package/cli/commands/control/params/thermostat.js +24 -22
- package/cli/commands/control/params/timer.js +38 -43
- package/cli/commands/control/params/trigger.js +43 -40
- package/cli/commands/info.js +218 -17
- package/cli/commands/sniffer/sniffer-menu.js +2 -2
- package/cli/commands/status/device-status.js +418 -1292
- package/cli/commands/status/hub-status.js +14 -6
- package/cli/control-registry.js +211 -406
- package/cli/meross-cli.js +1 -1
- package/cli/tests/README.md +2 -0
- package/cli/tests/test-alarm.js +22 -2
- package/cli/tests/test-child-lock.js +40 -10
- package/cli/tests/test-config.js +22 -2
- package/cli/tests/test-control.js +8 -8
- package/cli/tests/test-diffuser.js +7 -7
- package/cli/tests/test-dnd.js +87 -66
- package/cli/tests/test-electricity.js +37 -33
- package/cli/tests/test-encryption.js +13 -13
- package/cli/tests/test-garage.js +12 -14
- package/cli/tests/test-helper.js +1 -1
- package/cli/tests/test-hub-sensors.js +3 -3
- package/cli/tests/test-light.js +497 -105
- package/cli/tests/test-presence.js +10 -55
- package/cli/tests/test-registry.js +7 -1
- package/cli/tests/test-roller-shutter.js +78 -90
- package/cli/tests/test-screen.js +1 -1
- package/cli/tests/test-sensor-history.js +6 -2
- package/cli/tests/test-smoke-config.js +24 -4
- package/cli/tests/test-spray.js +11 -11
- package/cli/tests/test-system.js +375 -0
- package/cli/tests/test-temp-unit.js +22 -2
- package/cli/tests/test-template.js +61 -73
- package/cli/tests/test-thermostat.js +126 -89
- package/cli/tests/test-timer.js +9 -52
- package/cli/tests/test-toggle.js +49 -173
- package/cli/tests/test-trigger.js +8 -51
- package/package.json +2 -2
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
const chalk = require('chalk');
|
|
4
4
|
const { displaySubdeviceStatus } = require('./subdevices');
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Displays hub device status including all subdevices.
|
|
8
|
+
*
|
|
9
|
+
* Refreshes hub state to get latest subdevice data, fetches battery information
|
|
10
|
+
* for sensors, and displays status for each subdevice.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} device - Hub device instance
|
|
13
|
+
* @param {string|null} filterSubdeviceId - Optional subdevice ID to filter to a single subdevice
|
|
14
|
+
* @returns {Promise<boolean>} True if any readings were displayed, false otherwise
|
|
15
|
+
*/
|
|
6
16
|
async function displayHubStatus(device, filterSubdeviceId = null) {
|
|
7
17
|
const subdevices = filterSubdeviceId
|
|
8
18
|
? [device.getSubdevice(filterSubdeviceId)].filter(Boolean)
|
|
@@ -17,14 +27,12 @@ async function displayHubStatus(device, filterSubdeviceId = null) {
|
|
|
17
27
|
return false;
|
|
18
28
|
}
|
|
19
29
|
|
|
20
|
-
// Refresh hub state to get latest subdevice data
|
|
21
30
|
try {
|
|
22
31
|
await device.refreshState();
|
|
23
32
|
|
|
24
|
-
// Also fetch battery data for sensors
|
|
25
33
|
try {
|
|
26
|
-
if (typeof device.
|
|
27
|
-
const batteryResponse = await device.
|
|
34
|
+
if (device.hub && typeof device.hub.getBattery === 'function') {
|
|
35
|
+
const batteryResponse = await device.hub.getBattery();
|
|
28
36
|
if (batteryResponse && batteryResponse.battery && Array.isArray(batteryResponse.battery)) {
|
|
29
37
|
for (const batteryData of batteryResponse.battery) {
|
|
30
38
|
const subdeviceId = batteryData.id;
|
|
@@ -37,10 +45,10 @@ async function displayHubStatus(device, filterSubdeviceId = null) {
|
|
|
37
45
|
}
|
|
38
46
|
}
|
|
39
47
|
} catch {
|
|
40
|
-
//
|
|
48
|
+
// Continue without battery data if fetch fails
|
|
41
49
|
}
|
|
42
50
|
} catch (error) {
|
|
43
|
-
//
|
|
51
|
+
// Continue with cached data if refresh fails
|
|
44
52
|
}
|
|
45
53
|
|
|
46
54
|
if (!filterSubdeviceId) {
|