@switchbot/homebridge-switchbot 5.0.0-beta.12 → 5.0.0-beta.13
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/dist/baseMatterAccessory.test.d.ts +2 -0
- package/dist/baseMatterAccessory.test.d.ts.map +1 -0
- package/dist/baseMatterAccessory.test.js +71 -0
- package/dist/baseMatterAccessory.test.js.map +1 -0
- package/dist/devices-matter/BaseMatterAccessory.d.ts +15 -0
- package/dist/devices-matter/BaseMatterAccessory.d.ts.map +1 -1
- package/dist/devices-matter/BaseMatterAccessory.js +120 -0
- package/dist/devices-matter/BaseMatterAccessory.js.map +1 -1
- package/dist/devices-matter/ColorLightAccessory.d.ts.map +1 -1
- package/dist/devices-matter/ColorLightAccessory.js +12 -12
- package/dist/devices-matter/ColorLightAccessory.js.map +1 -1
- package/dist/devices-matter/ColorTemperatureLightAccessory.d.ts.map +1 -1
- package/dist/devices-matter/ColorTemperatureLightAccessory.js +5 -7
- package/dist/devices-matter/ColorTemperatureLightAccessory.js.map +1 -1
- package/dist/devices-matter/DimmableLightAccessory.js +9 -9
- package/dist/devices-matter/DimmableLightAccessory.js.map +1 -1
- package/dist/devices-matter/ExtendedColorLightAccessory.d.ts.map +1 -1
- package/dist/devices-matter/ExtendedColorLightAccessory.js +14 -15
- package/dist/devices-matter/ExtendedColorLightAccessory.js.map +1 -1
- package/dist/devices-matter/OnOffLightAccessory.d.ts.map +1 -1
- package/dist/devices-matter/OnOffLightAccessory.js +8 -16
- package/dist/devices-matter/OnOffLightAccessory.js.map +1 -1
- package/dist/devices-matter/OnOffOutletAccessory.d.ts +2 -0
- package/dist/devices-matter/OnOffOutletAccessory.d.ts.map +1 -1
- package/dist/devices-matter/OnOffOutletAccessory.js +10 -7
- package/dist/devices-matter/OnOffOutletAccessory.js.map +1 -1
- package/dist/devices-matter/OnOffSwitchAccessory.js +2 -2
- package/dist/devices-matter/OnOffSwitchAccessory.js.map +1 -1
- package/dist/platform-matter.d.ts.map +1 -1
- package/dist/platform-matter.js +37 -22
- package/dist/platform-matter.js.map +1 -1
- package/docs/variables/default.html +1 -1
- package/package.json +1 -1
- package/src/baseMatterAccessory.test.ts +88 -0
- package/src/devices-matter/BaseMatterAccessory.ts +118 -0
- package/src/devices-matter/ColorLightAccessory.ts +12 -12
- package/src/devices-matter/ColorTemperatureLightAccessory.ts +5 -7
- package/src/devices-matter/DimmableLightAccessory.ts +9 -9
- package/src/devices-matter/ExtendedColorLightAccessory.ts +14 -15
- package/src/devices-matter/OnOffLightAccessory.ts +8 -16
- package/src/devices-matter/OnOffOutletAccessory.ts +12 -7
- package/src/devices-matter/OnOffSwitchAccessory.ts +2 -2
- package/src/platform-matter.ts +36 -22
package/src/platform-matter.ts
CHANGED
|
@@ -250,7 +250,12 @@ export class SwitchBotMatterPlatform implements DynamicPlatformPlugin {
|
|
|
250
250
|
firmwareRevision: String(firmware),
|
|
251
251
|
hardwareRevision: '1.0.0',
|
|
252
252
|
deviceId: dev.deviceId,
|
|
253
|
-
|
|
253
|
+
// Inject handy platform-side helpers into the accessory `context` so Matter
|
|
254
|
+
// accessory classes can perform OpenAPI/BLE actions without reaching into
|
|
255
|
+
// the platform implementation directly.
|
|
256
|
+
context: {
|
|
257
|
+
deviceId: dev.deviceId,
|
|
258
|
+
},
|
|
254
259
|
}
|
|
255
260
|
|
|
256
261
|
// Small helper to wrap common OpenAPI on/off commands
|
|
@@ -494,6 +499,15 @@ export class SwitchBotMatterPlatform implements DynamicPlatformPlugin {
|
|
|
494
499
|
}
|
|
495
500
|
}
|
|
496
501
|
|
|
502
|
+
// Expose platform helpers to the accessory via context so accessory
|
|
503
|
+
// classes can call OpenAPI/BLE actions (sendOpenAPI/sendBLE) and know
|
|
504
|
+
// the effective connection type.
|
|
505
|
+
try {
|
|
506
|
+
;(baseOpts as any).context = Object.assign({}, (baseOpts as any).context, { sendOpenAPI, sendBLE, connectionType })
|
|
507
|
+
} catch (e: any) {
|
|
508
|
+
this.log.debug('Failed to attach platform helpers to baseOpts.context: %s', e?.message ?? e)
|
|
509
|
+
}
|
|
510
|
+
|
|
497
511
|
const opts = Object.assign({}, baseOpts, { handlers })
|
|
498
512
|
|
|
499
513
|
// Instantiate the device class and return its serialized accessory
|
|
@@ -732,9 +746,9 @@ export class SwitchBotMatterPlatform implements DynamicPlatformPlugin {
|
|
|
732
746
|
* Register all Matter accessories
|
|
733
747
|
*/
|
|
734
748
|
private async registerMatterAccessories() {
|
|
735
|
-
this.log.
|
|
749
|
+
this.log.debug('═'.repeat(80))
|
|
736
750
|
this.log.info('Homebridge Matter Plugin')
|
|
737
|
-
this.log.
|
|
751
|
+
this.log.debug('═'.repeat(80))
|
|
738
752
|
|
|
739
753
|
// Remove accessories that are disabled in config
|
|
740
754
|
await this.removeDisabledAccessories()
|
|
@@ -778,9 +792,9 @@ export class SwitchBotMatterPlatform implements DynamicPlatformPlugin {
|
|
|
778
792
|
await this.registerSection12Robotic()
|
|
779
793
|
await this.registerCustomDevices()
|
|
780
794
|
|
|
781
|
-
this.log.
|
|
782
|
-
this.log.
|
|
783
|
-
this.log.
|
|
795
|
+
this.log.debug('═'.repeat(80))
|
|
796
|
+
this.log.debug('Finished registering Matter accessories')
|
|
797
|
+
this.log.debug('═'.repeat(80))
|
|
784
798
|
}
|
|
785
799
|
|
|
786
800
|
/**
|
|
@@ -827,9 +841,9 @@ export class SwitchBotMatterPlatform implements DynamicPlatformPlugin {
|
|
|
827
841
|
* Section 4: Lighting Devices (Matter Spec § 4)
|
|
828
842
|
*/
|
|
829
843
|
private async registerSection4Lighting() {
|
|
830
|
-
this.log.
|
|
844
|
+
this.log.debug('═'.repeat(80))
|
|
831
845
|
this.log.info('Section 4: Lighting Devices (Matter Spec § 4)')
|
|
832
|
-
this.log.
|
|
846
|
+
this.log.debug('═'.repeat(80))
|
|
833
847
|
|
|
834
848
|
const accessories: Array<MatterAccessory<Record<string, unknown>>> = []
|
|
835
849
|
|
|
@@ -876,9 +890,9 @@ export class SwitchBotMatterPlatform implements DynamicPlatformPlugin {
|
|
|
876
890
|
* Section 5: Smart Plugs/Actuators (Matter Spec § 5)
|
|
877
891
|
*/
|
|
878
892
|
private async registerSection5SmartPlugs() {
|
|
879
|
-
this.log.
|
|
893
|
+
this.log.debug('═'.repeat(80))
|
|
880
894
|
this.log.info('Section 5: Smart Plugs/Actuators (Matter Spec § 5)')
|
|
881
|
-
this.log.
|
|
895
|
+
this.log.debug('═'.repeat(80))
|
|
882
896
|
|
|
883
897
|
const accessories: Array<MatterAccessory<Record<string, unknown>>> = []
|
|
884
898
|
|
|
@@ -901,9 +915,9 @@ export class SwitchBotMatterPlatform implements DynamicPlatformPlugin {
|
|
|
901
915
|
* Section 6: Switches & Controllers (Matter Spec § 6)
|
|
902
916
|
*/
|
|
903
917
|
private async registerSection6Switches() {
|
|
904
|
-
this.log.
|
|
918
|
+
this.log.debug('═'.repeat(80))
|
|
905
919
|
this.log.info('Section 6: Switches & Controllers (Matter Spec § 6)')
|
|
906
|
-
this.log.
|
|
920
|
+
this.log.debug('═'.repeat(80))
|
|
907
921
|
|
|
908
922
|
const accessories: Array<MatterAccessory<Record<string, unknown>>> = []
|
|
909
923
|
|
|
@@ -926,9 +940,9 @@ export class SwitchBotMatterPlatform implements DynamicPlatformPlugin {
|
|
|
926
940
|
* Section 7: Sensors (Matter Spec § 7)
|
|
927
941
|
*/
|
|
928
942
|
private async registerSection7Sensors() {
|
|
929
|
-
this.log.
|
|
943
|
+
this.log.debug('═'.repeat(80))
|
|
930
944
|
this.log.info('Section 7: Sensors (Matter Spec § 7)')
|
|
931
|
-
this.log.
|
|
945
|
+
this.log.debug('═'.repeat(80))
|
|
932
946
|
|
|
933
947
|
const accessories: Array<MatterAccessory<Record<string, unknown>>> = []
|
|
934
948
|
|
|
@@ -987,9 +1001,9 @@ export class SwitchBotMatterPlatform implements DynamicPlatformPlugin {
|
|
|
987
1001
|
* Section 8: Closure Devices (Matter Spec § 8)
|
|
988
1002
|
*/
|
|
989
1003
|
private async registerSection8Closure() {
|
|
990
|
-
this.log.
|
|
1004
|
+
this.log.debug('═'.repeat(80))
|
|
991
1005
|
this.log.info('Section 8: Closure Devices (Matter Spec § 8)')
|
|
992
|
-
this.log.
|
|
1006
|
+
this.log.debug('═'.repeat(80))
|
|
993
1007
|
|
|
994
1008
|
const accessories: Array<MatterAccessory<Record<string, unknown>>> = []
|
|
995
1009
|
|
|
@@ -1024,9 +1038,9 @@ export class SwitchBotMatterPlatform implements DynamicPlatformPlugin {
|
|
|
1024
1038
|
* Section 9: HVAC (Matter Spec § 9)
|
|
1025
1039
|
*/
|
|
1026
1040
|
private async registerSection9HVAC() {
|
|
1027
|
-
this.log.
|
|
1041
|
+
this.log.debug('═'.repeat(80))
|
|
1028
1042
|
this.log.info('Section 9: HVAC (Matter Spec § 9)')
|
|
1029
|
-
this.log.
|
|
1043
|
+
this.log.debug('═'.repeat(80))
|
|
1030
1044
|
|
|
1031
1045
|
const accessories: Array<MatterAccessory<Record<string, unknown>>> = []
|
|
1032
1046
|
|
|
@@ -1058,9 +1072,9 @@ export class SwitchBotMatterPlatform implements DynamicPlatformPlugin {
|
|
|
1058
1072
|
* Use those codes to pair the vacuum as a separate bridge in your Home app.
|
|
1059
1073
|
*/
|
|
1060
1074
|
private async registerSection12Robotic() {
|
|
1061
|
-
this.log.
|
|
1075
|
+
this.log.debug('═'.repeat(80))
|
|
1062
1076
|
this.log.info('Section 12: Robotic Devices (Matter Spec § 12)')
|
|
1063
|
-
this.log.
|
|
1077
|
+
this.log.debug('═'.repeat(80))
|
|
1064
1078
|
|
|
1065
1079
|
const accessories: Array<MatterAccessory<Record<string, unknown>>> = []
|
|
1066
1080
|
|
|
@@ -1087,9 +1101,9 @@ export class SwitchBotMatterPlatform implements DynamicPlatformPlugin {
|
|
|
1087
1101
|
* like managing multiple logical components within a single device.
|
|
1088
1102
|
*/
|
|
1089
1103
|
private async registerCustomDevices() {
|
|
1090
|
-
this.log.
|
|
1104
|
+
this.log.debug('═'.repeat(80))
|
|
1091
1105
|
this.log.info('Custom Devices')
|
|
1092
|
-
this.log.
|
|
1106
|
+
this.log.debug('═'.repeat(80))
|
|
1093
1107
|
|
|
1094
1108
|
const accessories: Array<MatterAccessory<Record<string, unknown>>> = []
|
|
1095
1109
|
|