@switchbot/homebridge-switchbot 1.6.4-beta.4 → 1.7.1-beta.1

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.
@@ -52,10 +52,15 @@ class Bot {
52
52
  // get the LightBulb service if it exists, otherwise create a new LightBulb service
53
53
  // you can create multiple services for each accessory
54
54
  if (device.bot?.deviceType === 'switch') {
55
+ this.removeFanService(accessory);
55
56
  this.removeLockService(accessory);
56
57
  this.removeDoorService(accessory);
58
+ this.removeFaucetService(accessory);
57
59
  this.removeOutletService(accessory);
60
+ this.removeWindowService(accessory);
58
61
  this.removeGarageDoorService(accessory);
62
+ this.removeWindowCoveringService(accessory);
63
+ this.removeStatefulProgrammableSwitchService(accessory);
59
64
  // Add switchService
60
65
  (this.switchService =
61
66
  accessory.getService(this.platform.Service.Switch) ||
@@ -65,10 +70,15 @@ class Bot {
65
70
  this.switchService.getCharacteristic(this.platform.Characteristic.On).onSet(this.handleOnSet.bind(this));
66
71
  }
67
72
  else if (device.bot?.deviceType === 'garagedoor') {
73
+ this.removeFanService(accessory);
68
74
  this.removeLockService(accessory);
69
75
  this.removeDoorService(accessory);
76
+ this.removeFaucetService(accessory);
70
77
  this.removeOutletService(accessory);
71
78
  this.removeSwitchService(accessory);
79
+ this.removeWindowService(accessory);
80
+ this.removeWindowCoveringService(accessory);
81
+ this.removeStatefulProgrammableSwitchService(accessory);
72
82
  // Add switchService
73
83
  (this.garageDoorService =
74
84
  accessory.getService(this.platform.Service.GarageDoorOpener) ||
@@ -79,10 +89,15 @@ class Bot {
79
89
  this.garageDoorService.setCharacteristic(this.platform.Characteristic.ObstructionDetected, false);
80
90
  }
81
91
  else if (device.bot?.deviceType === 'door') {
92
+ this.removeFanService(accessory);
82
93
  this.removeLockService(accessory);
83
94
  this.removeOutletService(accessory);
95
+ this.removeFaucetService(accessory);
84
96
  this.removeSwitchService(accessory);
97
+ this.removeWindowService(accessory);
85
98
  this.removeGarageDoorService(accessory);
99
+ this.removeWindowCoveringService(accessory);
100
+ this.removeStatefulProgrammableSwitchService(accessory);
86
101
  // Add switchService
87
102
  (this.doorService =
88
103
  accessory.getService(this.platform.Service.Door) ||
@@ -98,11 +113,66 @@ class Bot {
98
113
  }).onSet(this.handleOnSet.bind(this));
99
114
  this.doorService.setCharacteristic(this.platform.Characteristic.PositionState, this.platform.Characteristic.PositionState.STOPPED);
100
115
  }
116
+ else if (device.bot?.deviceType === 'window') {
117
+ this.removeFanService(accessory);
118
+ this.removeLockService(accessory);
119
+ this.removeDoorService(accessory);
120
+ this.removeOutletService(accessory);
121
+ this.removeFaucetService(accessory);
122
+ this.removeSwitchService(accessory);
123
+ this.removeGarageDoorService(accessory);
124
+ this.removeWindowCoveringService(accessory);
125
+ this.removeStatefulProgrammableSwitchService(accessory);
126
+ // Add switchService
127
+ (this.windowService =
128
+ accessory.getService(this.platform.Service.Window) ||
129
+ accessory.addService(this.platform.Service.Window)), `${accessory.displayName} Window`;
130
+ this.infoLog(`Bot: ${accessory.displayName} Displaying as Window`);
131
+ this.windowService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
132
+ this.windowService.getCharacteristic(this.platform.Characteristic.TargetPosition)
133
+ .setProps({
134
+ validValues: [0, 100],
135
+ minValue: 0,
136
+ maxValue: 100,
137
+ minStep: 100,
138
+ }).onSet(this.handleOnSet.bind(this));
139
+ this.windowService.setCharacteristic(this.platform.Characteristic.PositionState, this.platform.Characteristic.PositionState.STOPPED);
140
+ }
141
+ else if (device.bot?.deviceType === 'windowcovering') {
142
+ this.removeFanService(accessory);
143
+ this.removeLockService(accessory);
144
+ this.removeDoorService(accessory);
145
+ this.removeOutletService(accessory);
146
+ this.removeFaucetService(accessory);
147
+ this.removeSwitchService(accessory);
148
+ this.removeWindowService(accessory);
149
+ this.removeGarageDoorService(accessory);
150
+ this.removeStatefulProgrammableSwitchService(accessory);
151
+ // Add switchService
152
+ (this.windowCoveringService =
153
+ accessory.getService(this.platform.Service.WindowCovering) ||
154
+ accessory.addService(this.platform.Service.WindowCovering)), `${accessory.displayName} Window Covering`;
155
+ this.infoLog(`Bot: ${accessory.displayName} Displaying as Window Covering`);
156
+ this.windowCoveringService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
157
+ this.windowCoveringService.getCharacteristic(this.platform.Characteristic.TargetPosition)
158
+ .setProps({
159
+ validValues: [0, 100],
160
+ minValue: 0,
161
+ maxValue: 100,
162
+ minStep: 100,
163
+ }).onSet(this.handleOnSet.bind(this));
164
+ this.windowCoveringService.setCharacteristic(this.platform.Characteristic.PositionState, this.platform.Characteristic.PositionState.STOPPED);
165
+ }
101
166
  else if (device.bot?.deviceType === 'lock') {
167
+ this.removeFanService(accessory);
102
168
  this.removeDoorService(accessory);
103
169
  this.removeOutletService(accessory);
104
170
  this.removeSwitchService(accessory);
171
+ this.removeFaucetService(accessory);
172
+ this.removeWindowService(accessory);
105
173
  this.removeGarageDoorService(accessory);
174
+ this.removeWindowCoveringService(accessory);
175
+ this.removeStatefulProgrammableSwitchService(accessory);
106
176
  // Add switchService
107
177
  (this.lockService =
108
178
  accessory.getService(this.platform.Service.LockMechanism) ||
@@ -111,11 +181,71 @@ class Bot {
111
181
  this.lockService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
112
182
  this.lockService.getCharacteristic(this.platform.Characteristic.LockTargetState).onSet(this.handleOnSet.bind(this));
113
183
  }
184
+ else if (device.bot?.deviceType === 'faucet') {
185
+ this.removeFanService(accessory);
186
+ this.removeLockService(accessory);
187
+ this.removeDoorService(accessory);
188
+ this.removeOutletService(accessory);
189
+ this.removeSwitchService(accessory);
190
+ this.removeWindowService(accessory);
191
+ this.removeGarageDoorService(accessory);
192
+ this.removeWindowCoveringService(accessory);
193
+ this.removeStatefulProgrammableSwitchService(accessory);
194
+ // Add switchService
195
+ (this.faucetService =
196
+ accessory.getService(this.platform.Service.Faucet) ||
197
+ accessory.addService(this.platform.Service.Faucet)), `${accessory.displayName} Faucet`;
198
+ this.infoLog(`Bot: ${accessory.displayName} Displaying as Faucet`);
199
+ this.faucetService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
200
+ this.faucetService.getCharacteristic(this.platform.Characteristic.Active).onSet(this.handleOnSet.bind(this));
201
+ }
202
+ else if (device.bot?.deviceType === 'fan') {
203
+ this.removeLockService(accessory);
204
+ this.removeDoorService(accessory);
205
+ this.removeFaucetService(accessory);
206
+ this.removeOutletService(accessory);
207
+ this.removeSwitchService(accessory);
208
+ this.removeWindowService(accessory);
209
+ this.removeGarageDoorService(accessory);
210
+ this.removeWindowCoveringService(accessory);
211
+ this.removeStatefulProgrammableSwitchService(accessory);
212
+ // Add switchService
213
+ (this.fanService =
214
+ accessory.getService(this.platform.Service.Fan) ||
215
+ accessory.addService(this.platform.Service.Fan)), `${accessory.displayName} Fan`;
216
+ this.infoLog(`Bot: ${accessory.displayName} Displaying as Fan`);
217
+ this.fanService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
218
+ this.fanService.getCharacteristic(this.platform.Characteristic.On).onSet(this.handleOnSet.bind(this));
219
+ }
220
+ else if (device.bot?.deviceType === 'stateful') {
221
+ this.removeFanService(accessory);
222
+ this.removeLockService(accessory);
223
+ this.removeDoorService(accessory);
224
+ this.removeFaucetService(accessory);
225
+ this.removeOutletService(accessory);
226
+ this.removeSwitchService(accessory);
227
+ this.removeWindowService(accessory);
228
+ this.removeGarageDoorService(accessory);
229
+ this.removeWindowCoveringService(accessory);
230
+ // Add switchService
231
+ (this.statefulProgrammableSwitchService =
232
+ accessory.getService(this.platform.Service.StatefulProgrammableSwitch) ||
233
+ accessory.addService(this.platform.Service.StatefulProgrammableSwitch)), `${accessory.displayName} Stateful Programmable Switch`;
234
+ this.infoLog(`Bot: ${accessory.displayName} Displaying as Stateful Programmable Switch`);
235
+ this.statefulProgrammableSwitchService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
236
+ this.statefulProgrammableSwitchService.getCharacteristic(this.platform.Characteristic.ProgrammableSwitchOutputState)
237
+ .onSet(this.handleOnSet.bind(this));
238
+ }
114
239
  else {
240
+ this.removeFanService(accessory);
115
241
  this.removeLockService(accessory);
116
242
  this.removeDoorService(accessory);
243
+ this.removeFaucetService(accessory);
117
244
  this.removeSwitchService(accessory);
245
+ this.removeWindowService(accessory);
118
246
  this.removeGarageDoorService(accessory);
247
+ this.removeWindowCoveringService(accessory);
248
+ this.removeStatefulProgrammableSwitchService(accessory);
119
249
  // Add outletService
120
250
  (this.outletService =
121
251
  accessory.getService(this.platform.Service.Outlet) ||
@@ -168,42 +298,82 @@ class Bot {
168
298
  }
169
299
  removeOutletService(accessory) {
170
300
  // If outletService still pressent, then remove first
301
+ this.outletService = this.accessory.getService(this.platform.Service.Outlet);
171
302
  if (this.outletService) {
172
- this.debugLog(`Bot: ${accessory.displayName} Removing Leftover outletService first`);
303
+ this.warnLog(`Bot: ${accessory.displayName} Removing Leftover Outlet Service`);
173
304
  }
174
- this.outletService = this.accessory.getService(this.platform.Service.Outlet);
175
305
  accessory.removeService(this.outletService);
176
306
  }
177
307
  removeGarageDoorService(accessory) {
178
308
  // If garageDoorService still pressent, then remove first
309
+ this.garageDoorService = this.accessory.getService(this.platform.Service.GarageDoorOpener);
179
310
  if (this.garageDoorService) {
180
- this.debugLog(`Bot: ${accessory.displayName} Removing Leftover garageDoorService first`);
311
+ this.warnLog(`Bot: ${accessory.displayName} Removing Leftover Garage Door Service`);
181
312
  }
182
- this.garageDoorService = this.accessory.getService(this.platform.Service.GarageDoorOpener);
183
313
  accessory.removeService(this.garageDoorService);
184
314
  }
185
315
  removeDoorService(accessory) {
186
316
  // If doorService still pressent, then remove first
317
+ this.doorService = this.accessory.getService(this.platform.Service.Door);
187
318
  if (this.doorService) {
188
- this.debugLog(`Bot: ${accessory.displayName} Removing Leftover doorService first`);
319
+ this.warnLog(`Bot: ${accessory.displayName} Removing Leftover Door Service`);
189
320
  }
190
- this.doorService = this.accessory.getService(this.platform.Service.Door);
191
321
  accessory.removeService(this.doorService);
192
322
  }
193
323
  removeLockService(accessory) {
194
324
  // If lockService still pressent, then remove first
325
+ this.lockService = this.accessory.getService(this.platform.Service.LockMechanism);
195
326
  if (this.lockService) {
196
- this.debugLog(`Bot: ${accessory.displayName} Removing Leftover lockService first`);
327
+ this.warnLog(`Bot: ${accessory.displayName} Removing Leftover Lock Service`);
197
328
  }
198
- this.lockService = this.accessory.getService(this.platform.Service.Door);
199
329
  accessory.removeService(this.lockService);
200
330
  }
331
+ removeFaucetService(accessory) {
332
+ // If faucetService still pressent, then remove first
333
+ this.faucetService = this.accessory.getService(this.platform.Service.Faucet);
334
+ if (this.faucetService) {
335
+ this.warnLog(`Bot: ${accessory.displayName} Removing Leftover Faucet Service`);
336
+ }
337
+ accessory.removeService(this.faucetService);
338
+ }
339
+ removeFanService(accessory) {
340
+ // If fanService still pressent, then remove first
341
+ this.fanService = this.accessory.getService(this.platform.Service.Fan);
342
+ if (this.fanService) {
343
+ this.warnLog(`Bot: ${accessory.displayName} Removing Leftover Fan Service`);
344
+ }
345
+ accessory.removeService(this.fanService);
346
+ }
347
+ removeWindowService(accessory) {
348
+ // If windowService still pressent, then remove first
349
+ this.windowService = this.accessory.getService(this.platform.Service.Window);
350
+ if (this.windowService) {
351
+ this.warnLog(`Bot: ${accessory.displayName} Removing Leftover Window Service`);
352
+ }
353
+ accessory.removeService(this.windowService);
354
+ }
355
+ removeWindowCoveringService(accessory) {
356
+ // If windowCoveringService still pressent, then remove first
357
+ this.windowCoveringService = this.accessory.getService(this.platform.Service.WindowCovering);
358
+ if (this.windowCoveringService) {
359
+ this.warnLog(`Bot: ${accessory.displayName} Removing Leftover Window Covering Service`);
360
+ }
361
+ accessory.removeService(this.windowCoveringService);
362
+ }
363
+ removeStatefulProgrammableSwitchService(accessory) {
364
+ // If statefulProgrammableSwitchService still pressent, then remove first
365
+ this.statefulProgrammableSwitchService = this.accessory.getService(this.platform.Service.StatefulProgrammableSwitch);
366
+ if (this.statefulProgrammableSwitchService) {
367
+ this.warnLog(`Bot: ${accessory.displayName} Removing Leftover Stateful Programmable Switch Service`);
368
+ }
369
+ accessory.removeService(this.statefulProgrammableSwitchService);
370
+ }
201
371
  removeSwitchService(accessory) {
202
372
  // If switchService still pressent, then remove first
373
+ this.switchService = this.accessory.getService(this.platform.Service.Switch);
203
374
  if (this.switchService) {
204
- this.debugLog(`Bot: ${accessory.displayName} Removing Leftover switchService first`);
375
+ this.warnLog(`Bot: ${accessory.displayName} Removing Leftover Switch Service`);
205
376
  }
206
- this.switchService = this.accessory.getService(this.platform.Service.Switch);
207
377
  accessory.removeService(this.switchService);
208
378
  }
209
379
  refreshRate() {
@@ -322,15 +492,19 @@ class Bot {
322
492
  this.accessory.context.On = this.OnCached;
323
493
  }
324
494
  else {
325
- if (this.deviceStatus.body.power === 'on') {
326
- this.On = true;
327
- this.OnCached = this.On;
328
- this.accessory.context.On = this.OnCached;
329
- }
330
- else {
495
+ /*if (this.deviceStatus.body.power === 'on') {
496
+ this.On = true;
497
+ this.OnCached = this.On;
498
+ this.accessory.context.On = this.OnCached;
499
+ } else {
500
+ this.On = false;
501
+ this.OnCached = this.On;
502
+ this.accessory.context.On = this.OnCached;
503
+ }*/
504
+ this.OnCached = this.On;
505
+ this.accessory.context.On = this.OnCached;
506
+ if (this.On === undefined) {
331
507
  this.On = false;
332
- this.OnCached = this.On;
333
- this.accessory.context.On = this.OnCached;
334
508
  }
335
509
  }
336
510
  this.debugLog(`Bot: ${this.accessory.displayName} On: ${this.On}`);
@@ -662,6 +836,46 @@ class Bot {
662
836
  }
663
837
  this.debugLog(`Bot: ${this.accessory.displayName} Door On: ${this.On}`);
664
838
  }
839
+ else if (this.device.bot?.deviceType === 'window') {
840
+ if (this.On === undefined) {
841
+ this.debugLog(`Bot: ${this.accessory.displayName} On: ${this.On}`);
842
+ }
843
+ else {
844
+ if (this.On) {
845
+ this.windowService?.updateCharacteristic(this.platform.Characteristic.TargetPosition, 100);
846
+ this.windowService?.updateCharacteristic(this.platform.Characteristic.CurrentPosition, 100);
847
+ this.windowService?.updateCharacteristic(this.platform.Characteristic.PositionState, this.platform.Characteristic.PositionState.STOPPED);
848
+ this.debugLog(`Bot: ${this.accessory.displayName} updateCharacteristic TargetPosition: 100, CurrentPosition: 100`);
849
+ }
850
+ else {
851
+ this.windowService?.updateCharacteristic(this.platform.Characteristic.TargetPosition, 0);
852
+ this.windowService?.updateCharacteristic(this.platform.Characteristic.CurrentPosition, 0);
853
+ this.windowService?.updateCharacteristic(this.platform.Characteristic.PositionState, this.platform.Characteristic.PositionState.STOPPED);
854
+ this.debugLog(`Bot: ${this.accessory.displayName} updateCharacteristic TargetPosition: 0, CurrentPosition: 0`);
855
+ }
856
+ }
857
+ this.debugLog(`Bot: ${this.accessory.displayName} Window On: ${this.On}`);
858
+ }
859
+ else if (this.device.bot?.deviceType === 'windowcovering') {
860
+ if (this.On === undefined) {
861
+ this.debugLog(`Bot: ${this.accessory.displayName} On: ${this.On}`);
862
+ }
863
+ else {
864
+ if (this.On) {
865
+ this.windowCoveringService?.updateCharacteristic(this.platform.Characteristic.TargetPosition, 100);
866
+ this.windowCoveringService?.updateCharacteristic(this.platform.Characteristic.CurrentPosition, 100);
867
+ this.windowCoveringService?.updateCharacteristic(this.platform.Characteristic.PositionState, this.platform.Characteristic.PositionState.STOPPED);
868
+ this.debugLog(`Bot: ${this.accessory.displayName} updateCharacteristic TargetPosition: 100, CurrentPosition: 100`);
869
+ }
870
+ else {
871
+ this.windowCoveringService?.updateCharacteristic(this.platform.Characteristic.TargetPosition, 0);
872
+ this.windowCoveringService?.updateCharacteristic(this.platform.Characteristic.CurrentPosition, 0);
873
+ this.windowCoveringService?.updateCharacteristic(this.platform.Characteristic.PositionState, this.platform.Characteristic.PositionState.STOPPED);
874
+ this.debugLog(`Bot: ${this.accessory.displayName} updateCharacteristic TargetPosition: 0, CurrentPosition: 0`);
875
+ }
876
+ }
877
+ this.debugLog(`Bot: ${this.accessory.displayName} Window Covering On: ${this.On}`);
878
+ }
665
879
  else if (this.device.bot?.deviceType === 'lock') {
666
880
  if (this.On === undefined) {
667
881
  this.debugLog(`Bot: ${this.accessory.displayName} On: ${this.On}`);
@@ -680,6 +894,56 @@ class Bot {
680
894
  }
681
895
  this.debugLog(`Bot: ${this.accessory.displayName} Lock On: ${this.On}`);
682
896
  }
897
+ else if (this.device.bot?.deviceType === 'faucet') {
898
+ if (this.On === undefined) {
899
+ this.debugLog(`Bot: ${this.accessory.displayName} On: ${this.On}`);
900
+ }
901
+ else {
902
+ if (this.On) {
903
+ this.faucetService?.updateCharacteristic(this.platform.Characteristic.Active, this.platform.Characteristic.Active.ACTIVE);
904
+ this.debugLog(`Bot: ${this.accessory.displayName} updateCharacteristic Active: ${this.On}`);
905
+ }
906
+ else {
907
+ this.faucetService?.updateCharacteristic(this.platform.Characteristic.Active, this.platform.Characteristic.Active.INACTIVE);
908
+ this.debugLog(`Bot: ${this.accessory.displayName} updateCharacteristic Active: ${this.On}`);
909
+ }
910
+ }
911
+ this.debugLog(`Bot: ${this.accessory.displayName} Faucet On: ${this.On}`);
912
+ }
913
+ else if (this.device.bot?.deviceType === 'fan') {
914
+ if (this.On === undefined) {
915
+ this.debugLog(`Bot: ${this.accessory.displayName} On: ${this.On}`);
916
+ }
917
+ else {
918
+ if (this.On) {
919
+ this.fanService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
920
+ this.debugLog(`Bot: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
921
+ }
922
+ else {
923
+ this.fanService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
924
+ this.debugLog(`Bot: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
925
+ }
926
+ }
927
+ this.debugLog(`Bot: ${this.accessory.displayName} Fan On: ${this.On}`);
928
+ }
929
+ else if (this.device.bot?.deviceType === 'stateful') {
930
+ if (this.On === undefined) {
931
+ this.debugLog(`Bot: ${this.accessory.displayName} On: ${this.On}`);
932
+ }
933
+ else {
934
+ if (this.On) {
935
+ this.statefulProgrammableSwitchService?.updateCharacteristic(this.platform.Characteristic.ProgrammableSwitchEvent, this.platform.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
936
+ this.statefulProgrammableSwitchService?.updateCharacteristic(this.platform.Characteristic.ProgrammableSwitchOutputState, 1);
937
+ this.debugLog(`Bot: ${this.accessory.displayName} updateCharacteristic ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 1`);
938
+ }
939
+ else {
940
+ this.statefulProgrammableSwitchService?.updateCharacteristic(this.platform.Characteristic.ProgrammableSwitchEvent, this.platform.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
941
+ this.statefulProgrammableSwitchService?.updateCharacteristic(this.platform.Characteristic.ProgrammableSwitchOutputState, 0);
942
+ this.debugLog(`Bot: ${this.accessory.displayName} updateCharacteristic ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 0`);
943
+ }
944
+ }
945
+ this.debugLog(`Bot: ${this.accessory.displayName} StatefulProgrammableSwitch On: ${this.On}`);
946
+ }
683
947
  else if (this.device.bot?.deviceType === 'switch') {
684
948
  if (this.On === undefined) {
685
949
  this.debugLog(`Bot: ${this.accessory.displayName} On: ${this.On}`);
@@ -726,10 +990,30 @@ class Bot {
726
990
  this.doorService?.updateCharacteristic(this.platform.Characteristic.CurrentPosition, e);
727
991
  this.doorService?.updateCharacteristic(this.platform.Characteristic.PositionState, e);
728
992
  }
993
+ else if (this.device.bot?.deviceType === 'window') {
994
+ this.windowService?.updateCharacteristic(this.platform.Characteristic.TargetPosition, e);
995
+ this.windowService?.updateCharacteristic(this.platform.Characteristic.CurrentPosition, e);
996
+ this.windowService?.updateCharacteristic(this.platform.Characteristic.PositionState, e);
997
+ }
998
+ else if (this.device.bot?.deviceType === 'windowcovering') {
999
+ this.windowCoveringService?.updateCharacteristic(this.platform.Characteristic.TargetPosition, e);
1000
+ this.windowCoveringService?.updateCharacteristic(this.platform.Characteristic.CurrentPosition, e);
1001
+ this.windowCoveringService?.updateCharacteristic(this.platform.Characteristic.PositionState, e);
1002
+ }
729
1003
  else if (this.device.bot?.deviceType === 'lock') {
730
1004
  this.doorService?.updateCharacteristic(this.platform.Characteristic.LockTargetState, e);
731
1005
  this.doorService?.updateCharacteristic(this.platform.Characteristic.LockCurrentState, e);
732
1006
  }
1007
+ else if (this.device.bot?.deviceType === 'faucet') {
1008
+ this.faucetService?.updateCharacteristic(this.platform.Characteristic.Active, e);
1009
+ }
1010
+ else if (this.device.bot?.deviceType === 'fan') {
1011
+ this.fanService?.updateCharacteristic(this.platform.Characteristic.On, e);
1012
+ }
1013
+ else if (this.device.bot?.deviceType === 'stateful') {
1014
+ this.statefulProgrammableSwitchService?.updateCharacteristic(this.platform.Characteristic.ProgrammableSwitchEvent, e);
1015
+ this.statefulProgrammableSwitchService?.updateCharacteristic(this.platform.Characteristic.ProgrammableSwitchOutputState, e);
1016
+ }
733
1017
  else if (this.device.bot?.deviceType === 'switch') {
734
1018
  this.switchService?.updateCharacteristic(this.platform.Characteristic.On, e);
735
1019
  }
@@ -796,9 +1080,11 @@ class Bot {
796
1080
  this.On = true;
797
1081
  }
798
1082
  }
799
- else if (this.device.bot?.deviceType === 'door') {
1083
+ else if (this.device.bot?.deviceType === 'door'
1084
+ || this.device.bot?.deviceType === 'window'
1085
+ || this.device.bot?.deviceType === 'windowcovering') {
800
1086
  this.debugLog(`Bot: ${this.accessory.displayName} TargetPosition: ${value}`);
801
- if (value === 100) {
1087
+ if (value === 0) {
802
1088
  this.On = false;
803
1089
  }
804
1090
  else {
@@ -814,6 +1100,24 @@ class Bot {
814
1100
  this.On = true;
815
1101
  }
816
1102
  }
1103
+ else if (this.device.bot?.deviceType === 'faucet') {
1104
+ this.debugLog(`Bot: ${this.accessory.displayName} Active: ${value}`);
1105
+ if (value === this.platform.Characteristic.Active.INACTIVE) {
1106
+ this.On = false;
1107
+ }
1108
+ else {
1109
+ this.On = true;
1110
+ }
1111
+ }
1112
+ else if (this.device.bot?.deviceType === 'stateful') {
1113
+ this.debugLog(`Bot: ${this.accessory.displayName} ProgrammableSwitchOutputState: ${value}`);
1114
+ if (value === 0) {
1115
+ this.On = false;
1116
+ }
1117
+ else {
1118
+ this.On = true;
1119
+ }
1120
+ }
817
1121
  else {
818
1122
  this.debugLog(`Bot: ${this.accessory.displayName} On: ${value}`);
819
1123
  this.On = value;