From 17a66df249ff8d41e0ee76cbe010413b275f204d Mon Sep 17 00:00:00 2001 From: Robin Bolscher Date: Mon, 20 Jan 2025 11:37:58 +0100 Subject: [PATCH] fix(validate): allow `homeBattery` devices to not provide `batteries` array It doesn't make sense for home batteries to provide the type of built-in battery. It was intended for battery operated devices that should list the type of battery they use for easy replacement. --- lib/App/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/index.js b/lib/App/index.js index 66fe5228..46b34b64 100644 --- a/lib/App/index.js +++ b/lib/App/index.js @@ -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.`); }