homebridge-multiple-switch 1.6.0-beta.8 → 1.6.0-beta.9
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 +4 -2
- package/index.js +11 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [1.6.0-beta.
|
|
3
|
+
## [1.6.0-beta.9] - 2026-03-22
|
|
4
4
|
|
|
5
5
|
### Fixed
|
|
6
6
|
- Homebridge v2 compatibility — plugin now shows green checkmark in v2 readiness check
|
|
7
|
-
- Switch ordering in HomeKit now
|
|
7
|
+
- Switch ordering in HomeKit — services are now linked to ServiceLabel with
|
|
8
|
+
ServiceLabelIndex for deterministic ordering (requires re-adding accessory in HomeKit
|
|
9
|
+
if previously cached)
|
|
8
10
|
|
|
9
11
|
### Changed
|
|
10
12
|
- Master switch type now defaults to Switch instead of Outlet (both UI and backend)
|
package/index.js
CHANGED
|
@@ -130,6 +130,7 @@ class MultipleSwitchPlatform {
|
|
|
130
130
|
);
|
|
131
131
|
|
|
132
132
|
let labelIndex = 1;
|
|
133
|
+
const orderedServices = [];
|
|
133
134
|
|
|
134
135
|
// 1. Create master switch FIRST if enabled (appears at top in HomeKit)
|
|
135
136
|
if (hasMaster) {
|
|
@@ -142,6 +143,7 @@ class MultipleSwitchPlatform {
|
|
|
142
143
|
this.configureMasterHandler(accessory, masterService, services);
|
|
143
144
|
|
|
144
145
|
services.set(MASTER_SUBTYPE, masterService);
|
|
146
|
+
orderedServices.push(masterService);
|
|
145
147
|
|
|
146
148
|
if (accessory.context.switchStates[MASTER_SUBTYPE] === undefined) {
|
|
147
149
|
accessory.context.switchStates[MASTER_SUBTYPE] = false;
|
|
@@ -161,12 +163,21 @@ class MultipleSwitchPlatform {
|
|
|
161
163
|
this.configureSwitchHandlers(accessory, service, sw, subtype, services);
|
|
162
164
|
|
|
163
165
|
services.set(subtype, service);
|
|
166
|
+
orderedServices.push(service);
|
|
164
167
|
|
|
165
168
|
if (accessory.context.switchStates[subtype] === undefined) {
|
|
166
169
|
accessory.context.switchStates[subtype] = sw.defaultState || false;
|
|
167
170
|
}
|
|
168
171
|
});
|
|
169
172
|
|
|
173
|
+
// Link all services to ServiceLabel for HomeKit ordering
|
|
174
|
+
for (const svc of orderedServices) {
|
|
175
|
+
labelService.addLinkedService(svc);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Log service order for debugging
|
|
179
|
+
this.log.info(`[${device.name}] Service order: ${orderedServices.map((s, i) => `${i + 1}. ${s.displayName}`).join(', ')}`);
|
|
180
|
+
|
|
170
181
|
// Clean up states for removed switches
|
|
171
182
|
const activeKeys = new Set(services.keys());
|
|
172
183
|
for (const key of Object.keys(accessory.context.switchStates)) {
|
package/package.json
CHANGED