@switchbot/homebridge-switchbot 5.0.0-beta.0 → 5.0.0-beta.10

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 (115) hide show
  1. package/dist/devices-matter/ColorLightAccessory.d.ts +3 -1
  2. package/dist/devices-matter/ColorLightAccessory.d.ts.map +1 -1
  3. package/dist/devices-matter/ColorLightAccessory.js +35 -36
  4. package/dist/devices-matter/ColorLightAccessory.js.map +1 -1
  5. package/dist/devices-matter/ColorTemperatureLightAccessory.d.ts +3 -1
  6. package/dist/devices-matter/ColorTemperatureLightAccessory.d.ts.map +1 -1
  7. package/dist/devices-matter/ColorTemperatureLightAccessory.js +32 -37
  8. package/dist/devices-matter/ColorTemperatureLightAccessory.js.map +1 -1
  9. package/dist/devices-matter/ContactSensorAccessory.d.ts +3 -1
  10. package/dist/devices-matter/ContactSensorAccessory.d.ts.map +1 -1
  11. package/dist/devices-matter/ContactSensorAccessory.js +16 -13
  12. package/dist/devices-matter/ContactSensorAccessory.js.map +1 -1
  13. package/dist/devices-matter/DimmableLightAccessory.d.ts +3 -1
  14. package/dist/devices-matter/DimmableLightAccessory.d.ts.map +1 -1
  15. package/dist/devices-matter/DimmableLightAccessory.js +24 -27
  16. package/dist/devices-matter/DimmableLightAccessory.js.map +1 -1
  17. package/dist/devices-matter/DoorLockAccessory.d.ts +3 -1
  18. package/dist/devices-matter/DoorLockAccessory.d.ts.map +1 -1
  19. package/dist/devices-matter/DoorLockAccessory.js +25 -22
  20. package/dist/devices-matter/DoorLockAccessory.js.map +1 -1
  21. package/dist/devices-matter/ExtendedColorLightAccessory.d.ts +3 -1
  22. package/dist/devices-matter/ExtendedColorLightAccessory.d.ts.map +1 -1
  23. package/dist/devices-matter/ExtendedColorLightAccessory.js +40 -41
  24. package/dist/devices-matter/ExtendedColorLightAccessory.js.map +1 -1
  25. package/dist/devices-matter/FanAccessory.d.ts +3 -1
  26. package/dist/devices-matter/FanAccessory.d.ts.map +1 -1
  27. package/dist/devices-matter/FanAccessory.js +31 -23
  28. package/dist/devices-matter/FanAccessory.js.map +1 -1
  29. package/dist/devices-matter/HumiditySensorAccessory.d.ts +3 -1
  30. package/dist/devices-matter/HumiditySensorAccessory.d.ts.map +1 -1
  31. package/dist/devices-matter/HumiditySensorAccessory.js +16 -15
  32. package/dist/devices-matter/HumiditySensorAccessory.js.map +1 -1
  33. package/dist/devices-matter/LeakSensorAccessory.d.ts +3 -1
  34. package/dist/devices-matter/LeakSensorAccessory.d.ts.map +1 -1
  35. package/dist/devices-matter/LeakSensorAccessory.js +16 -13
  36. package/dist/devices-matter/LeakSensorAccessory.js.map +1 -1
  37. package/dist/devices-matter/LightSensorAccessory.d.ts +3 -1
  38. package/dist/devices-matter/LightSensorAccessory.d.ts.map +1 -1
  39. package/dist/devices-matter/LightSensorAccessory.js +16 -15
  40. package/dist/devices-matter/LightSensorAccessory.js.map +1 -1
  41. package/dist/devices-matter/OccupancySensorAccessory.d.ts +3 -1
  42. package/dist/devices-matter/OccupancySensorAccessory.d.ts.map +1 -1
  43. package/dist/devices-matter/OccupancySensorAccessory.js +17 -21
  44. package/dist/devices-matter/OccupancySensorAccessory.js.map +1 -1
  45. package/dist/devices-matter/OnOffLightAccessory.d.ts +3 -1
  46. package/dist/devices-matter/OnOffLightAccessory.d.ts.map +1 -1
  47. package/dist/devices-matter/OnOffLightAccessory.js +22 -21
  48. package/dist/devices-matter/OnOffLightAccessory.js.map +1 -1
  49. package/dist/devices-matter/OnOffOutletAccessory.d.ts +3 -3
  50. package/dist/devices-matter/OnOffOutletAccessory.d.ts.map +1 -1
  51. package/dist/devices-matter/OnOffOutletAccessory.js +24 -27
  52. package/dist/devices-matter/OnOffOutletAccessory.js.map +1 -1
  53. package/dist/devices-matter/OnOffSwitchAccessory.d.ts +3 -1
  54. package/dist/devices-matter/OnOffSwitchAccessory.d.ts.map +1 -1
  55. package/dist/devices-matter/OnOffSwitchAccessory.js +18 -19
  56. package/dist/devices-matter/OnOffSwitchAccessory.js.map +1 -1
  57. package/dist/devices-matter/RoboticVacuumAccessory.d.ts +3 -1
  58. package/dist/devices-matter/RoboticVacuumAccessory.d.ts.map +1 -1
  59. package/dist/devices-matter/RoboticVacuumAccessory.js +77 -145
  60. package/dist/devices-matter/RoboticVacuumAccessory.js.map +1 -1
  61. package/dist/devices-matter/TemperatureSensorAccessory.d.ts +3 -1
  62. package/dist/devices-matter/TemperatureSensorAccessory.d.ts.map +1 -1
  63. package/dist/devices-matter/TemperatureSensorAccessory.js +18 -15
  64. package/dist/devices-matter/TemperatureSensorAccessory.js.map +1 -1
  65. package/dist/devices-matter/ThermostatAccessory.d.ts +3 -1
  66. package/dist/devices-matter/ThermostatAccessory.d.ts.map +1 -1
  67. package/dist/devices-matter/ThermostatAccessory.js +37 -29
  68. package/dist/devices-matter/ThermostatAccessory.js.map +1 -1
  69. package/dist/devices-matter/VenetianBlindAccessory.d.ts +3 -1
  70. package/dist/devices-matter/VenetianBlindAccessory.d.ts.map +1 -1
  71. package/dist/devices-matter/VenetianBlindAccessory.js +39 -40
  72. package/dist/devices-matter/VenetianBlindAccessory.js.map +1 -1
  73. package/dist/devices-matter/WindowBlindAccessory.d.ts +3 -1
  74. package/dist/devices-matter/WindowBlindAccessory.d.ts.map +1 -1
  75. package/dist/devices-matter/WindowBlindAccessory.js +36 -37
  76. package/dist/devices-matter/WindowBlindAccessory.js.map +1 -1
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +26 -1
  79. package/dist/index.js.map +1 -1
  80. package/dist/platform-hap.d.ts.map +1 -1
  81. package/dist/platform-hap.js +31 -2
  82. package/dist/platform-hap.js.map +1 -1
  83. package/dist/platform-matter.d.ts +45 -0
  84. package/dist/platform-matter.d.ts.map +1 -1
  85. package/dist/platform-matter.js +623 -1
  86. package/dist/platform-matter.js.map +1 -1
  87. package/dist/utils.d.ts +5 -0
  88. package/dist/utils.d.ts.map +1 -1
  89. package/dist/utils.js +43 -0
  90. package/dist/utils.js.map +1 -1
  91. package/docs/variables/default.html +1 -1
  92. package/package.json +1 -1
  93. package/src/devices-matter/ColorLightAccessory.ts +37 -40
  94. package/src/devices-matter/ColorTemperatureLightAccessory.ts +35 -41
  95. package/src/devices-matter/ContactSensorAccessory.ts +18 -14
  96. package/src/devices-matter/DimmableLightAccessory.ts +26 -30
  97. package/src/devices-matter/DoorLockAccessory.ts +28 -24
  98. package/src/devices-matter/ExtendedColorLightAccessory.ts +43 -47
  99. package/src/devices-matter/FanAccessory.ts +33 -25
  100. package/src/devices-matter/HumiditySensorAccessory.ts +18 -16
  101. package/src/devices-matter/LeakSensorAccessory.ts +18 -14
  102. package/src/devices-matter/LightSensorAccessory.ts +18 -16
  103. package/src/devices-matter/OccupancySensorAccessory.ts +18 -22
  104. package/src/devices-matter/OnOffLightAccessory.ts +23 -23
  105. package/src/devices-matter/OnOffOutletAccessory.ts +25 -31
  106. package/src/devices-matter/OnOffSwitchAccessory.ts +20 -21
  107. package/src/devices-matter/RoboticVacuumAccessory.ts +79 -156
  108. package/src/devices-matter/TemperatureSensorAccessory.ts +20 -16
  109. package/src/devices-matter/ThermostatAccessory.ts +39 -34
  110. package/src/devices-matter/VenetianBlindAccessory.ts +41 -44
  111. package/src/devices-matter/WindowBlindAccessory.ts +37 -39
  112. package/src/index.ts +27 -1
  113. package/src/platform-hap.ts +28 -2
  114. package/src/platform-matter.ts +661 -1
  115. package/src/utils.ts +49 -0
@@ -55,7 +55,7 @@ import { TV } from './irdevice/tv.js'
55
55
  import { VacuumCleaner } from './irdevice/vacuumcleaner.js'
56
56
  import { WaterHeater } from './irdevice/waterheater.js'
57
57
  import { PLATFORM_NAME, PLUGIN_NAME } from './settings.js'
58
- import { formatDeviceIdAsMac, isBlindTiltDevice, isCurtainDevice, safeStringify, sleep } from './utils.js'
58
+ import { cleanDeviceConfig, formatDeviceIdAsMac, isBlindTiltDevice, isCurtainDevice, safeStringify, sleep } from './utils.js'
59
59
 
60
60
  /**
61
61
  * HomebridgePlatform
@@ -119,6 +119,21 @@ export class SwitchBotHAPPlatform implements DynamicPlatformPlugin {
119
119
  devices: config.devices as { deviceId: string }[],
120
120
  }
121
121
 
122
+ // Normalize deviceConfig to remove UI-inserted defaults (lots of false/empty values)
123
+ try {
124
+ if ((this.config as any).options) {
125
+ const cleaned = cleanDeviceConfig((this.config as any).options.deviceConfig)
126
+ if (cleaned) {
127
+ ;(this.config as any).options.deviceConfig = cleaned
128
+ } else {
129
+ // remove the empty deviceConfig so downstream checks treat it as absent
130
+ delete (this.config as any).options.deviceConfig
131
+ }
132
+ }
133
+ } catch (e) {
134
+ this.debugErrorLog(`Failed to clean deviceConfig: ${e}`)
135
+ }
136
+
122
137
  // Plugin Configuration
123
138
  this.getPlatformLogSettings()
124
139
  this.getPlatformRateSettings()
@@ -190,7 +205,18 @@ export class SwitchBotHAPPlatform implements DynamicPlatformPlugin {
190
205
  this.debugLog('Executed didFinishLaunching callback')
191
206
  // run the method to discover / register your devices as accessories
192
207
  try {
193
- await this.discoverDevices()
208
+ // Does the user have a version of Homebridge that is compatible with matter?
209
+ if (!this.api.isMatterAvailable?.()) {
210
+ this.log.debug(`Matter is not available in this version of Homebridge. Please update Homebridge to use this plugin, ${this.api.isMatterAvailable?.() ? '' : ' (Matter is not available in this version of Homebridge)'}`)
211
+ }
212
+ if (!this.api.isMatterEnabled?.()) {
213
+ this.log.debug(`Matter is not enabled in Homebridge. Please enable Matter in the Homebridge settings to use this plugin, ${this.api.isMatterEnabled?.() ? '' : ' (Matter is not enabled in Homebridge)'}`)
214
+ }
215
+ if (!this.api.isMatterAvailable?.() && !this.api.isMatterEnabled?.()) {
216
+ await this.discoverDevices()
217
+ } else {
218
+ this.log.info('Matter is enabled in Homebridge. SwitchBot Matter devices will be handled by the Matter platform.')
219
+ }
194
220
  } catch (e: any) {
195
221
  this.errorLog(`Failed to Discover, Error Message: ${e.message ?? e}, Submit Bugs Here: ` + 'https://tinyurl.com/SwitchBotBug')
196
222
  this.debugErrorLog(`Failed to Discover, Error: ${e.message ?? e}`)