homey-lib 2.35.2 → 2.35.3

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/lib/App/index.js CHANGED
@@ -491,16 +491,18 @@ class App {
491
491
  });
492
492
  }
493
493
 
494
- if (driver.energy.cumulative === true) {
494
+ const hasMeterPowerCapability = driver.capabilities.some(capability => Capability.isInstanceOfId(capability, 'meter_power'));
495
+
496
+ if (driver.energy.cumulative === true && hasMeterPowerCapability) {
495
497
  if (typeof driver.energy.cumulativeImportedCapability !== 'string') {
496
- console.warn(`Warning: drivers.${driver.id} has energy.cumulative set to true, but is missing 'cumulativeImportedCapability'. Disregard this warning if the driver does not have \`meter_power\` capabilities.`);
498
+ console.warn(`Warning: drivers.${driver.id} has energy.cumulative set to true, but is missing 'cumulativeImportedCapability'.`);
497
499
  }
498
500
  if (typeof driver.energy.cumulativeExportedCapability !== 'string') {
499
- console.warn(`Warning: drivers.${driver.id} has energy.cumulative set to true, but is missing 'cumulativeExportedCapability'. Disregard this warning if the driver does not have \`meter_power\` capabilities.`);
501
+ console.warn(`Warning: drivers.${driver.id} has energy.cumulative set to true, but is missing 'cumulativeExportedCapability'.`);
500
502
  }
501
503
  }
502
504
 
503
- if (driver.energy.homeBattery === true) {
505
+ if (driver.energy.homeBattery === true && hasMeterPowerCapability) {
504
506
  if (typeof driver.energy.meterPowerImportedCapability !== 'string') {
505
507
  console.warn(`Warning: drivers.${driver.id} has energy.homeBattery set to true, but is missing 'meterPowerImportedCapability'.`);
506
508
  }
@@ -509,6 +511,12 @@ class App {
509
511
  }
510
512
  }
511
513
 
514
+ if (driver.energy.evCharger === true && hasMeterPowerCapability) {
515
+ if (typeof driver.energy.meterPowerImportedCapability !== 'string') {
516
+ console.warn(`Warning: drivers.${driver.id} has energy.evCharger set to true, but is missing 'meterPowerImportedCapability'.`);
517
+ }
518
+ }
519
+
512
520
  if (typeof driver.energy.cumulativeImportedCapability === 'string' && Capability.isInstanceOfId(driver.energy.cumulativeImportedCapability, 'meter_power') === false) {
513
521
  throw new Error(`drivers.${driver.id} has 'cumulativeImportedCapability': '${driver.energy.cumulativeImportedCapability}' but only instances of 'meter_power' are allowed.`);
514
522
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-lib",
3
- "version": "2.35.2",
3
+ "version": "2.35.3",
4
4
  "description": "Shared Library for Homey",
5
5
  "main": "index.js",
6
6
  "scripts": {