@switchbot/homebridge-switchbot 3.6.1-beta.8 → 3.7.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 (118) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/dist/device/blindtilt.js +3 -3
  3. package/dist/device/blindtilt.js.map +1 -1
  4. package/dist/device/bot.js +12 -12
  5. package/dist/device/bot.js.map +1 -1
  6. package/dist/device/ceilinglight.js +1 -1
  7. package/dist/device/ceilinglight.js.map +1 -1
  8. package/dist/device/colorbulb.js +1 -1
  9. package/dist/device/colorbulb.js.map +1 -1
  10. package/dist/device/contact.js +4 -4
  11. package/dist/device/contact.js.map +1 -1
  12. package/dist/device/curtain.js +3 -3
  13. package/dist/device/curtain.js.map +1 -1
  14. package/dist/device/device.d.ts +1 -9
  15. package/dist/device/device.d.ts.map +1 -1
  16. package/dist/device/device.js +14 -38
  17. package/dist/device/device.js.map +1 -1
  18. package/dist/device/fan.js +3 -3
  19. package/dist/device/fan.js.map +1 -1
  20. package/dist/device/hub.js +3 -3
  21. package/dist/device/hub.js.map +1 -1
  22. package/dist/device/humidifier.js +2 -2
  23. package/dist/device/humidifier.js.map +1 -1
  24. package/dist/device/iosensor.js +3 -3
  25. package/dist/device/iosensor.js.map +1 -1
  26. package/dist/device/lightstrip.js +1 -1
  27. package/dist/device/lightstrip.js.map +1 -1
  28. package/dist/device/lock.js +4 -4
  29. package/dist/device/lock.js.map +1 -1
  30. package/dist/device/meter.js +3 -3
  31. package/dist/device/meter.js.map +1 -1
  32. package/dist/device/meterplus.js +3 -3
  33. package/dist/device/meterplus.js.map +1 -1
  34. package/dist/device/motion.d.ts.map +1 -1
  35. package/dist/device/motion.js +4 -5
  36. package/dist/device/motion.js.map +1 -1
  37. package/dist/device/plug.js +2 -2
  38. package/dist/device/plug.js.map +1 -1
  39. package/dist/device/robotvacuumcleaner.js +3 -3
  40. package/dist/device/robotvacuumcleaner.js.map +1 -1
  41. package/dist/device/waterdetector.js +2 -2
  42. package/dist/device/waterdetector.js.map +1 -1
  43. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  44. package/dist/irdevice/airconditioner.js +4 -3
  45. package/dist/irdevice/airconditioner.js.map +1 -1
  46. package/dist/irdevice/airpurifier.js +2 -2
  47. package/dist/irdevice/airpurifier.js.map +1 -1
  48. package/dist/irdevice/camera.js +1 -1
  49. package/dist/irdevice/camera.js.map +1 -1
  50. package/dist/irdevice/fan.js +1 -1
  51. package/dist/irdevice/fan.js.map +1 -1
  52. package/dist/irdevice/irdevice.d.ts +1 -0
  53. package/dist/irdevice/irdevice.d.ts.map +1 -1
  54. package/dist/irdevice/irdevice.js +14 -11
  55. package/dist/irdevice/irdevice.js.map +1 -1
  56. package/dist/irdevice/light.js +3 -3
  57. package/dist/irdevice/light.js.map +1 -1
  58. package/dist/irdevice/other.d.ts +1 -1
  59. package/dist/irdevice/other.d.ts.map +1 -1
  60. package/dist/irdevice/other.js +26 -36
  61. package/dist/irdevice/other.js.map +1 -1
  62. package/dist/irdevice/tv.js +3 -3
  63. package/dist/irdevice/tv.js.map +1 -1
  64. package/dist/irdevice/vacuumcleaner.js +1 -1
  65. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  66. package/dist/irdevice/waterheater.js +2 -2
  67. package/dist/irdevice/waterheater.js.map +1 -1
  68. package/dist/platform.d.ts +9 -0
  69. package/dist/platform.d.ts.map +1 -1
  70. package/dist/platform.js +319 -91
  71. package/dist/platform.js.map +1 -1
  72. package/dist/settings.d.ts +1 -1
  73. package/dist/settings.d.ts.map +1 -1
  74. package/docs/.nojekyll +1 -0
  75. package/docs/assets/highlight.css +22 -0
  76. package/docs/assets/icons.js +18 -0
  77. package/docs/assets/icons.svg +1 -0
  78. package/docs/assets/main.js +60 -0
  79. package/docs/assets/navigation.js +1 -0
  80. package/docs/assets/search.js +1 -0
  81. package/docs/assets/style.css +1448 -0
  82. package/docs/functions/default.html +1 -0
  83. package/docs/index.html +368 -0
  84. package/docs/modules.html +2 -0
  85. package/package.json +10 -7
  86. package/src/device/blindtilt.ts +3 -3
  87. package/src/device/bot.ts +12 -12
  88. package/src/device/ceilinglight.ts +1 -1
  89. package/src/device/colorbulb.ts +1 -1
  90. package/src/device/contact.ts +4 -4
  91. package/src/device/curtain.ts +3 -3
  92. package/src/device/device.ts +15 -44
  93. package/src/device/fan.ts +3 -3
  94. package/src/device/hub.ts +3 -3
  95. package/src/device/humidifier.ts +2 -2
  96. package/src/device/iosensor.ts +3 -3
  97. package/src/device/lightstrip.ts +1 -1
  98. package/src/device/lock.ts +4 -4
  99. package/src/device/meter.ts +4 -4
  100. package/src/device/meterplus.ts +4 -4
  101. package/src/device/motion.ts +6 -7
  102. package/src/device/plug.ts +2 -2
  103. package/src/device/robotvacuumcleaner.ts +3 -3
  104. package/src/device/waterdetector.ts +2 -2
  105. package/src/irdevice/airconditioner.ts +5 -4
  106. package/src/irdevice/airpurifier.ts +2 -2
  107. package/src/irdevice/camera.ts +1 -1
  108. package/src/irdevice/fan.ts +1 -1
  109. package/src/irdevice/irdevice.ts +15 -11
  110. package/src/irdevice/light.ts +3 -3
  111. package/src/irdevice/other.ts +26 -34
  112. package/src/irdevice/tv.ts +3 -3
  113. package/src/irdevice/vacuumcleaner.ts +1 -1
  114. package/src/irdevice/waterheater.ts +2 -2
  115. package/src/platform.ts +324 -90
  116. package/src/settings.ts +1 -1
  117. package/typedoc.json +17 -0
  118. package/.github/npm-version-script.cjs +0 -81
@@ -43,11 +43,11 @@ export abstract class irdeviceBase {
43
43
  .getService(this.hap.Service.AccessoryInformation)!
44
44
  .setCharacteristic(this.hap.Characteristic.Manufacturer, 'SwitchBot')
45
45
  .setCharacteristic(this.hap.Characteristic.AppMatchingIdentifier, 'id1087374760')
46
- .setCharacteristic(this.hap.Characteristic.Name, device.configDeviceName ?? device.deviceName ?? accessory.displayName)
47
- .setCharacteristic(this.hap.Characteristic.ConfiguredName, device.configDeviceName ?? device.deviceName ?? accessory.displayName)
46
+ .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
47
+ .setCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.displayName)
48
48
  .setCharacteristic(this.hap.Characteristic.Model, accessory.context.model ?? 'Unknown')
49
- .setCharacteristic(this.hap.Characteristic.ProductData, accessory.context.deviceId)
50
- .setCharacteristic(this.hap.Characteristic.SerialNumber, accessory.context.deviceId);
49
+ .setCharacteristic(this.hap.Characteristic.ProductData, device.deviceId)
50
+ .setCharacteristic(this.hap.Characteristic.SerialNumber, device.deviceId);
51
51
  }
52
52
 
53
53
  async getDeviceLogSettings(device: irdevice & irDevicesConfig): Promise<void> {
@@ -199,9 +199,9 @@ export abstract class irdeviceBase {
199
199
  } else {
200
200
  Service.updateCharacteristic(Characteristic, CharacteristicValue);
201
201
  await this.debugLog(`updateCharacteristic ${CharacteristicName}: ${CharacteristicValue}`);
202
- await this.debugWarnLog(`context before: ${this.accessory.context[CharacteristicName]}`);
202
+ await this.debugWarnLog(`${CharacteristicName} context before: ${this.accessory.context[CharacteristicName]}`);
203
203
  this.accessory.context[CharacteristicName] = CharacteristicValue;
204
- await this.debugWarnLog(`context after: ${this.accessory.context[CharacteristicName]}`);
204
+ await this.debugWarnLog(`${CharacteristicName} context after: ${this.accessory.context[CharacteristicName]}`);
205
205
  }
206
206
  }
207
207
 
@@ -363,7 +363,7 @@ export abstract class irdeviceBase {
363
363
 
364
364
  async debugSuccessLog(...log: any[]): Promise<void> {
365
365
  if (await this.enablingDeviceLogging()) {
366
- if (this.deviceLogging?.includes('debug')) {
366
+ if (await this.loggingIsDebug()) {
367
367
  this.log.success(`[DEBUG] ${this.device.remoteType}: ${this.accessory.displayName}`, String(...log));
368
368
  }
369
369
  }
@@ -377,7 +377,7 @@ export abstract class irdeviceBase {
377
377
 
378
378
  async debugWarnLog(...log: any[]): Promise<void> {
379
379
  if (await this.enablingDeviceLogging()) {
380
- if (this.deviceLogging?.includes('debug')) {
380
+ if (await this.loggingIsDebug()) {
381
381
  this.log.warn(`[DEBUG] ${this.device.remoteType}: ${this.accessory.displayName}`, String(...log));
382
382
  }
383
383
  }
@@ -391,7 +391,7 @@ export abstract class irdeviceBase {
391
391
 
392
392
  async debugErrorLog(...log: any[]): Promise<void> {
393
393
  if (await this.enablingDeviceLogging()) {
394
- if (this.deviceLogging?.includes('debug')) {
394
+ if (await this.loggingIsDebug()) {
395
395
  this.log.error(`[DEBUG] ${this.device.remoteType}: ${this.accessory.displayName}`, String(...log));
396
396
  }
397
397
  }
@@ -401,13 +401,17 @@ export abstract class irdeviceBase {
401
401
  if (await this.enablingDeviceLogging()) {
402
402
  if (this.deviceLogging === 'debug') {
403
403
  this.log.info(`[DEBUG] ${this.device.remoteType}: ${this.accessory.displayName}`, String(...log));
404
- } else {
404
+ } else if (this.deviceLogging === 'debugMode') {
405
405
  this.log.debug(`${this.device.remoteType}: ${this.accessory.displayName}`, String(...log));
406
406
  }
407
407
  }
408
408
  }
409
409
 
410
+ async loggingIsDebug(): Promise<boolean> {
411
+ return this.deviceLogging === 'debugMode' || this.deviceLogging === 'debug';
412
+ }
413
+
410
414
  async enablingDeviceLogging(): Promise<boolean> {
411
- return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
415
+ return this.deviceLogging === 'debugMode' || this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
412
416
  }
413
417
  }
@@ -49,7 +49,7 @@ export class Light extends irdeviceBase {
49
49
  // Initialize LightBulb Service
50
50
  accessory.context.LightBulb = accessory.context.LightBulb ?? {};
51
51
  this.LightBulb = {
52
- Name: accessory.context.LightBulb.Name ?? `${accessory.displayName} ${device.remoteType}`,
52
+ Name: accessory.displayName,
53
53
  Service: accessory.getService(this.hap.Service.Lightbulb) ?? accessory.addService(this.hap.Service.Lightbulb) as Service,
54
54
  On: accessory.context.On || false,
55
55
  };
@@ -66,7 +66,7 @@ export class Light extends irdeviceBase {
66
66
  // Initialize ProgrammableSwitchOn Service
67
67
  accessory.context.ProgrammableSwitchOn = accessory.context.ProgrammableSwitchOn ?? {};
68
68
  this.ProgrammableSwitchOn = {
69
- Name: accessory.context.ProgrammableSwitchOn.Name ?? `${accessory.displayName} ${device.remoteType} On`,
69
+ Name: `${accessory.displayName} On`,
70
70
  Service: accessory.getService(this.hap.Service.StatefulProgrammableSwitch)
71
71
  ?? accessory.addService(this.hap.Service.StatefulProgrammableSwitch) as Service,
72
72
  ProgrammableSwitchEvent: accessory.context.ProgrammableSwitchEvent ?? this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS,
@@ -97,7 +97,7 @@ export class Light extends irdeviceBase {
97
97
  // Initialize ProgrammableSwitchOff Service
98
98
  accessory.context.ProgrammableSwitchOff = accessory.context.ProgrammableSwitchOff ?? {};
99
99
  this.ProgrammableSwitchOff = {
100
- Name: accessory.context.ProgrammableSwitchOff.Name ?? `${accessory.displayName} ${device.remoteType} Off`,
100
+ Name: `${accessory.displayName} Off`,
101
101
  Service: accessory.getService(this.hap.Service.StatefulProgrammableSwitch)
102
102
  ?? accessory.addService(this.hap.Service.StatefulProgrammableSwitch) as Service,
103
103
  ProgrammableSwitchEvent: accessory.context.ProgrammableSwitchEvent ?? this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS,
@@ -79,7 +79,7 @@ export class Others extends irdeviceBase {
79
79
  super(platform, accessory, device);
80
80
 
81
81
  // default placeholders
82
- this.getOtherConfigSettings(device);
82
+ this.getOtherConfigSettings(accessory, device);
83
83
 
84
84
  // deviceType
85
85
  if (this.otherDeviceType === 'switch') {
@@ -88,7 +88,7 @@ export class Others extends irdeviceBase {
88
88
  // Initialize Switch Service
89
89
  accessory.context.Switch = accessory.context.Switch ?? {};
90
90
  this.Switch = {
91
- Name: accessory.context.Switch.Name ?? accessory.displayName,
91
+ Name: accessory.displayName,
92
92
  Service: accessory.getService(this.hap.Service.Switch) ?? accessory.addService(this.hap.Service.Switch) as Service,
93
93
  };
94
94
  accessory.context.Switch = this.Switch as object;
@@ -114,7 +114,7 @@ export class Others extends irdeviceBase {
114
114
  // Initialize GarageDoor Service
115
115
  accessory.context.GarageDoor = accessory.context.GarageDoor ?? {};
116
116
  this.GarageDoor = {
117
- Name: accessory.context.GarageDoor.Name ?? accessory.displayName,
117
+ Name: accessory.displayName,
118
118
  Service: accessory.getService(this.hap.Service.GarageDoorOpener) ?? accessory.addService(this.hap.Service.GarageDoorOpener) as Service,
119
119
  };
120
120
  accessory.context.GarageDoor = this.GarageDoor as object;
@@ -147,7 +147,7 @@ export class Others extends irdeviceBase {
147
147
  // Initialize Door Service
148
148
  accessory.context.Door = accessory.context.Door ?? {};
149
149
  this.Door = {
150
- Name: accessory.context.Door.Name ?? accessory.displayName,
150
+ Name: accessory.displayName,
151
151
  Service: accessory.getService(this.hap.Service.Door) ?? accessory.addService(this.hap.Service.Door) as Service,
152
152
  };
153
153
  accessory.context.Door = this.Door as object;
@@ -179,7 +179,7 @@ export class Others extends irdeviceBase {
179
179
  // Initialize Window Service
180
180
  accessory.context.Window = accessory.context.Window ?? {};
181
181
  this.Window = {
182
- Name: accessory.context.Window.Name ?? accessory.displayName,
182
+ Name: accessory.displayName,
183
183
  Service: accessory.getService(this.hap.Service.Window) ?? accessory.addService(this.hap.Service.Window) as Service,
184
184
  };
185
185
  accessory.context.Window = this.Window as object;
@@ -211,7 +211,7 @@ export class Others extends irdeviceBase {
211
211
  // Initialize WindowCovering Service
212
212
  accessory.context.WindowCovering = accessory.context.WindowCovering ?? {};
213
213
  this.WindowCovering = {
214
- Name: accessory.context.WindowCovering.Name ?? accessory.displayName,
214
+ Name: accessory.displayName,
215
215
  Service: accessory.getService(this.hap.Service.WindowCovering) ?? accessory.addService(this.hap.Service.WindowCovering) as Service,
216
216
  };
217
217
  accessory.context.WindowCovering = this.WindowCovering as object;
@@ -244,7 +244,7 @@ export class Others extends irdeviceBase {
244
244
  // Initialize Lock Service
245
245
  accessory.context.LockMechanism = accessory.context.LockMechanism ?? {};
246
246
  this.LockMechanism = {
247
- Name: accessory.context.LockMechanism.Name ?? accessory.displayName,
247
+ Name: accessory.displayName,
248
248
  Service: accessory.getService(this.hap.Service.LockMechanism) ?? accessory.addService(this.hap.Service.LockMechanism) as Service,
249
249
  };
250
250
  accessory.context.LockMechanism = this.LockMechanism as object;
@@ -271,7 +271,7 @@ export class Others extends irdeviceBase {
271
271
  // Initialize Faucet Service
272
272
  accessory.context.Faucet = accessory.context.Faucet ?? {};
273
273
  this.Faucet = {
274
- Name: accessory.context.Faucet.Name ?? accessory.displayName,
274
+ Name: accessory.displayName,
275
275
  Service: accessory.getService(this.hap.Service.Faucet) ?? accessory.addService(this.hap.Service.Faucet) as Service,
276
276
  };
277
277
  accessory.context.Faucet = this.Faucet as object;
@@ -297,7 +297,7 @@ export class Others extends irdeviceBase {
297
297
  // Initialize Fan Service
298
298
  accessory.context.Fan = accessory.context.Fan ?? {};
299
299
  this.Fan = {
300
- Name: accessory.context.Fan.Name ?? accessory.displayName,
300
+ Name: accessory.displayName,
301
301
  Service: accessory.getService(this.hap.Service.Fanv2) ?? accessory.addService(this.hap.Service.Fanv2) as Service,
302
302
  };
303
303
  accessory.context.Fan = this.Fan as object;
@@ -323,7 +323,7 @@ export class Others extends irdeviceBase {
323
323
  // Initialize StatefulProgrammableSwitch Service
324
324
  accessory.context.StatefulProgrammableSwitch = accessory.context.StatefulProgrammableSwitch ?? {};
325
325
  this.StatefulProgrammableSwitch = {
326
- Name: accessory.context.StatefulProgrammableSwitch.Name ?? accessory.displayName,
326
+ Name: accessory.displayName,
327
327
  Service: accessory.getService(this.hap.Service.StatefulProgrammableSwitch)
328
328
  ?? accessory.addService(this.hap.Service.StatefulProgrammableSwitch) as Service,
329
329
  };
@@ -350,7 +350,7 @@ export class Others extends irdeviceBase {
350
350
  // Initialize Switch property
351
351
  accessory.context.Outlet = accessory.context.Outlet ?? {};
352
352
  this.Outlet = {
353
- Name: accessory.context.Outlet.Name ?? accessory.displayName,
353
+ Name: accessory.displayName,
354
354
  Service: accessory.getService(this.hap.Service.Outlet) ?? accessory.addService(this.hap.Service.Outlet) as Service,
355
355
  };
356
356
  accessory.context.Outlet = this.Outlet as object;
@@ -713,7 +713,7 @@ export class Others extends irdeviceBase {
713
713
  // If Outlet.Service still present, then remove first
714
714
  accessory.context.Outlet = accessory.context.Outlet ?? {};
715
715
  this.Outlet = {
716
- Name: accessory.context.Outlet.Name ?? `${accessory.displayName} Outlet`,
716
+ Name: accessory.displayName,
717
717
  Service: accessory.getService(this.hap.Service.Outlet) as Service,
718
718
  };
719
719
  accessory.context.Outlet = this.Outlet as object;
@@ -725,7 +725,7 @@ export class Others extends irdeviceBase {
725
725
  // If GarageDoor.Service still present, then remove first
726
726
  accessory.context.GarageDoor = accessory.context.GarageDoor ?? {};
727
727
  this.GarageDoor = {
728
- Name: accessory.context.GarageDoor.Name ?? `${accessory.displayName} Garage Door`,
728
+ Name: accessory.displayName,
729
729
  Service: accessory.getService(this.hap.Service.GarageDoorOpener) as Service,
730
730
  };
731
731
  accessory.context.GarageDoor = this.GarageDoor as object;
@@ -737,7 +737,7 @@ export class Others extends irdeviceBase {
737
737
  // If Door.Service still present, then remove first
738
738
  accessory.context.Door = accessory.context.Door ?? {};
739
739
  this.Door = {
740
- Name: accessory.context.Door.Name ?? `${accessory.displayName} Door`,
740
+ Name: accessory.displayName,
741
741
  Service: accessory.getService(this.hap.Service.Door) as Service,
742
742
  };
743
743
  accessory.context.Door = this.Door as object;
@@ -749,7 +749,7 @@ export class Others extends irdeviceBase {
749
749
  // If Lock.Service still present, then remove first
750
750
  accessory.context.LockMechanism = accessory.context.LockMechanism ?? {};
751
751
  this.LockMechanism = {
752
- Name: accessory.context.LockMechanism.Name ?? `${accessory.displayName} Lock`,
752
+ Name: accessory.displayName,
753
753
  Service: accessory.getService(this.hap.Service.LockMechanism) as Service,
754
754
  };
755
755
  accessory.context.LockMechanism = this.LockMechanism as object;
@@ -761,7 +761,7 @@ export class Others extends irdeviceBase {
761
761
  // If Faucet.Service still present, then remove first
762
762
  accessory.context.Faucet = accessory.context.Faucet ?? {};
763
763
  this.Faucet = {
764
- Name: accessory.context.Faucet.Name ?? `${accessory.displayName} Faucet`,
764
+ Name: accessory.displayName,
765
765
  Service: accessory.getService(this.hap.Service.Faucet) as Service,
766
766
  };
767
767
  accessory.context.Faucet = this.Faucet as object;
@@ -773,7 +773,7 @@ export class Others extends irdeviceBase {
773
773
  // If Fan Service still present, then remove first
774
774
  accessory.context.Fan = accessory.context.Fan ?? {};
775
775
  this.Fan = {
776
- Name: accessory.context.Fan.Name ?? `${accessory.displayName} Fan`,
776
+ Name: accessory.displayName,
777
777
  Service: accessory.getService(this.hap.Service.Fanv2) as Service,
778
778
  };
779
779
  accessory.context.Fan = this.Fan as object;
@@ -785,7 +785,7 @@ export class Others extends irdeviceBase {
785
785
  // If Window.Service still present, then remove first
786
786
  accessory.context.Window = accessory.context.Window ?? {};
787
787
  this.Window = {
788
- Name: accessory.context.Window.Name ?? `${accessory.displayName} Window`,
788
+ Name: accessory.displayName,
789
789
  Service: accessory.getService(this.hap.Service.Window) as Service,
790
790
  };
791
791
  accessory.context.Window = this.Window as object;
@@ -797,7 +797,7 @@ export class Others extends irdeviceBase {
797
797
  // If WindowCovering.Service still present, then remove first
798
798
  accessory.context.WindowCovering = accessory.context.WindowCovering ?? {};
799
799
  this.WindowCovering = {
800
- Name: accessory.context.WindowCovering.Name ?? `${accessory.displayName} Window Covering`,
800
+ Name: accessory.displayName,
801
801
  Service: accessory.getService(this.hap.Service.WindowCovering) as Service,
802
802
  };
803
803
  accessory.context.WindowCovering = this.WindowCovering as object;
@@ -809,7 +809,7 @@ export class Others extends irdeviceBase {
809
809
  // If StatefulProgrammableSwitch.Service still present, then remove first
810
810
  accessory.context.StatefulProgrammableSwitch = accessory.context.StatefulProgrammableSwitch ?? {};
811
811
  this.StatefulProgrammableSwitch = {
812
- Name: accessory.context.StatefulProgrammableSwitch.Name ?? `${accessory.displayName} Stateful Programmable Switch`,
812
+ Name: accessory.displayName,
813
813
  Service: accessory.getService(this.hap.Service.StatefulProgrammableSwitch) as Service,
814
814
  };
815
815
  accessory.context.StatefulProgrammableSwitch = this.StatefulProgrammableSwitch as object;
@@ -821,7 +821,7 @@ export class Others extends irdeviceBase {
821
821
  // If Switch.Service still present, then remove first
822
822
  accessory.context.Switch = accessory.context.Switch ?? {};
823
823
  this.Switch = {
824
- Name: accessory.context.Switch.Name ?? `${accessory.displayName} Switch`,
824
+ Name: accessory.displayName,
825
825
  Service: accessory.getService(this.hap.Service.Switch) as Service,
826
826
  };
827
827
  accessory.context.Switch = this.Switch as object;
@@ -829,18 +829,10 @@ export class Others extends irdeviceBase {
829
829
  accessory.removeService(this.Switch.Service);
830
830
  }
831
831
 
832
- async getOtherConfigSettings(device: irdevice & irDevicesConfig): Promise<void> {
833
- if (!device.other?.deviceType && this.accessory.context.deviceType) {
834
- this.otherDeviceType = this.accessory.context.deviceType;
835
- await this.debugWarnLog(`Using Device Type: ${this.otherDeviceType}, from Accessory Cache.`);
836
- } else if (device.other?.deviceType) {
837
- this.accessory.context.deviceType = device.other.deviceType;
838
- await this.debugWarnLog(`Accessory Cache: ${this.accessory.context.deviceType}`);
839
- this.otherDeviceType = this.accessory.context.deviceType;
840
- await this.debugWarnLog(`Using Device Type: ${this.otherDeviceType}`);
841
- } else {
842
- this.otherDeviceType = 'outlet';
843
- this.warnLog(`no deviceType set, using default deviceType: ${this.otherDeviceType}`);
844
- }
832
+ async getOtherConfigSettings(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): Promise<void> {
833
+ this.otherDeviceType = accessory.context.otherDeviceType ? accessory.context.otherDeviceType
834
+ : device.other?.deviceType ? device.other.deviceType : 'outlet';
835
+ const deviceType = accessory.context.otherDeviceType ? 'Accessory Cache': device.other?.deviceType ? 'Device Config' : 'Default';
836
+ await this.debugLog(`Use ${deviceType} Type: ${this.otherDeviceType}`);
845
837
  }
846
838
  }
@@ -46,8 +46,8 @@ export class TV extends irdeviceBase {
46
46
  // Initialize Television Service
47
47
  accessory.context.Television = accessory.context.Television ?? {};
48
48
  this.Television = {
49
- Name: accessory.context.Television.Name ?? `${accessory.displayName} ${device.remoteType}`,
50
- ConfiguredName: accessory.context.Television.ConfiguredName ?? `${accessory.displayName} ${device.remoteType}`,
49
+ Name: accessory.displayName,
50
+ ConfiguredName: accessory.displayName,
51
51
  Service: accessory.getService(this.hap.Service.Television) ?? accessory.addService(this.hap.Service.Television) as Service,
52
52
  Active: accessory.context.Active ?? this.hap.Characteristic.Active.INACTIVE,
53
53
  ActiveIdentifier: accessory.context.ActiveIdentifier ?? 1,
@@ -105,7 +105,7 @@ export class TV extends irdeviceBase {
105
105
  // Initialize TelevisionSpeaker Service
106
106
  accessory.context.TelevisionSpeaker = accessory.context.TelevisionSpeaker ?? {};
107
107
  this.TelevisionSpeaker = {
108
- Name: accessory.context.TelevisionSpeaker.Name ?? `${accessory.displayName} ${device.remoteType} Speaker`,
108
+ Name: `${accessory.displayName} Speaker`,
109
109
  Service: accessory.getService(this.hap.Service.TelevisionSpeaker) ?? accessory.addService(this.hap.Service.TelevisionSpeaker) as Service,
110
110
  Active: accessory.context.Active ?? false,
111
111
  VolumeControlType: accessory.context.VolumeControlType ?? this.hap.Characteristic.VolumeControlType.ABSOLUTE,
@@ -34,7 +34,7 @@ export class VacuumCleaner extends irdeviceBase {
34
34
  // Initialize Switch Service
35
35
  accessory.context.Switch = accessory.context.Switch ?? {};
36
36
  this.Switch = {
37
- Name: accessory.context.Switch.Name ?? `${accessory.displayName} ${device.remoteType}`,
37
+ Name: accessory.displayName,
38
38
  Service: accessory.getService(this.hap.Service.Switch) ?? accessory.addService(this.hap.Service.Switch) as Service,
39
39
  On: accessory.context.On ?? false,
40
40
  };
@@ -34,14 +34,14 @@ export class WaterHeater extends irdeviceBase {
34
34
  // Initialize Switch Service
35
35
  accessory.context.Valve = accessory.context.Valve ?? {};
36
36
  this.Valve = {
37
- Name: accessory.context.Valve.Name ?? `${accessory.displayName} ${device.remoteType}`,
37
+ Name: accessory.displayName,
38
38
  Service: accessory.getService(this.hap.Service.Valve) ?? accessory.addService(this.hap.Service.Valve) as Service,
39
39
  Active: accessory.context.Active ?? this.hap.Characteristic.Active.INACTIVE,
40
40
  };
41
41
  accessory.context.Valve = this.Valve as object;
42
42
 
43
43
  this.Valve.Service
44
- .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
44
+ .setCharacteristic(this.hap.Characteristic.Name, this.Valve.Name)
45
45
  .setCharacteristic(this.hap.Characteristic.ValveType, this.hap.Characteristic.ValveType.GENERIC_VALVE)
46
46
  .getCharacteristic(this.hap.Characteristic.Active)
47
47
  .onGet(() => {