From f5ca5c17bf84412afa69bdf1f422aa9928c832c5 Mon Sep 17 00:00:00 2001 From: Rod Begbie Date: Sun, 5 Apr 2026 14:31:48 -0700 Subject: [PATCH] fix: normalise ZoneGroup to array when only one zone group exists convertXmlToJson returns a plain object for single child elements, only promoting to array for duplicates. Wrap with [].concat() so getDevices/getDeviceLocation always iterate over an array regardless of how many zone groups are present. Co-Authored-By: Claude Sonnet 4.6 --- src/modules/common/sonosController.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/common/sonosController.js b/src/modules/common/sonosController.js index b9661df..d8e1a23 100644 --- a/src/modules/common/sonosController.js +++ b/src/modules/common/sonosController.js @@ -100,7 +100,7 @@ export class SonosController { }; // Search through all zone groups - const groups = jsonState?.ZoneGroups?.ZoneGroup || []; + const groups = [].concat(jsonState?.ZoneGroups?.ZoneGroup || []); for (const group of groups) { // Check main zone group member const member = group.ZoneGroupMember; @@ -155,7 +155,7 @@ export class SonosController { }; // Process all zone groups - const groups = jsonState?.ZoneGroups?.ZoneGroup || []; + const groups = [].concat(jsonState?.ZoneGroups?.ZoneGroup || []); for (const group of groups) { // Handle zone group members const members = group.ZoneGroupMember;