@switchbot/homebridge-switchbot 3.5.0-beta.3 → 3.5.0-beta.31

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 (166) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/config.schema.json +147 -9
  3. package/dist/device/blindtilt.d.ts +21 -94
  4. package/dist/device/blindtilt.d.ts.map +1 -1
  5. package/dist/device/blindtilt.js +347 -756
  6. package/dist/device/blindtilt.js.map +1 -1
  7. package/dist/device/bot.d.ts +25 -71
  8. package/dist/device/bot.d.ts.map +1 -1
  9. package/dist/device/bot.js +582 -759
  10. package/dist/device/bot.js.map +1 -1
  11. package/dist/device/ceilinglight.d.ts +13 -67
  12. package/dist/device/ceilinglight.d.ts.map +1 -1
  13. package/dist/device/ceilinglight.js +209 -587
  14. package/dist/device/ceilinglight.js.map +1 -1
  15. package/dist/device/colorbulb.d.ts +13 -74
  16. package/dist/device/colorbulb.d.ts.map +1 -1
  17. package/dist/device/colorbulb.js +250 -632
  18. package/dist/device/colorbulb.js.map +1 -1
  19. package/dist/device/contact.d.ts +14 -65
  20. package/dist/device/contact.d.ts.map +1 -1
  21. package/dist/device/contact.js +204 -531
  22. package/dist/device/contact.js.map +1 -1
  23. package/dist/device/curtain.d.ts +17 -86
  24. package/dist/device/curtain.d.ts.map +1 -1
  25. package/dist/device/curtain.js +335 -786
  26. package/dist/device/curtain.js.map +1 -1
  27. package/dist/device/device.d.ts +59 -0
  28. package/dist/device/device.d.ts.map +1 -0
  29. package/dist/device/device.js +654 -0
  30. package/dist/device/device.js.map +1 -0
  31. package/dist/device/fan.d.ts +51 -0
  32. package/dist/device/fan.d.ts.map +1 -0
  33. package/dist/device/fan.js +499 -0
  34. package/dist/device/fan.js.map +1 -0
  35. package/dist/device/hub.d.ts +15 -59
  36. package/dist/device/hub.d.ts.map +1 -1
  37. package/dist/device/hub.js +242 -596
  38. package/dist/device/hub.js.map +1 -1
  39. package/dist/device/humidifier.d.ts +10 -65
  40. package/dist/device/humidifier.d.ts.map +1 -1
  41. package/dist/device/humidifier.js +207 -571
  42. package/dist/device/humidifier.js.map +1 -1
  43. package/dist/device/iosensor.d.ts +11 -64
  44. package/dist/device/iosensor.d.ts.map +1 -1
  45. package/dist/device/iosensor.js +174 -584
  46. package/dist/device/iosensor.js.map +1 -1
  47. package/dist/device/lightstrip.d.ts +10 -68
  48. package/dist/device/lightstrip.d.ts.map +1 -1
  49. package/dist/device/lightstrip.js +252 -568
  50. package/dist/device/lightstrip.js.map +1 -1
  51. package/dist/device/lock.d.ts +15 -62
  52. package/dist/device/lock.d.ts.map +1 -1
  53. package/dist/device/lock.js +210 -542
  54. package/dist/device/lock.js.map +1 -1
  55. package/dist/device/meter.d.ts +13 -63
  56. package/dist/device/meter.d.ts.map +1 -1
  57. package/dist/device/meter.js +170 -577
  58. package/dist/device/meter.js.map +1 -1
  59. package/dist/device/meterplus.d.ts +13 -64
  60. package/dist/device/meterplus.d.ts.map +1 -1
  61. package/dist/device/meterplus.js +159 -577
  62. package/dist/device/meterplus.js.map +1 -1
  63. package/dist/device/motion.d.ts +13 -69
  64. package/dist/device/motion.d.ts.map +1 -1
  65. package/dist/device/motion.js +136 -518
  66. package/dist/device/motion.js.map +1 -1
  67. package/dist/device/plug.d.ts +9 -57
  68. package/dist/device/plug.d.ts.map +1 -1
  69. package/dist/device/plug.js +82 -452
  70. package/dist/device/plug.js.map +1 -1
  71. package/dist/device/robotvacuumcleaner.d.ts +11 -62
  72. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  73. package/dist/device/robotvacuumcleaner.js +140 -451
  74. package/dist/device/robotvacuumcleaner.js.map +1 -1
  75. package/dist/device/waterdetector.d.ts +9 -70
  76. package/dist/device/waterdetector.d.ts.map +1 -1
  77. package/dist/device/waterdetector.js +121 -664
  78. package/dist/device/waterdetector.js.map +1 -1
  79. package/dist/index.js +1 -1
  80. package/dist/irdevice/airconditioner.d.ts +8 -48
  81. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  82. package/dist/irdevice/airconditioner.js +309 -419
  83. package/dist/irdevice/airconditioner.js.map +1 -1
  84. package/dist/irdevice/airpurifier.d.ts +7 -38
  85. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  86. package/dist/irdevice/airpurifier.js +72 -304
  87. package/dist/irdevice/airpurifier.js.map +1 -1
  88. package/dist/irdevice/camera.d.ts +6 -35
  89. package/dist/irdevice/camera.d.ts.map +1 -1
  90. package/dist/irdevice/camera.js +34 -278
  91. package/dist/irdevice/camera.js.map +1 -1
  92. package/dist/irdevice/fan.d.ts +6 -39
  93. package/dist/irdevice/fan.d.ts.map +1 -1
  94. package/dist/irdevice/fan.js +67 -311
  95. package/dist/irdevice/fan.js.map +1 -1
  96. package/dist/irdevice/irdevice.d.ts +40 -0
  97. package/dist/irdevice/irdevice.d.ts.map +1 -0
  98. package/dist/irdevice/irdevice.js +509 -0
  99. package/dist/irdevice/irdevice.js.map +1 -0
  100. package/dist/irdevice/light.d.ts +6 -34
  101. package/dist/irdevice/light.d.ts.map +1 -1
  102. package/dist/irdevice/light.js +23 -272
  103. package/dist/irdevice/light.js.map +1 -1
  104. package/dist/irdevice/other.d.ts +18 -47
  105. package/dist/irdevice/other.d.ts.map +1 -1
  106. package/dist/irdevice/other.js +352 -546
  107. package/dist/irdevice/other.js.map +1 -1
  108. package/dist/irdevice/tv.d.ts +7 -39
  109. package/dist/irdevice/tv.d.ts.map +1 -1
  110. package/dist/irdevice/tv.js +82 -321
  111. package/dist/irdevice/tv.js.map +1 -1
  112. package/dist/irdevice/vacuumcleaner.d.ts +6 -35
  113. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  114. package/dist/irdevice/vacuumcleaner.js +41 -284
  115. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  116. package/dist/irdevice/waterheater.d.ts +6 -35
  117. package/dist/irdevice/waterheater.d.ts.map +1 -1
  118. package/dist/irdevice/waterheater.js +42 -287
  119. package/dist/irdevice/waterheater.js.map +1 -1
  120. package/dist/platform.d.ts +14 -1
  121. package/dist/platform.d.ts.map +1 -1
  122. package/dist/platform.js +237 -94
  123. package/dist/platform.js.map +1 -1
  124. package/dist/settings.d.ts +40 -10
  125. package/dist/settings.d.ts.map +1 -1
  126. package/dist/settings.js +0 -552
  127. package/dist/settings.js.map +1 -1
  128. package/dist/utils.d.ts +77 -0
  129. package/dist/utils.d.ts.map +1 -1
  130. package/dist/utils.js +638 -1
  131. package/dist/utils.js.map +1 -1
  132. package/package.json +16 -15
  133. package/src/custom.d.ts +2 -1
  134. package/src/device/blindtilt.ts +373 -782
  135. package/src/device/bot.ts +616 -844
  136. package/src/device/ceilinglight.ts +222 -607
  137. package/src/device/colorbulb.ts +264 -656
  138. package/src/device/contact.ts +229 -553
  139. package/src/device/curtain.ts +355 -810
  140. package/src/device/device.ts +681 -0
  141. package/src/device/fan.ts +548 -0
  142. package/src/device/hub.ts +268 -623
  143. package/src/device/humidifier.ts +237 -618
  144. package/src/device/iosensor.ts +200 -610
  145. package/src/device/lightstrip.ts +273 -596
  146. package/src/device/lock.ts +247 -582
  147. package/src/device/meter.ts +196 -601
  148. package/src/device/meterplus.ts +184 -602
  149. package/src/device/motion.ts +156 -541
  150. package/src/device/plug.ts +92 -480
  151. package/src/device/robotvacuumcleaner.ts +161 -477
  152. package/src/device/waterdetector.ts +139 -689
  153. package/src/index.ts +1 -1
  154. package/src/irdevice/airconditioner.ts +330 -446
  155. package/src/irdevice/airpurifier.ts +89 -321
  156. package/src/irdevice/camera.ts +42 -293
  157. package/src/irdevice/fan.ts +78 -327
  158. package/src/irdevice/irdevice.ts +526 -0
  159. package/src/irdevice/light.ts +32 -287
  160. package/src/irdevice/other.ts +396 -615
  161. package/src/irdevice/tv.ts +100 -339
  162. package/src/irdevice/vacuumcleaner.ts +49 -305
  163. package/src/irdevice/waterheater.ts +50 -310
  164. package/src/platform.ts +247 -102
  165. package/src/settings.ts +56 -565
  166. package/src/utils.ts +642 -1
@@ -0,0 +1 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CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;YAC3C,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;IACH,CAAC;IAED,qBAAqB;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,aAAa,KAAK,UAAU,CAAC;IACnF,CAAC;CACF"}
@@ -0,0 +1,51 @@
1
+ import { deviceBase } from './device.js';
2
+ import { SwitchBotPlatform } from '../platform.js';
3
+ import { Subject } from 'rxjs';
4
+ import { CharacteristicValue, PlatformAccessory } from 'homebridge';
5
+ import { device, devicesConfig, serviceData, deviceStatus } from '../settings.js';
6
+ export declare class Fan extends deviceBase {
7
+ readonly platform: SwitchBotPlatform;
8
+ private Fan;
9
+ private Battery;
10
+ plugUpdateInProgress: boolean;
11
+ doPlugUpdate: Subject<void>;
12
+ constructor(platform: SwitchBotPlatform, accessory: PlatformAccessory, device: device & devicesConfig);
13
+ BLEparseStatus(serviceData: serviceData): Promise<void>;
14
+ openAPIparseStatus(deviceStatus: deviceStatus): Promise<void>;
15
+ /**
16
+ * Asks the SwitchBot API for the latest device information
17
+ */
18
+ refreshStatus(): Promise<void>;
19
+ BLERefreshStatus(): Promise<void>;
20
+ openAPIRefreshStatus(): Promise<void>;
21
+ /**
22
+ * Pushes the requested changes to the SwitchBot API
23
+ * deviceType commandType Command command parameter Description
24
+ * Battery Circulator Fan - "command" "turnOff" "default" = set to OFF state
25
+ * Battery Circulator Fan - "command" "turnOn" "default" = set to ON state
26
+ * Battery Circulator Fan - "command" "setNightLightMode" "off, 1, or 2" = off, turn off nightlight, (1, bright) (2, dim)
27
+ * Battery Circulator Fan - "command" "setWindMode" "direct, natural, sleep, or baby" = Set fan mode. direct: direct mode. natural: natural mode. sleep: sleep mode. baby: ultra quiet mode
28
+ * Battery Circulator Fan - "command" "setWindSpeed" "{1-100} e.g. 10" = Set fan speed.1~100
29
+ */
30
+ pushChanges(): Promise<void>;
31
+ BLEpushChanges(): Promise<void>;
32
+ openAPIpushChanges(): Promise<void>;
33
+ /**
34
+ * Handle requests to set the value of the "On" characteristic
35
+ */
36
+ ActiveSet(value: CharacteristicValue): Promise<void>;
37
+ /**
38
+ * Handle requests to set the value of the "On" characteristic
39
+ */
40
+ RotationSpeedSet(value: CharacteristicValue): Promise<void>;
41
+ /**
42
+ * Handle requests to set the value of the "On" characteristic
43
+ */
44
+ SwingModeSet(value: CharacteristicValue): Promise<void>;
45
+ updateHomeKitCharacteristics(): Promise<void>;
46
+ BLEPushConnection(): Promise<void>;
47
+ BLERefreshConnection(switchbot: any): Promise<void>;
48
+ offlineOff(): Promise<void>;
49
+ apiError(e: any): Promise<void>;
50
+ }
51
+ //# sourceMappingURL=fan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fan.d.ts","sourceRoot":"","sources":["../../src/device/fan.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAgD,MAAM,MAAM,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAW,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAW,MAAM,gBAAgB,CAAC;AAE3F,qBAAa,GAAI,SAAQ,UAAU;IAqB/B,QAAQ,CAAC,QAAQ,EAAE,iBAAiB;IAnBtC,OAAO,CAAC,GAAG,CAKT;IAEF,OAAO,CAAC,OAAO,CAKb;IAGF,oBAAoB,EAAG,OAAO,CAAC;IAC/B,YAAY,EAAG,OAAO,CAAC,IAAI,CAAC,CAAC;gBAGlB,QAAQ,EAAE,iBAAiB,EACpC,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EAAE,MAAM,GAAG,aAAa;IA2H1B,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAcvD,kBAAkB,CAAC,YAAY,EAAE,YAAY;IA0CnD;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB9B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAqCjC,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IA2B3C;;;;;;;;OAQG;IAEG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAsB5B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAkD/B,kBAAkB;IA8CxB;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAW1D;;OAEG;IACG,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAWjE;;OAEG;IACG,YAAY,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAWvD,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC;IAmD7C,iBAAiB;IAOjB,oBAAoB,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IASnD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ3B,QAAQ,CAAC,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAKtC"}
@@ -0,0 +1,499 @@
1
+ /* eslint-disable max-len */
2
+ /* Copyright(C) 2021-2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
3
+ *
4
+ * plug.ts: @switchbot/homebridge-switchbot.
5
+ */
6
+ import { request } from 'undici';
7
+ import { deviceBase } from './device.js';
8
+ import { Subject, debounceTime, interval, skipWhile, take, tap } from 'rxjs';
9
+ import { Devices } from '../settings.js';
10
+ export class Fan extends deviceBase {
11
+ platform;
12
+ // Services
13
+ Fan;
14
+ Battery;
15
+ // Updates
16
+ plugUpdateInProgress;
17
+ doPlugUpdate;
18
+ constructor(platform, accessory, device) {
19
+ super(platform, accessory, device);
20
+ this.platform = platform;
21
+ // this is subject we use to track when we need to POST changes to the SwitchBot API
22
+ this.doPlugUpdate = new Subject();
23
+ this.plugUpdateInProgress = false;
24
+ // Initialize Fan property
25
+ this.Fan = {
26
+ Service: accessory.getService(this.hap.Service.Fanv2),
27
+ Active: accessory.context.Active || this.hap.Characteristic.Active.INACTIVE,
28
+ SwingMode: accessory.context.SwingMode || this.hap.Characteristic.SwingMode.SWING_DISABLED,
29
+ RotationSpeed: accessory.context.RotationSpeed || 0,
30
+ };
31
+ // Initialize Battery property
32
+ this.Battery = {
33
+ Service: accessory.getService(this.hap.Service.Battery),
34
+ BatteryLevel: accessory.context.BatteryLevel || 100,
35
+ StatusLowBattery: accessory.context.StatusLowBattery || this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
36
+ ChargingState: accessory.context.ChargingState || this.hap.Characteristic.ChargingState.NOT_CHARGING,
37
+ };
38
+ // Retrieve initial values and updateHomekit
39
+ this.refreshStatus();
40
+ // get the Fan service if it exists, otherwise create a new Fanv2 service
41
+ // you can create multiple services for each accessory
42
+ const FanService = `${accessory.displayName} ${device.deviceType}`;
43
+ (this.Fan.Service = accessory.getService(this.hap.Service.Fanv2)
44
+ || accessory.addService(this.hap.Service.Fanv2)), FanService;
45
+ this.Fan.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
46
+ // each service must implement at-minimum the "required characteristics" for the given service type
47
+ // see https://developers.homebridge.io/#/service/Fanv2
48
+ // create handlers for required characteristics
49
+ this.Fan.Service.getCharacteristic(this.hap.Characteristic.Active).onSet(this.ActiveSet.bind(this));
50
+ // create handlers for required characteristics
51
+ this.Fan.Service.getCharacteristic(this.hap.Characteristic.RotationSpeed).onSet(this.RotationSpeedSet.bind(this));
52
+ // create handlers for required characteristics
53
+ this.Fan.Service.getCharacteristic(this.hap.Characteristic.SwingMode).onSet(this.SwingModeSet.bind(this));
54
+ // Update Homekit
55
+ this.updateHomeKitCharacteristics();
56
+ // Start an update interval
57
+ interval(this.deviceRefreshRate * 1000)
58
+ .pipe(skipWhile(() => this.plugUpdateInProgress))
59
+ .subscribe(async () => {
60
+ await this.refreshStatus();
61
+ });
62
+ //regisiter webhook event handler
63
+ if (device.webhook) {
64
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} is listening webhook.`);
65
+ this.platform.webhookEventHandler[this.device.deviceId] = async (context) => {
66
+ try {
67
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} received Webhook: ${JSON.stringify(context)}`);
68
+ const { version, battery, powerState, oscillation, chargingStatus, fanSpeed } = context;
69
+ const { Active, SwingMode, RotationSpeed } = this.Fan;
70
+ const { BatteryLevel, ChargingState } = this.Battery;
71
+ const { FirmwareRevision } = this.accessory.context;
72
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ` +
73
+ '(version, battery, powerState, oscillation, chargingStatus, fanSpeed) = '
74
+ + `Webhook:(${version}, ${battery}, ${powerState}, ${oscillation}, ${chargingStatus}, ${fanSpeed}), `
75
+ + `current:(${FirmwareRevision}, ${BatteryLevel}, ${Active}, ${SwingMode}, ${ChargingState}, ${RotationSpeed})`);
76
+ // Active
77
+ this.Fan.Active = powerState === 'ON' ? this.hap.Characteristic.Active.ACTIVE : this.hap.Characteristic.Active.INACTIVE;
78
+ // SwingMode
79
+ this.Fan.SwingMode = oscillation === 'on' ?
80
+ this.hap.Characteristic.SwingMode.SWING_ENABLED : this.hap.Characteristic.SwingMode.SWING_DISABLED;
81
+ // RotationSpeed
82
+ this.Fan.RotationSpeed = fanSpeed;
83
+ // ChargingState
84
+ this.Battery.ChargingState = chargingStatus === 'charging' ?
85
+ this.hap.Characteristic.ChargingState.CHARGING : this.hap.Characteristic.ChargingState.NOT_CHARGING;
86
+ // BatteryLevel
87
+ this.Battery.BatteryLevel = battery;
88
+ // FirmwareRevision
89
+ this.accessory.context.FirmwareRevision = version;
90
+ this.accessory
91
+ .getService(this.hap.Service.AccessoryInformation)
92
+ .setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.FirmwareRevision)
93
+ .getCharacteristic(this.hap.Characteristic.FirmwareRevision)
94
+ .updateValue(this.accessory.context.FirmwareRevision);
95
+ this.updateHomeKitCharacteristics();
96
+ }
97
+ catch (e) {
98
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
99
+ + `failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e}`);
100
+ }
101
+ };
102
+ }
103
+ // Watch for Plug change events
104
+ // We put in a debounce of 100ms so we don't make duplicate calls
105
+ this.doPlugUpdate
106
+ .pipe(tap(() => {
107
+ this.plugUpdateInProgress = true;
108
+ }), debounceTime(this.platform.config.options.pushRate * 1000))
109
+ .subscribe(async () => {
110
+ try {
111
+ await this.pushChanges();
112
+ }
113
+ catch (e) {
114
+ this.apiError(e);
115
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with ${this.device.connectionType} Connection,` +
116
+ ` Error Message: ${JSON.stringify(e.message)}`);
117
+ }
118
+ this.plugUpdateInProgress = false;
119
+ });
120
+ }
121
+ async BLEparseStatus(serviceData) {
122
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLEparseStatus`);
123
+ // State
124
+ switch (serviceData.state) {
125
+ case 'on':
126
+ this.Fan.Active = true;
127
+ break;
128
+ default:
129
+ this.Fan.Active = false;
130
+ }
131
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.Fan.Active}`);
132
+ }
133
+ async openAPIparseStatus(deviceStatus) {
134
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIparseStatus`);
135
+ // Active
136
+ this.Fan.Active = deviceStatus.body.power === 'on' ? this.hap.Characteristic.Active.ACTIVE : this.hap.Characteristic.Active.INACTIVE;
137
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Active: ${this.Fan.Active}`);
138
+ // SwingMode
139
+ this.Fan.SwingMode = deviceStatus.body.oscillation === 'on' ?
140
+ this.hap.Characteristic.SwingMode.SWING_ENABLED : this.hap.Characteristic.SwingMode.SWING_DISABLED;
141
+ // RotationSpeed
142
+ this.Fan.RotationSpeed = deviceStatus.body.fanSpeed;
143
+ // ChargingState
144
+ this.Battery.ChargingState = deviceStatus.body.chargingStatus === 'charging' ?
145
+ this.hap.Characteristic.ChargingState.CHARGING : this.hap.Characteristic.ChargingState.NOT_CHARGING;
146
+ // BatteryLevel
147
+ this.Battery.BatteryLevel = Number(deviceStatus.body.battery);
148
+ if (this.Battery.BatteryLevel < 10) {
149
+ this.Battery.StatusLowBattery = this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
150
+ }
151
+ else {
152
+ this.Battery.StatusLowBattery = this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
153
+ }
154
+ if (Number.isNaN(this.Battery.BatteryLevel)) {
155
+ this.Battery.BatteryLevel = 100;
156
+ }
157
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.Battery.BatteryLevel},`
158
+ + ` StatusLowBattery: ${this.Battery.StatusLowBattery}`);
159
+ // FirmwareRevision
160
+ this.accessory.context.FirmwareRevision = deviceStatus.body.version;
161
+ this.accessory
162
+ .getService(this.hap.Service.AccessoryInformation)
163
+ .setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.FirmwareRevision)
164
+ .getCharacteristic(this.hap.Characteristic.FirmwareRevision)
165
+ .updateValue(this.accessory.context.FirmwareRevision);
166
+ }
167
+ /**
168
+ * Asks the SwitchBot API for the latest device information
169
+ */
170
+ async refreshStatus() {
171
+ if (!this.device.enableCloudService && this.OpenAPI) {
172
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus enableCloudService: ${this.device.enableCloudService}`);
173
+ }
174
+ else if (this.BLE) {
175
+ await this.BLERefreshStatus();
176
+ }
177
+ else if (this.OpenAPI && this.platform.config.credentials?.token) {
178
+ await this.openAPIRefreshStatus();
179
+ }
180
+ else {
181
+ await this.offlineOff();
182
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:` +
183
+ ` ${this.device.connectionType}, refreshStatus will not happen.`);
184
+ }
185
+ }
186
+ async BLERefreshStatus() {
187
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLERefreshStatus`);
188
+ const switchbot = await this.platform.connectBLE();
189
+ // Convert to BLE Address
190
+ this.device.bleMac = this.device
191
+ .deviceId.match(/.{1,2}/g)
192
+ .join(':')
193
+ .toLowerCase();
194
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
195
+ this.getCustomBLEAddress(switchbot);
196
+ // Start to monitor advertisement packets
197
+ (async () => {
198
+ // Start to monitor advertisement packets
199
+ await switchbot.startScan({ model: this.device.bleModel, id: this.device.bleMac });
200
+ // Set an event handler
201
+ switchbot.onadvertisement = (ad) => {
202
+ if (this.device.bleMac === ad.address && ad.model === this.device.bleModel) {
203
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ${JSON.stringify(ad, null, ' ')}`);
204
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} address: ${ad.address}, model: ${ad.model}`);
205
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
206
+ }
207
+ else {
208
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
209
+ }
210
+ };
211
+ // Wait 10 seconds
212
+ await switchbot.wait(this.scanDuration * 1000);
213
+ // Stop to monitor
214
+ await switchbot.stopScan();
215
+ // Update HomeKit
216
+ await this.BLEparseStatus(switchbot.onadvertisement.serviceData);
217
+ await this.updateHomeKitCharacteristics();
218
+ })();
219
+ if (switchbot === undefined) {
220
+ await this.BLERefreshConnection(switchbot);
221
+ }
222
+ }
223
+ async openAPIRefreshStatus() {
224
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
225
+ try {
226
+ const { body, statusCode } = await this.platform.retryRequest(this.deviceMaxRetries, this.deviceDelayBetweenRetries, `${Devices}/${this.device.deviceId}/status`, { headers: this.platform.generateHeaders() });
227
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
228
+ const deviceStatus = await body.json();
229
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
230
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
231
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
232
+ this.debugSuccessLog(`${this.device.deviceType}: ${this.accessory.displayName} `
233
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
234
+ this.openAPIparseStatus(deviceStatus);
235
+ this.updateHomeKitCharacteristics();
236
+ }
237
+ else {
238
+ this.statusCode(statusCode);
239
+ this.statusCode(deviceStatus.statusCode);
240
+ }
241
+ }
242
+ catch (e) {
243
+ this.apiError(e);
244
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed openAPIRefreshStatus with ${this.device.connectionType}` +
245
+ ` Connection, Error Message: ${JSON.stringify(e.message)}`);
246
+ }
247
+ }
248
+ /**
249
+ * Pushes the requested changes to the SwitchBot API
250
+ * deviceType commandType Command command parameter Description
251
+ * Battery Circulator Fan - "command" "turnOff" "default" = set to OFF state
252
+ * Battery Circulator Fan - "command" "turnOn" "default" = set to ON state
253
+ * Battery Circulator Fan - "command" "setNightLightMode" "off, 1, or 2" = off, turn off nightlight, (1, bright) (2, dim)
254
+ * Battery Circulator Fan - "command" "setWindMode" "direct, natural, sleep, or baby" = Set fan mode. direct: direct mode. natural: natural mode. sleep: sleep mode. baby: ultra quiet mode
255
+ * Battery Circulator Fan - "command" "setWindSpeed" "{1-100} e.g. 10" = Set fan speed.1~100
256
+ */
257
+ async pushChanges() {
258
+ if (!this.device.enableCloudService && this.OpenAPI) {
259
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} pushChanges enableCloudService: ${this.device.enableCloudService}`);
260
+ }
261
+ else if (this.BLE) {
262
+ await this.BLEpushChanges();
263
+ }
264
+ else if (this.OpenAPI && this.platform.config.credentials?.token) {
265
+ await this.openAPIpushChanges();
266
+ }
267
+ else {
268
+ await this.offlineOff();
269
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:` + ` ${this.device.connectionType}, pushChanges will not happen.`);
270
+ }
271
+ // Refresh the status from the API
272
+ interval(15000)
273
+ .pipe(skipWhile(() => this.plugUpdateInProgress))
274
+ .pipe(take(1))
275
+ .subscribe(async () => {
276
+ await this.refreshStatus();
277
+ });
278
+ }
279
+ async BLEpushChanges() {
280
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLEpushChanges`);
281
+ if (this.Fan.Active !== this.accessory.context.Active) {
282
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLEpushChanges`
283
+ + ` On: ${this.Fan.Active} OnCached: ${this.accessory.context.Active}`);
284
+ const switchbot = await this.platform.connectBLE();
285
+ // Convert to BLE Address
286
+ this.device.bleMac = this.device
287
+ .deviceId.match(/.{1,2}/g)
288
+ .join(':')
289
+ .toLowerCase();
290
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
291
+ switchbot
292
+ .discover({
293
+ model: this.device.bleModel,
294
+ id: this.device.bleMac,
295
+ })
296
+ .then(async (device_list) => {
297
+ this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.Fan.Active}`);
298
+ return await this.retryBLE({
299
+ max: await this.maxRetryBLE(),
300
+ fn: async () => {
301
+ if (this.Fan.Active) {
302
+ return await device_list[0].turnOn({ id: this.device.bleMac });
303
+ }
304
+ else {
305
+ return await device_list[0].turnOff({ id: this.device.bleMac });
306
+ }
307
+ },
308
+ });
309
+ })
310
+ .then(() => {
311
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Done.`);
312
+ this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
313
+ + `Active: ${this.Fan.Active} sent over BLE, sent successfully`);
314
+ this.Fan.Active = false;
315
+ })
316
+ .catch(async (e) => {
317
+ this.apiError(e);
318
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLEpushChanges with ${this.device.connectionType}` +
319
+ ` Connection, Error Message: ${JSON.stringify(e.message)}`);
320
+ await this.BLEPushConnection();
321
+ });
322
+ }
323
+ else {
324
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No BLEpushChanges,`
325
+ + ` Active: ${this.Fan.Active}, ActiveCached: ${this.accessory.context.Active}`);
326
+ }
327
+ }
328
+ async openAPIpushChanges() {
329
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIpushChanges`);
330
+ if (this.Fan.Active !== this.accessory.context.Active) {
331
+ let command = '';
332
+ if (this.Fan.Active) {
333
+ command = 'turnOn';
334
+ }
335
+ else {
336
+ command = 'turnOff';
337
+ }
338
+ const bodyChange = JSON.stringify({
339
+ command: `${command}`,
340
+ parameter: 'default',
341
+ commandType: 'command',
342
+ });
343
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
344
+ try {
345
+ const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
346
+ body: bodyChange,
347
+ method: 'POST',
348
+ headers: this.platform.generateHeaders(),
349
+ });
350
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
351
+ const deviceStatus = await body.json();
352
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
353
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
354
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
355
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
356
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
357
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
358
+ this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
359
+ + `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
360
+ }
361
+ else {
362
+ this.statusCode(statusCode);
363
+ this.statusCode(deviceStatus.statusCode);
364
+ }
365
+ }
366
+ catch (e) {
367
+ this.apiError(e);
368
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed openAPIpushChanges with ${this.device.connectionType}`
369
+ + ` Connection, Error Message: ${JSON.stringify(e.message)}`);
370
+ }
371
+ }
372
+ else {
373
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No openAPIpushChanges.`
374
+ + `On: ${this.Fan.Active}, ActiveCached: ${this.accessory.context.Active}`);
375
+ }
376
+ }
377
+ /**
378
+ * Handle requests to set the value of the "On" characteristic
379
+ */
380
+ async ActiveSet(value) {
381
+ if (this.Fan.Active === this.accessory.context.Active) {
382
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No Changes, Set Active: ${value}`);
383
+ }
384
+ else {
385
+ this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Set Active: ${value}`);
386
+ }
387
+ this.Fan.Active = value;
388
+ this.doPlugUpdate.next();
389
+ }
390
+ /**
391
+ * Handle requests to set the value of the "On" characteristic
392
+ */
393
+ async RotationSpeedSet(value) {
394
+ if (this.Fan.RotationSpeed === this.accessory.context.RotationSpeed) {
395
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No Changes, Set RotationSpeed: ${value}`);
396
+ }
397
+ else {
398
+ this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Set RotationSpeed: ${value}`);
399
+ }
400
+ this.Fan.RotationSpeed = value;
401
+ this.doPlugUpdate.next();
402
+ }
403
+ /**
404
+ * Handle requests to set the value of the "On" characteristic
405
+ */
406
+ async SwingModeSet(value) {
407
+ if (this.Fan.SwingMode === this.accessory.context.SwingMode) {
408
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No Changes, Set SwingMode: ${value}`);
409
+ }
410
+ else {
411
+ this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Set SwingMode: ${value}`);
412
+ }
413
+ this.Fan.SwingMode = value;
414
+ this.doPlugUpdate.next();
415
+ }
416
+ async updateHomeKitCharacteristics() {
417
+ // Active
418
+ if (this.Fan.Active === undefined) {
419
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Active: ${this.Fan.Active}`);
420
+ }
421
+ else {
422
+ this.accessory.context.Active = this.Fan.Active;
423
+ this.Fan.Service.updateCharacteristic(this.hap.Characteristic.Active, this.Fan.Active);
424
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Fan.Active}`);
425
+ }
426
+ // RotationSpeed
427
+ if (this.Fan.RotationSpeed === undefined) {
428
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} RotationSpeed: ${this.Fan.RotationSpeed}`);
429
+ }
430
+ else {
431
+ this.accessory.context.RotationSpeed = this.Fan.RotationSpeed;
432
+ this.Fan.Service.updateCharacteristic(this.hap.Characteristic.RotationSpeed, this.Fan.RotationSpeed);
433
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.Fan.RotationSpeed}`);
434
+ }
435
+ // SwingMode
436
+ if (this.Fan.SwingMode === undefined) {
437
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} SwingMode: ${this.Fan.SwingMode}`);
438
+ }
439
+ else {
440
+ this.accessory.context.SwingMode = this.Fan.SwingMode;
441
+ this.Fan.Service.updateCharacteristic(this.hap.Characteristic.SwingMode, this.Fan.SwingMode);
442
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic SwingMode: ${this.Fan.SwingMode}`);
443
+ }
444
+ // BateryLevel
445
+ if (this.Battery.BatteryLevel === undefined) {
446
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.Battery.BatteryLevel}`);
447
+ }
448
+ else {
449
+ this.accessory.context.BatteryLevel = this.Battery.BatteryLevel;
450
+ this.Battery.Service.updateCharacteristic(this.hap.Characteristic.BatteryLevel, this.Battery.BatteryLevel);
451
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic BatteryLevel: ${this.Battery.BatteryLevel}`);
452
+ }
453
+ // ChargingState
454
+ if (this.Battery.ChargingState === undefined) {
455
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ChargingState: ${this.Battery.ChargingState}`);
456
+ }
457
+ else {
458
+ this.accessory.context.ChargingState = this.Battery.ChargingState;
459
+ this.Battery.Service.updateCharacteristic(this.hap.Characteristic.ChargingState, this.Battery.ChargingState);
460
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic ChargingState: ${this.Battery.ChargingState}`);
461
+ }
462
+ // StatusLowBattery
463
+ if (this.Battery.StatusLowBattery === undefined) {
464
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} StatusLowBattery: ${this.Battery.StatusLowBattery}`);
465
+ }
466
+ else {
467
+ this.accessory.context.StatusLowBattery = this.Battery.StatusLowBattery;
468
+ this.Battery.Service.updateCharacteristic(this.hap.Characteristic.StatusLowBattery, this.Battery.StatusLowBattery);
469
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.Battery.StatusLowBattery}`);
470
+ }
471
+ }
472
+ async BLEPushConnection() {
473
+ if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
474
+ this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Push Changes`);
475
+ await this.openAPIpushChanges();
476
+ }
477
+ }
478
+ async BLERefreshConnection(switchbot) {
479
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot:`
480
+ + ` ${JSON.stringify(switchbot)}`);
481
+ if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
482
+ this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
483
+ await this.openAPIRefreshStatus();
484
+ }
485
+ }
486
+ async offlineOff() {
487
+ if (this.device.offline) {
488
+ this.Fan.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.INACTIVE);
489
+ this.Fan.Service.updateCharacteristic(this.hap.Characteristic.RotationSpeed, 0);
490
+ this.Fan.Service.updateCharacteristic(this.hap.Characteristic.SwingMode, this.hap.Characteristic.SwingMode.SWING_DISABLED);
491
+ }
492
+ }
493
+ async apiError(e) {
494
+ this.Fan.Service.updateCharacteristic(this.hap.Characteristic.Active, e);
495
+ this.Fan.Service.updateCharacteristic(this.hap.Characteristic.RotationSpeed, e);
496
+ this.Fan.Service.updateCharacteristic(this.hap.Characteristic.SwingMode, e);
497
+ }
498
+ }
499
+ //# sourceMappingURL=fan.js.map