meross-iot 0.7.0 → 0.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/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.7.1] - 2026-01-21
9
+
10
+ ### Fixed
11
+ - Prefer Consumption/ConsumptionX/ConsumptionH in the right order and fallback sequence when fetching usage history
12
+ - Poll electricity via the feature-based API and honor channel cache data in ManagerSubscription
13
+
8
14
  ## [0.7.0] - 2026-01-20
9
15
 
10
16
  ### Added
package/README.md CHANGED
@@ -26,7 +26,7 @@ The library can control devices locally via HTTP or via cloud MQTT server.
26
26
  npm install meross-iot@alpha
27
27
 
28
28
  # Or install specific version
29
- npm install meross-iot@0.7.0
29
+ npm install meross-iot@0.7.1
30
30
  ```
31
31
 
32
32
  ## Usage & Documentation
@@ -177,6 +177,15 @@ Please create an issue on GitHub and include:
177
177
 
178
178
  ## Changelog
179
179
 
180
+ ### [0.7.1] - 2026-01-21
181
+
182
+ #### Fixed
183
+ - Prefer Consumption/ConsumptionX/ConsumptionH in the right order and fallback sequence when fetching usage history
184
+ - Poll electricity via the feature-based API and honor channel cache data in ManagerSubscription
185
+
186
+ <details>
187
+ <summary>Older</summary>
188
+
180
189
  ### [0.7.0] - 2026-01-20
181
190
 
182
191
  #### Added
@@ -187,9 +196,6 @@ Please create an issue on GitHub and include:
187
196
  - Capabilities are automatically built when device abilities are updated
188
197
  - TypeScript definitions updated with `DeviceCapabilities` interface
189
198
 
190
- <details>
191
- <summary>Older</summary>
192
-
193
199
  ### [0.6.0] - 2026-01-20
194
200
 
195
201
  #### Changed
@@ -46,12 +46,12 @@ function createConsumptionFeature(device) {
46
46
  const hasConsumptionX = device.abilities?.['Appliance.Control.ConsumptionX'];
47
47
  const hasConsumption = device.abilities?.['Appliance.Control.Consumption'];
48
48
 
49
- if (hasConsumptionH) {
50
- return await this._getConsumptionH(channel);
49
+ if (hasConsumption) {
50
+ return await this._getConsumption(channel);
51
51
  } else if (hasConsumptionX) {
52
52
  return await this._getConsumptionX(channel);
53
- } else if (hasConsumption) {
54
- return await this._getConsumption(channel);
53
+ } else if (hasConsumptionH) {
54
+ return await this._getConsumptionH(channel);
55
55
  } else {
56
56
  return await this._getConsumptionWithFallback(channel);
57
57
  }
@@ -161,9 +161,9 @@ function createConsumptionFeature(device) {
161
161
  * @private
162
162
  */
163
163
  async _getConsumptionWithFallback(channel) {
164
- const resultH = await this._getConsumptionH(channel);
165
- if (resultH) {
166
- return resultH;
164
+ const result = await this._getConsumption(channel);
165
+ if (result) {
166
+ return result;
167
167
  }
168
168
 
169
169
  const resultX = await this._getConsumptionX(channel);
@@ -171,7 +171,7 @@ function createConsumptionFeature(device) {
171
171
  return resultX;
172
172
  }
173
173
 
174
- return await this._getConsumption(channel);
174
+ return await this._getConsumptionH(channel);
175
175
  },
176
176
 
177
177
  /**
@@ -252,7 +252,7 @@ class ManagerSubscription extends EventEmitter {
252
252
  this._pollDeviceState(device, subscription);
253
253
  }
254
254
 
255
- if (config.electricityInterval > 0 && typeof device.getElectricity === 'function') {
255
+ if (config.electricityInterval > 0 && device.electricity && typeof device.electricity.get === 'function') {
256
256
  const interval = setInterval(async () => {
257
257
  await this._pollElectricity(device, subscription, config);
258
258
  }, config.electricityInterval);
@@ -340,12 +340,12 @@ class ManagerSubscription extends EventEmitter {
340
340
  }
341
341
 
342
342
  try {
343
- if (config.smartCaching && typeof device.getCachedElectricity === 'function') {
343
+ if (config.smartCaching && device._channelCachedSamples) {
344
344
  const channels = device.channels || [{ index: 0 }];
345
345
  let allCached = true;
346
346
 
347
347
  for (const channel of channels) {
348
- const cached = device.getCachedElectricity(channel.index);
348
+ const cached = device._channelCachedSamples.get(channel.index);
349
349
  if (!cached || !cached.sampleTimestamp) {
350
350
  allCached = false;
351
351
  break;
@@ -364,7 +364,7 @@ class ManagerSubscription extends EventEmitter {
364
364
 
365
365
  const channels = device.channels || [{ index: 0 }];
366
366
  for (const channel of channels) {
367
- await device.getElectricity({ channel: channel.index });
367
+ await device.electricity.get({ channel: channel.index });
368
368
  }
369
369
 
370
370
  subscription.lastPollTimes.set('electricity', Date.now());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meross-iot",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Control Meross cloud devices using nodejs",
5
5
  "author": "Abe Haverkamp",
6
6
  "contributors": [