@apocaliss92/nodedreame 1.6.1 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +72 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +74 -1
- package/dist/index.d.ts +74 -1
- package/dist/index.js +69 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -55,16 +55,19 @@ __export(index_exports, {
|
|
|
55
55
|
Nodreame: () => Nodreame,
|
|
56
56
|
SuctionLevel: () => SuctionLevel,
|
|
57
57
|
TaskStatus: () => TaskStatus,
|
|
58
|
+
VACUUM_CONSUMABLES: () => VACUUM_CONSUMABLES,
|
|
58
59
|
VACUUM_MODEL_CAPABILITIES: () => MODEL_CAPABILITIES,
|
|
59
60
|
VacuumCapabilityResolver: () => VacuumCapabilityResolver,
|
|
60
61
|
VacuumDevice: () => VacuumDevice,
|
|
61
62
|
WaterVolume: () => WaterVolume,
|
|
63
|
+
consumableSpec: () => consumableSpec,
|
|
62
64
|
createClientDumper: () => createClientDumper,
|
|
63
65
|
createDumper: () => createDumper,
|
|
64
66
|
decodeAiFeature: () => decodeAiFeature,
|
|
65
67
|
encodeAiFeatureWrite: () => encodeAiFeatureWrite,
|
|
66
68
|
getMowerCapabilities: () => getMowerCapabilities,
|
|
67
69
|
getVacuumCapabilities: () => getVacuumCapabilities,
|
|
70
|
+
isDreameConsumableKey: () => isDreameConsumableKey,
|
|
68
71
|
renderMowerSvg: () => renderMowerSvg,
|
|
69
72
|
renderVacuumPng: () => renderVacuumPng,
|
|
70
73
|
resolveCapabilities: () => resolveCapabilities
|
|
@@ -73,7 +76,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
73
76
|
|
|
74
77
|
// src/support/version.ts
|
|
75
78
|
var LIBRARY_NAME = "nodedreame";
|
|
76
|
-
var LIBRARY_VERSION = "1.
|
|
79
|
+
var LIBRARY_VERSION = "1.7.1";
|
|
77
80
|
|
|
78
81
|
// src/transport/errors.ts
|
|
79
82
|
var DreameError = class extends Error {
|
|
@@ -1643,6 +1646,26 @@ function encodeAiFeatureWrite(raw, feature, value) {
|
|
|
1643
1646
|
);
|
|
1644
1647
|
}
|
|
1645
1648
|
|
|
1649
|
+
// src/models/vacuum/consumables.ts
|
|
1650
|
+
var VACUUM_CONSUMABLES = [
|
|
1651
|
+
{ key: "main-brush", label: "Main Brush", life: { siid: 9, piid: 2 }, reset: { siid: 9, aiid: 1 } },
|
|
1652
|
+
{ key: "side-brush", label: "Side Brush", life: { siid: 10, piid: 2 }, reset: { siid: 10, aiid: 1 } },
|
|
1653
|
+
{ key: "filter", label: "Filter", life: { siid: 11, piid: 1 }, reset: { siid: 11, aiid: 1 } },
|
|
1654
|
+
{ key: "sensor", label: "Sensor", life: { siid: 16, piid: 1 }, reset: { siid: 16, aiid: 1 } },
|
|
1655
|
+
{ key: "tank-filter", label: "Tank Filter", life: { siid: 17, piid: 1 }, reset: { siid: 17, aiid: 1 } },
|
|
1656
|
+
{ key: "mop-pad", label: "Mop Pad", life: { siid: 18, piid: 1 }, reset: { siid: 18, aiid: 1 } },
|
|
1657
|
+
{ key: "silver-ion", label: "Silver-ion", life: { siid: 19, piid: 2 }, reset: { siid: 19, aiid: 1 } },
|
|
1658
|
+
{ key: "detergent", label: "Detergent", life: { siid: 20, piid: 1 }, reset: { siid: 20, aiid: 1 } },
|
|
1659
|
+
{ key: "squeegee", label: "Squeegee", life: { siid: 24, piid: 1 }, reset: { siid: 24, aiid: 1 } },
|
|
1660
|
+
{ key: "dust-bag", label: "Dust Bag", life: { siid: 27, piid: 17 }, reset: null }
|
|
1661
|
+
];
|
|
1662
|
+
function consumableSpec(key2) {
|
|
1663
|
+
return VACUUM_CONSUMABLES.find((c) => c.key === key2);
|
|
1664
|
+
}
|
|
1665
|
+
function isDreameConsumableKey(key2) {
|
|
1666
|
+
return VACUUM_CONSUMABLES.some((c) => c.key === key2);
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1646
1669
|
// src/models/vacuum/capabilities.ts
|
|
1647
1670
|
var X50_AI_FEATURES = [
|
|
1648
1671
|
"obstacleDetection",
|
|
@@ -2844,6 +2867,51 @@ var VacuumDevice = class _VacuumDevice extends BaseDevice {
|
|
|
2844
2867
|
get volume() {
|
|
2845
2868
|
return this.#num(SETTINGS_PROP.VOLUME.siid, SETTINGS_PROP.VOLUME.piid);
|
|
2846
2869
|
}
|
|
2870
|
+
// -- consumables --------------------------------------------------------
|
|
2871
|
+
/**
|
|
2872
|
+
* Remaining-life % (0..100) for one consumable, or `null` when the model does
|
|
2873
|
+
* not report it (presence == support). Call {@link refreshConsumables} first
|
|
2874
|
+
* on a docked robot so the cloud-shadow life values are seeded.
|
|
2875
|
+
*/
|
|
2876
|
+
consumableLeftPct(key2) {
|
|
2877
|
+
const spec = consumableSpec(key2);
|
|
2878
|
+
if (spec === void 0) return null;
|
|
2879
|
+
return this.#num(spec.life.siid, spec.life.piid);
|
|
2880
|
+
}
|
|
2881
|
+
/**
|
|
2882
|
+
* The consumables this model EXPOSES — discovered by presence (a reported
|
|
2883
|
+
* life property), mirroring how the HA integration derives support. Each
|
|
2884
|
+
* reading carries the current remaining-life % and whether a reset action
|
|
2885
|
+
* exists. Empty until the life properties have been observed (push) or seeded
|
|
2886
|
+
* via {@link refreshConsumables}.
|
|
2887
|
+
*/
|
|
2888
|
+
get supportedConsumables() {
|
|
2889
|
+
return VACUUM_CONSUMABLES.flatMap((spec) => {
|
|
2890
|
+
const leftPct = this.#num(spec.life.siid, spec.life.piid);
|
|
2891
|
+
return leftPct === null ? [] : [{ key: spec.key, label: spec.label, leftPct, resettable: spec.reset !== null }];
|
|
2892
|
+
});
|
|
2893
|
+
}
|
|
2894
|
+
/**
|
|
2895
|
+
* Seed EVERY consumable life property from the cloud shadow (no robot wake) so
|
|
2896
|
+
* {@link supportedConsumables} reflects the full set on a docked robot. The
|
|
2897
|
+
* consumable life values are static settings the robot rarely re-pushes over
|
|
2898
|
+
* MQTT, so a fresh connect surfaces only the actively-changing ones without this.
|
|
2899
|
+
*/
|
|
2900
|
+
async refreshConsumables() {
|
|
2901
|
+
await this.refreshCachedProperties(VACUUM_CONSUMABLES.map((c) => c.life));
|
|
2902
|
+
}
|
|
2903
|
+
/**
|
|
2904
|
+
* Reset (mark replaced → life back to 100%) one consumable via its MIoT reset
|
|
2905
|
+
* action. Rejects when the model exposes no reset action for the key (e.g.
|
|
2906
|
+
* `dust-bag`) or the key is unknown.
|
|
2907
|
+
*/
|
|
2908
|
+
async resetConsumable(key2) {
|
|
2909
|
+
const spec = consumableSpec(key2);
|
|
2910
|
+
if (spec === void 0 || spec.reset === null) {
|
|
2911
|
+
throw new DreameError(`resetConsumable: no reset action for consumable "${key2}"`);
|
|
2912
|
+
}
|
|
2913
|
+
return this.callAction(spec.reset.siid, spec.reset.aiid, []);
|
|
2914
|
+
}
|
|
2847
2915
|
// -- AI obstacle-detection ----------------------------------------------
|
|
2848
2916
|
/**
|
|
2849
2917
|
* The raw `AI_DETECTION` value (siid 4 piid 22) — an int bitmask or a JSON
|
|
@@ -4829,16 +4897,19 @@ function createClientDumper(client, options) {
|
|
|
4829
4897
|
Nodreame,
|
|
4830
4898
|
SuctionLevel,
|
|
4831
4899
|
TaskStatus,
|
|
4900
|
+
VACUUM_CONSUMABLES,
|
|
4832
4901
|
VACUUM_MODEL_CAPABILITIES,
|
|
4833
4902
|
VacuumCapabilityResolver,
|
|
4834
4903
|
VacuumDevice,
|
|
4835
4904
|
WaterVolume,
|
|
4905
|
+
consumableSpec,
|
|
4836
4906
|
createClientDumper,
|
|
4837
4907
|
createDumper,
|
|
4838
4908
|
decodeAiFeature,
|
|
4839
4909
|
encodeAiFeatureWrite,
|
|
4840
4910
|
getMowerCapabilities,
|
|
4841
4911
|
getVacuumCapabilities,
|
|
4912
|
+
isDreameConsumableKey,
|
|
4842
4913
|
renderMowerSvg,
|
|
4843
4914
|
renderVacuumPng,
|
|
4844
4915
|
resolveCapabilities
|