homebridge-multiple-switch 1.6.0-beta.6 → 1.6.0-beta.8

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 CHANGED
@@ -1,12 +1,13 @@
1
1
  # Changelog
2
2
 
3
- ## [1.6.0-beta.6] - 2026-03-21
3
+ ## [1.6.0-beta.8] - 2026-03-22
4
4
 
5
5
  ### Fixed
6
- - Behavior mode select now matches device name width (description moved below both
7
- columns instead of inside the narrow select column)
6
+ - Homebridge v2 compatibility — plugin now shows green checkmark in v2 readiness check
7
+ - Switch ordering in HomeKit now follows config order using ServiceLabelIndex
8
+
9
+ ### Changed
8
10
  - Master switch type now defaults to Switch instead of Outlet (both UI and backend)
9
- - Default state checkbox now vertically centered with the auto turn off input field
10
11
 
11
12
  ## [1.6.0-beta.5] - 2026-03-21
12
13
 
@@ -398,9 +398,9 @@
398
398
  <option value="independent" ${isIndependent ? 'selected' : ''}>${t.behaviorIndependent || 'Independent'}</option>
399
399
  <option value="single" ${isSingle ? 'selected' : ''}>${t.behaviorSingle || 'Single'}</option>
400
400
  </select>
401
+ <div class="desc" style="margin-top:6px">${behaviorDesc}</div>
401
402
  </div>
402
403
  </div>
403
- ${behaviorDesc ? `<div class="desc" style="margin-top:2px">${behaviorDesc}</div>` : ''}
404
404
 
405
405
  ${isIndependent ? `
406
406
  <div class="master-option">
@@ -462,14 +462,14 @@
462
462
  </select>
463
463
  </div>
464
464
  </div>
465
- <div class="inline-row" style="align-items:end">
465
+ <div class="inline-row">
466
466
  <div class="form-group">
467
467
  <label>${t.delayOff || 'Auto Turn Off (ms)'}</label>
468
468
  <input type="number" class="sw-field" data-dev="${di}" data-sw="${si}" data-field="delayOff" min="0" value="${sw.delayOff || 0}">
469
469
  </div>
470
- <div class="form-group" style="display:flex;flex-direction:column;justify-content:end">
470
+ <div class="form-group">
471
471
  <label>${t.defaultState || 'Default State'}</label>
472
- <div class="toggle-wrap" style="height:37px;display:flex;align-items:center">
472
+ <div class="toggle-wrap" style="margin-top:6px">
473
473
  <input type="checkbox" class="sw-field" data-dev="${di}" data-sw="${si}" data-field="defaultState" ${sw.defaultState ? 'checked' : ''}>
474
474
  <span>${sw.defaultState ? (t.on || 'On') : (t.off || 'Off')}</span>
475
475
  </div>
package/index.js CHANGED
@@ -117,12 +117,28 @@ class MultipleSwitchPlatform {
117
117
  const subtypeServices = accessory.services.filter((s) => s.subtype);
118
118
  subtypeServices.forEach((s) => accessory.removeService(s));
119
119
 
120
+ // Remove existing ServiceLabel if present, then re-add to ensure ordering
121
+ const existingLabel = accessory.services.find(
122
+ (s) => s.UUID === this.Service.ServiceLabel.UUID
123
+ );
124
+ if (existingLabel) accessory.removeService(existingLabel);
125
+
126
+ const labelService = accessory.addService(this.Service.ServiceLabel);
127
+ labelService.setCharacteristic(
128
+ this.Characteristic.ServiceLabelNamespace,
129
+ this.Characteristic.ServiceLabelNamespace.ARABIC_NUMERALS
130
+ );
131
+
132
+ let labelIndex = 1;
133
+
120
134
  // 1. Create master switch FIRST if enabled (appears at top in HomeKit)
121
135
  if (hasMaster) {
122
136
  const MasterServiceClass = this.getServiceClass(device.masterSwitchType || 'switch');
123
137
  const masterService = accessory.addService(MasterServiceClass, 'Master', MASTER_SUBTYPE);
124
138
 
125
139
  this.setServiceName(masterService, 'Master');
140
+ masterService.addOptionalCharacteristic(this.Characteristic.ServiceLabelIndex);
141
+ masterService.setCharacteristic(this.Characteristic.ServiceLabelIndex, labelIndex++);
126
142
  this.configureMasterHandler(accessory, masterService, services);
127
143
 
128
144
  services.set(MASTER_SUBTYPE, masterService);
@@ -132,7 +148,7 @@ class MultipleSwitchPlatform {
132
148
  }
133
149
  }
134
150
 
135
- // 2. Create regular switches in order
151
+ // 2. Create regular switches in config order
136
152
  switches.forEach((sw, index) => {
137
153
  const subtype = `switch_${index}`;
138
154
 
@@ -140,6 +156,8 @@ class MultipleSwitchPlatform {
140
156
  const service = accessory.addService(ServiceClass, sw.name, subtype);
141
157
 
142
158
  this.setServiceName(service, sw.name);
159
+ service.addOptionalCharacteristic(this.Characteristic.ServiceLabelIndex);
160
+ service.setCharacteristic(this.Characteristic.ServiceLabelIndex, labelIndex++);
143
161
  this.configureSwitchHandlers(accessory, service, sw, subtype, services);
144
162
 
145
163
  services.set(subtype, service);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-multiple-switch",
3
- "version": "1.6.0-beta.6",
3
+ "version": "1.6.0-beta.8",
4
4
  "description": "Multiple switch platform for Homebridge",
5
5
  "homepage": "https://github.com/azadaydinli/homebridge-multiple-switch",
6
6
  "main": "index.js",
@@ -31,6 +31,6 @@
31
31
  },
32
32
  "engines": {
33
33
  "node": ">=18.0.0",
34
- "homebridge": ">=1.3.0"
34
+ "homebridge": "^1.3.0 || ^2.0.0-beta.0"
35
35
  }
36
36
  }