homebridge-multiple-switch 1.6.0-beta.9 → 1.6.0

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +28 -52
  2. package/index.js +3 -32
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,65 +1,41 @@
1
1
  # Changelog
2
2
 
3
- ## [1.6.0-beta.9] - 2026-03-22
4
-
5
- ### Fixed
6
- - Homebridge v2 compatibility — plugin now shows green checkmark in v2 readiness check
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)
10
-
11
- ### Changed
12
- - Master switch type now defaults to Switch instead of Outlet (both UI and backend)
13
-
14
- ## [1.6.0-beta.5] - 2026-03-21
15
-
16
- ### Fixed
17
- - Switch names now correctly appear in HomeKit — services are recreated on each
18
- start with fresh displayName, Name, and ConfiguredName (cached services kept
19
- stale names from initial creation)
20
- - Master switch now always appears first in HomeKit — all subtype services are
21
- removed and recreated in correct order (master first, then switches)
22
-
23
- ### Changed
24
- - Master switch type selector now inline with the toggle (same row)
25
-
26
- ## [1.6.0-beta.4] - 2026-03-21
3
+ ## [1.6.0] - 2026-03-22
27
4
 
28
5
  ### Added
29
- - Master switch type selection (Switch or Outlet) appears when master switch is enabled
30
- - `masterSwitchType` config option
6
+ - Multi-device support: create multiple separate HomeKit accessories, each with
7
+ its own name, switch behavior mode, and set of switches
8
+ - `devices` array in config — each device becomes a separate accessory in HomeKit
9
+ - Master Switch option (available in Independent mode): adds an extra switch
10
+ that turns all switches on or off at once
11
+ - Master switch type selection (Switch or Outlet)
12
+ - Collapsible device and switch cards in config UI with chevron animation
13
+ - Summary info shown when collapsed (switch count for devices, type/delay for switches)
14
+ - i18n localization with 14 languages: English, Turkish, German, French, Spanish,
15
+ Portuguese, Italian, Russian, Chinese (Simplified), Japanese, Korean, Polish,
16
+ Dutch, Arabic
17
+ - Custom UI (`homebridge-ui/public/`) with `homebridge.i18nCurrentLang()` for
18
+ proper language detection
19
+ - Descriptions for both switch behavior modes (Independent / Single)
20
+ - ConfiguredName characteristic for correct switch names in HomeKit
21
+ - Homebridge v2 compatibility (`^2.0.0-beta.0` in engines)
31
22
 
32
23
  ### Changed
33
- - All devices and switches now start collapsed when config UI is opened
34
- - New devices/switches still open expanded when freshly added
35
-
36
- ## [1.6.0-beta.3] - 2026-03-21
24
+ - Switch behavior now has two modes: Independent and Single (removed Master mode)
25
+ - Master switch type defaults to Switch instead of Outlet
26
+ - All devices and switches start collapsed when config UI is opened
27
+ - Services are recreated on each start to ensure fresh names in HomeKit
37
28
 
38
29
  ### Fixed
39
- - Switch names now display correctly in HomeKit using `ConfiguredName`
40
- characteristic (previously all showed the device name)
41
- - Master switch now always appears first in HomeKit (created before regular switches)
42
-
43
- ## [1.6.0-beta.2] - 2026-03-21
44
-
45
- ### Fixed
46
- - Master Switch now available in Independent mode (was incorrectly in Single mode)
47
- - Behavior description now appears below the select dropdown instead of above
48
-
49
- ## [1.6.0-beta.1] - 2026-03-21
30
+ - Dark mode: custom `--ui-*` CSS variables with `@media (prefers-color-scheme: dark)`
31
+ for reliable theme support inside iframe
32
+ - Switch names now correctly appear in HomeKit (cached services kept stale names)
33
+ - Backward compatibility: old configs with `switches` at root level auto-migrate
34
+ to `devices` format
50
35
 
51
36
  ### Removed
52
- - Master switch behavior mode replaced by a more useful master switch option
53
- within Single mode
54
-
55
- ### Changed
56
- - Switch behavior now only has two modes: Independent and Single
57
- - Added descriptions to both behavior modes explaining how they work
58
-
59
- ### Added
60
- - Master Switch option (available in Single mode only): adds an extra switch
61
- that turns all switches on or off at once
62
- - New i18n keys for behavior descriptions, master switch label/description
37
+ - Lightbulb and Fan switch types (HomeKit natively converts switches to these)
38
+ - Master behavior mode (replaced by Master Switch option in Independent mode)
63
39
 
64
40
  ## [1.5.1] - 2026-03-21
65
41
 
package/index.js CHANGED
@@ -113,44 +113,26 @@ class MultipleSwitchPlatform {
113
113
  }
114
114
 
115
115
  reconcileServices(accessory, device, switches, services, hasMaster) {
116
- // Remove ALL existing subtype services (ensures fresh names and correct order)
116
+ // Remove ALL existing subtype services (ensures fresh names)
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
- const orderedServices = [];
134
-
135
- // 1. Create master switch FIRST if enabled (appears at top in HomeKit)
120
+ // Create master switch if enabled
136
121
  if (hasMaster) {
137
122
  const MasterServiceClass = this.getServiceClass(device.masterSwitchType || 'switch');
138
123
  const masterService = accessory.addService(MasterServiceClass, 'Master', MASTER_SUBTYPE);
139
124
 
140
125
  this.setServiceName(masterService, 'Master');
141
- masterService.addOptionalCharacteristic(this.Characteristic.ServiceLabelIndex);
142
- masterService.setCharacteristic(this.Characteristic.ServiceLabelIndex, labelIndex++);
143
126
  this.configureMasterHandler(accessory, masterService, services);
144
127
 
145
128
  services.set(MASTER_SUBTYPE, masterService);
146
- orderedServices.push(masterService);
147
129
 
148
130
  if (accessory.context.switchStates[MASTER_SUBTYPE] === undefined) {
149
131
  accessory.context.switchStates[MASTER_SUBTYPE] = false;
150
132
  }
151
133
  }
152
134
 
153
- // 2. Create regular switches in config order
135
+ // Create regular switches
154
136
  switches.forEach((sw, index) => {
155
137
  const subtype = `switch_${index}`;
156
138
 
@@ -158,26 +140,15 @@ class MultipleSwitchPlatform {
158
140
  const service = accessory.addService(ServiceClass, sw.name, subtype);
159
141
 
160
142
  this.setServiceName(service, sw.name);
161
- service.addOptionalCharacteristic(this.Characteristic.ServiceLabelIndex);
162
- service.setCharacteristic(this.Characteristic.ServiceLabelIndex, labelIndex++);
163
143
  this.configureSwitchHandlers(accessory, service, sw, subtype, services);
164
144
 
165
145
  services.set(subtype, service);
166
- orderedServices.push(service);
167
146
 
168
147
  if (accessory.context.switchStates[subtype] === undefined) {
169
148
  accessory.context.switchStates[subtype] = sw.defaultState || false;
170
149
  }
171
150
  });
172
151
 
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
-
181
152
  // Clean up states for removed switches
182
153
  const activeKeys = new Set(services.keys());
183
154
  for (const key of Object.keys(accessory.context.switchStates)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-multiple-switch",
3
- "version": "1.6.0-beta.9",
3
+ "version": "1.6.0",
4
4
  "description": "Multiple switch platform for Homebridge",
5
5
  "homepage": "https://github.com/azadaydinli/homebridge-multiple-switch",
6
6
  "main": "index.js",