Skip to content

Commit

Permalink
Merge pull request #525 from athombv/fix/allow-home-battery-without-b…
Browse files Browse the repository at this point in the history
…atteries

fix(validate): allow `homeBattery` devices to not provide `batteries` array
  • Loading branch information
RobinBol authored Jan 20, 2025
2 parents cb6a267 + 17a66df commit 4dc0d6d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ class App {

// validate battery
if (BATTERY_CAPABILITIES.includes(capabilityId)) {
if (!driver.energy || !Array.isArray(driver.energy.batteries)) {
if ((!driver.energy || (!Array.isArray(driver.energy.batteries) && !driver.energy.homeBattery))) {
if (levelPublish) {
throw new Error(`drivers.${driver.id} is missing an array 'energy.batteries' because the capability ${capabilityId} is being used.`);
}
Expand Down

0 comments on commit 4dc0d6d

Please sign in to comment.