@switchbot/homebridge-switchbot 1.10.2-beta.8 → 1.12.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 (99) hide show
  1. package/CHANGELOG.md +27 -3
  2. package/config.schema.json +58 -0
  3. package/dist/device/bot.d.ts +51 -40
  4. package/dist/device/bot.d.ts.map +1 -1
  5. package/dist/device/bot.js +58 -32
  6. package/dist/device/bot.js.map +1 -1
  7. package/dist/device/colorbulb.d.ts +25 -21
  8. package/dist/device/colorbulb.d.ts.map +1 -1
  9. package/dist/device/colorbulb.js +176 -140
  10. package/dist/device/colorbulb.js.map +1 -1
  11. package/dist/device/contact.d.ts +15 -15
  12. package/dist/device/contact.d.ts.map +1 -1
  13. package/dist/device/contact.js +14 -13
  14. package/dist/device/contact.js.map +1 -1
  15. package/dist/device/curtain.d.ts +25 -22
  16. package/dist/device/curtain.d.ts.map +1 -1
  17. package/dist/device/curtain.js +50 -37
  18. package/dist/device/curtain.js.map +1 -1
  19. package/dist/device/humidifier.d.ts +23 -20
  20. package/dist/device/humidifier.d.ts.map +1 -1
  21. package/dist/device/humidifier.js +38 -38
  22. package/dist/device/humidifier.js.map +1 -1
  23. package/dist/device/lock.d.ts +16 -13
  24. package/dist/device/lock.d.ts.map +1 -1
  25. package/dist/device/lock.js +14 -14
  26. package/dist/device/lock.js.map +1 -1
  27. package/dist/device/meter.d.ts +15 -15
  28. package/dist/device/meter.d.ts.map +1 -1
  29. package/dist/device/meter.js +11 -11
  30. package/dist/device/meter.js.map +1 -1
  31. package/dist/device/motion.d.ts +14 -14
  32. package/dist/device/motion.d.ts.map +1 -1
  33. package/dist/device/motion.js +13 -13
  34. package/dist/device/motion.js.map +1 -1
  35. package/dist/device/plug.d.ts +10 -7
  36. package/dist/device/plug.d.ts.map +1 -1
  37. package/dist/device/plug.js +17 -17
  38. package/dist/device/plug.js.map +1 -1
  39. package/dist/irdevice/airconditioner.d.ts +22 -22
  40. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  41. package/dist/irdevice/airconditioner.js +44 -44
  42. package/dist/irdevice/airconditioner.js.map +1 -1
  43. package/dist/irdevice/airpurifier.d.ts +12 -9
  44. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  45. package/dist/irdevice/airpurifier.js +20 -20
  46. package/dist/irdevice/airpurifier.js.map +1 -1
  47. package/dist/irdevice/camera.d.ts +10 -7
  48. package/dist/irdevice/camera.d.ts.map +1 -1
  49. package/dist/irdevice/camera.js +11 -11
  50. package/dist/irdevice/camera.js.map +1 -1
  51. package/dist/irdevice/fan.d.ts +12 -9
  52. package/dist/irdevice/fan.d.ts.map +1 -1
  53. package/dist/irdevice/fan.js +29 -29
  54. package/dist/irdevice/fan.js.map +1 -1
  55. package/dist/irdevice/light.d.ts +10 -7
  56. package/dist/irdevice/light.d.ts.map +1 -1
  57. package/dist/irdevice/light.js +13 -13
  58. package/dist/irdevice/light.js.map +1 -1
  59. package/dist/irdevice/other.d.ts +12 -9
  60. package/dist/irdevice/other.d.ts.map +1 -1
  61. package/dist/irdevice/other.js +17 -17
  62. package/dist/irdevice/other.js.map +1 -1
  63. package/dist/irdevice/tv.d.ts +13 -10
  64. package/dist/irdevice/tv.d.ts.map +1 -1
  65. package/dist/irdevice/tv.js +25 -25
  66. package/dist/irdevice/tv.js.map +1 -1
  67. package/dist/irdevice/vacuumcleaner.d.ts +10 -7
  68. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  69. package/dist/irdevice/vacuumcleaner.js +13 -13
  70. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  71. package/dist/irdevice/waterheater.d.ts +10 -7
  72. package/dist/irdevice/waterheater.d.ts.map +1 -1
  73. package/dist/irdevice/waterheater.js +16 -16
  74. package/dist/irdevice/waterheater.js.map +1 -1
  75. package/dist/platform.d.ts.map +1 -1
  76. package/dist/settings.d.ts +5 -1
  77. package/dist/settings.d.ts.map +1 -1
  78. package/dist/settings.js.map +1 -1
  79. package/package.json +76 -76
  80. package/src/device/bot.ts +82 -55
  81. package/src/device/colorbulb.ts +206 -157
  82. package/src/device/contact.ts +31 -30
  83. package/src/device/curtain.ts +68 -57
  84. package/src/device/humidifier.ts +65 -53
  85. package/src/device/lock.ts +22 -22
  86. package/src/device/meter.ts +25 -25
  87. package/src/device/motion.ts +27 -27
  88. package/src/device/plug.ts +20 -20
  89. package/src/irdevice/airconditioner.ts +54 -54
  90. package/src/irdevice/airpurifier.ts +30 -30
  91. package/src/irdevice/camera.ts +19 -19
  92. package/src/irdevice/fan.ts +40 -40
  93. package/src/irdevice/light.ts +23 -23
  94. package/src/irdevice/other.ts +25 -25
  95. package/src/irdevice/tv.ts +42 -42
  96. package/src/irdevice/vacuumcleaner.ts +21 -21
  97. package/src/irdevice/waterheater.ts +24 -24
  98. package/src/platform.ts +4 -4
  99. package/src/settings.ts +6 -1
@@ -28,7 +28,9 @@ class ColorBulb {
28
28
  this.Hue = 0;
29
29
  this.Brightness = 0;
30
30
  this.Saturation = 0;
31
- this.ColorTemperature = 140;
31
+ if (device.deviceType === 'Color Bulb') {
32
+ this.ColorTemperature = 140;
33
+ }
32
34
  this.minKelvin = 2000;
33
35
  this.maxKelvin = 9000;
34
36
  // this is subject we use to track when we need to POST changes to the SwitchBot API
@@ -40,28 +42,28 @@ class ColorBulb {
40
42
  accessory
41
43
  .getService(this.platform.Service.AccessoryInformation)
42
44
  .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
43
- .setCharacteristic(this.platform.Characteristic.Model, 'SWITCHBOT-COLORBULB-W1401400')
45
+ .setCharacteristic(this.platform.Characteristic.Model, this.model(device))
44
46
  .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId);
45
47
  // get the Lightbulb service if it exists, otherwise create a new Lightbulb service
46
48
  // you can create multiple services for each accessory
47
- (this.service = accessory.getService(this.platform.Service.Lightbulb) || accessory.addService(this.platform.Service.Lightbulb)),
48
- `${accessory.displayName} Light Bulb`;
49
+ (this.lightBulbService = accessory.getService(this.platform.Service.Lightbulb) || accessory.addService(this.platform.Service.Lightbulb)),
50
+ `${accessory.displayName} ${device.deviceType}`;
49
51
  if (this.adaptiveLightingShift === -1 && this.accessory.context.adaptiveLighting) {
50
- this.accessory.removeService(this.service);
51
- this.service = this.accessory.addService(this.platform.Service.Lightbulb);
52
+ this.accessory.removeService(this.lightBulbService);
53
+ this.lightBulbService = this.accessory.addService(this.platform.Service.Lightbulb);
52
54
  this.accessory.context.adaptiveLighting = false;
53
- this.debugLog(`Color Bulb: ${this.accessory.displayName} adaptiveLighting: ${this.accessory.context.adaptiveLighting}`);
55
+ this.debugLog(`${device.deviceType}: ${this.accessory.displayName} adaptiveLighting: ${this.accessory.context.adaptiveLighting}`);
54
56
  }
55
57
  // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
56
58
  // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
57
59
  // accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
58
60
  // set the service name, this is what is displayed as the default name on the Home app
59
61
  // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
60
- this.service.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
62
+ this.lightBulbService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
61
63
  // handle on / off events using the On characteristic
62
- this.service.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
64
+ this.lightBulbService.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
63
65
  // handle Brightness events using the Brightness characteristic
64
- this.service
66
+ this.lightBulbService
65
67
  .getCharacteristic(this.platform.Characteristic.Brightness)
66
68
  .setProps({
67
69
  minStep: this.minStep(device),
@@ -74,19 +76,25 @@ class ColorBulb {
74
76
  })
75
77
  .onSet(this.BrightnessSet.bind(this));
76
78
  // handle ColorTemperature events using the ColorTemperature characteristic
77
- this.service
78
- .getCharacteristic(this.platform.Characteristic.ColorTemperature)
79
- .setProps({
80
- minValue: 140,
81
- maxValue: 500,
82
- validValueRanges: [140, 500],
83
- })
84
- .onGet(() => {
85
- return this.ColorTemperature;
86
- })
87
- .onSet(this.ColorTemperatureSet.bind(this));
79
+ if (device.deviceType === 'Color Bulb') {
80
+ this.debugLog(`Color Bulb: ${accessory.displayName} Add ColorTemperature Characteristic`);
81
+ this.lightBulbService
82
+ .getCharacteristic(this.platform.Characteristic.ColorTemperature)
83
+ .setProps({
84
+ minValue: 140,
85
+ maxValue: 500,
86
+ validValueRanges: [140, 500],
87
+ })
88
+ .onGet(() => {
89
+ return this.ColorTemperature;
90
+ })
91
+ .onSet(this.ColorTemperatureSet.bind(this));
92
+ }
93
+ else {
94
+ this.debugLog(`Color Bulb: ${accessory.displayName} ColorTemperature Characteristic Not Added`);
95
+ }
88
96
  // handle Hue events using the Hue characteristic
89
- this.service
97
+ this.lightBulbService
90
98
  .getCharacteristic(this.platform.Characteristic.Hue)
91
99
  .setProps({
92
100
  minValue: 0,
@@ -98,7 +106,7 @@ class ColorBulb {
98
106
  })
99
107
  .onSet(this.HueSet.bind(this));
100
108
  // handle Hue events using the Hue characteristic
101
- this.service
109
+ this.lightBulbService
102
110
  .getCharacteristic(this.platform.Characteristic.Saturation)
103
111
  .setProps({
104
112
  minValue: 0,
@@ -109,14 +117,14 @@ class ColorBulb {
109
117
  return this.Saturation;
110
118
  })
111
119
  .onSet(this.SaturationSet.bind(this));
112
- this.debugLog(`Color Bulb: ${this.accessory.displayName} adaptiveLightingShift: ${this.adaptiveLightingShift}`);
120
+ this.debugLog(`${device.deviceType}: ${this.accessory.displayName} adaptiveLightingShift: ${this.adaptiveLightingShift}`);
113
121
  if (this.adaptiveLightingShift !== -1) {
114
- this.AdaptiveLightingController = new platform.api.hap.AdaptiveLightingController(this.service, {
122
+ this.AdaptiveLightingController = new platform.api.hap.AdaptiveLightingController(this.lightBulbService, {
115
123
  customTemperatureAdjustment: this.adaptiveLightingShift,
116
124
  });
117
125
  this.accessory.configureController(this.AdaptiveLightingController);
118
126
  this.accessory.context.adaptiveLighting = true;
119
- this.debugLog(`Color Bulb: ${this.accessory.displayName} adaptiveLighting: ${this.accessory.context.adaptiveLighting},` +
127
+ this.debugLog(`${device.deviceType}: ${this.accessory.displayName} adaptiveLighting: ${this.accessory.context.adaptiveLighting},` +
120
128
  ` adaptiveLightingShift: ${this.adaptiveLightingShift}`);
121
129
  }
122
130
  // Update Homekit
@@ -124,8 +132,8 @@ class ColorBulb {
124
132
  // Start an update interval
125
133
  (0, rxjs_1.interval)(this.deviceRefreshRate * 1000)
126
134
  .pipe((0, operators_1.skipWhile)(() => this.colorBulbUpdateInProgress))
127
- .subscribe(() => {
128
- this.refreshStatus();
135
+ .subscribe(async () => {
136
+ await this.refreshStatus();
129
137
  });
130
138
  // Watch for Bulb change events
131
139
  // We put in a debounce of 100ms so we don't make duplicate calls
@@ -138,19 +146,19 @@ class ColorBulb {
138
146
  await this.pushChanges();
139
147
  }
140
148
  catch (e) {
141
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges`);
149
+ this.errorLog(`${device.deviceType}: ${this.accessory.displayName} failed pushChanges`);
142
150
  if (this.deviceLogging === 'debug') {
143
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges,` + ` Error Message: ${JSON.stringify(e.message)}`);
151
+ this.errorLog(`${device.deviceType}: ${this.accessory.displayName} failed pushChanges,` + ` Error Message: ${JSON.stringify(e.message)}`);
144
152
  }
145
153
  if (this.platform.debugMode) {
146
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges,` + ` Error: ${JSON.stringify(e)}`);
154
+ this.errorLog(`${device.deviceType}: ${this.accessory.displayName} failed pushChanges,` + ` Error: ${JSON.stringify(e)}`);
147
155
  }
148
156
  this.apiError(e);
149
157
  }
150
158
  this.colorBulbUpdateInProgress = false;
151
159
  });
152
160
  }
153
- parseStatus() {
161
+ async parseStatus() {
154
162
  switch (this.power) {
155
163
  case 'on':
156
164
  this.On = true;
@@ -158,53 +166,58 @@ class ColorBulb {
158
166
  default:
159
167
  this.On = false;
160
168
  }
161
- this.debugLog(`Color Bulb: ${this.accessory.displayName} On: ${this.On}`);
169
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
162
170
  // Brightness
163
171
  this.Brightness = Number(this.brightness);
164
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Brightness: ${this.Brightness}`);
172
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Brightness: ${this.Brightness}`);
165
173
  // Color, Hue & Brightness
166
174
  if (this.color) {
167
- this.debugLog(`Color Bulb: ${this.accessory.displayName} color: ${JSON.stringify(this.color)}`);
175
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} color: ${JSON.stringify(this.color)}`);
168
176
  const [red, green, blue] = this.color.split(':');
169
- this.debugLog(`Color Bulb: ${this.accessory.displayName} red: ${JSON.stringify(red)}`);
170
- this.debugLog(`Color Bulb: ${this.accessory.displayName} green: ${JSON.stringify(green)}`);
171
- this.debugLog(`Color Bulb: ${this.accessory.displayName} blue: ${JSON.stringify(blue)}`);
177
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} red: ${JSON.stringify(red)}`);
178
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} green: ${JSON.stringify(green)}`);
179
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} blue: ${JSON.stringify(blue)}`);
172
180
  const [hue, saturation] = (0, settings_1.rgb2hs)(Number(red), Number(green), Number(blue));
173
- this.debugLog(`Color Bulb: ${this.accessory.displayName} hs: ${JSON.stringify((0, settings_1.rgb2hs)(Number(red), Number(green), Number(blue)))}`);
181
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} hs: ${JSON.stringify((0, settings_1.rgb2hs)(Number(red), Number(green), Number(blue)))}`);
174
182
  // Hue
175
183
  this.Hue = hue;
176
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Hue: ${this.Hue}`);
184
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Hue: ${this.Hue}`);
177
185
  // Saturation
178
186
  this.Saturation = saturation;
179
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Saturation: ${this.Saturation}`);
187
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Saturation: ${this.Saturation}`);
180
188
  }
181
189
  // ColorTemperature
182
- if (!Number.isNaN(this.colorTemperature)) {
183
- this.debugLog(`Color Bulb: ${this.accessory.displayName} OpenAPI ColorTemperature: ${this.colorTemperature}`);
184
- const mired = Math.round(1000000 / this.colorTemperature);
185
- this.ColorTemperature = Number(mired);
186
- this.ColorTemperature = Math.max(Math.min(this.ColorTemperature, 500), 140);
187
- this.debugLog(`Color Bulb: ${this.accessory.displayName} ColorTemperature: ${this.ColorTemperature}`);
190
+ if (this.device.deviceType === 'Color Bulb') {
191
+ if (!Number.isNaN(this.colorTemperature)) {
192
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} OpenAPI ColorTemperature: ${this.colorTemperature}`);
193
+ const mired = Math.round(1000000 / this.colorTemperature);
194
+ this.ColorTemperature = Number(mired);
195
+ this.ColorTemperature = Math.max(Math.min(this.ColorTemperature, 500), 140);
196
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ColorTemperature: ${this.ColorTemperature}`);
197
+ }
188
198
  }
189
199
  }
190
200
  async refreshStatus() {
191
201
  try {
192
202
  this.deviceStatus = (await this.platform.axios.get(`${settings_1.DeviceURL}/${this.device.deviceId}/status`)).data;
193
- this.debugLog(`Color Bulb: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(this.deviceStatus)}`);
203
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(this.deviceStatus)}`);
194
204
  this.power = this.deviceStatus.body.power;
195
205
  this.color = this.deviceStatus.body.color;
196
206
  this.brightness = this.deviceStatus.body.brightness;
197
- this.colorTemperature = this.deviceStatus.body.colorTemperature;
207
+ if (this.device.deviceType === 'Color Bulb') {
208
+ this.colorTemperature = this.deviceStatus.body.colorTemperature;
209
+ }
198
210
  this.parseStatus();
199
211
  this.updateHomeKitCharacteristics();
200
212
  }
201
213
  catch (e) {
202
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection`);
214
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection`);
203
215
  if (this.deviceLogging === 'debug') {
204
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`);
216
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,` +
217
+ ` Error Message: ${JSON.stringify(e.message)}`);
205
218
  }
206
219
  if (this.platform.debugMode) {
207
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
220
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
208
221
  }
209
222
  this.apiError(e);
210
223
  }
@@ -239,11 +252,11 @@ class ColorBulb {
239
252
  else {
240
253
  payload.command = 'turnOff';
241
254
  }
242
- this.infoLog(`Color Bulb: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
255
+ this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
243
256
  ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
244
257
  // Make the API request
245
258
  const push = await this.platform.axios.post(`${settings_1.DeviceURL}/${this.device.deviceId}/commands`, payload);
246
- this.debugLog(`Color Bulb: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
259
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
247
260
  this.statusCode(push);
248
261
  this.OnCached = this.On;
249
262
  this.accessory.context.On = this.OnCached;
@@ -253,7 +266,7 @@ class ColorBulb {
253
266
  await this.pushBrightnessChanges();
254
267
  }
255
268
  // Push ColorTemperature Update
256
- if (this.On) {
269
+ if (this.On && this.device.deviceType === 'Color Bulb') {
257
270
  await this.pushColorTemperatureChanges();
258
271
  }
259
272
  // Push Hue & Saturation Update
@@ -262,12 +275,13 @@ class ColorBulb {
262
275
  }
263
276
  }
264
277
  catch (e) {
265
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
278
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
266
279
  if (this.deviceLogging === 'debug') {
267
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`);
280
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` +
281
+ ` Error Message: ${JSON.stringify(e.message)}`);
268
282
  }
269
283
  if (this.platform.debugMode) {
270
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
284
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
271
285
  }
272
286
  this.apiError(e);
273
287
  }
@@ -275,36 +289,37 @@ class ColorBulb {
275
289
  async pushHueSaturationChanges() {
276
290
  try {
277
291
  if (this.Hue !== this.HueCached || this.Saturation !== this.SaturationCached) {
278
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Hue: ${JSON.stringify(this.Hue)}`);
279
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Saturation: ${JSON.stringify(this.Saturation)}`);
292
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Hue: ${JSON.stringify(this.Hue)}`);
293
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Saturation: ${JSON.stringify(this.Saturation)}`);
280
294
  const [red, green, blue] = (0, settings_1.hs2rgb)(Number(this.Hue), Number(this.Saturation));
281
- this.debugLog(`Color Bulb: ${this.accessory.displayName} rgb: ${JSON.stringify([red, green, blue])}`);
295
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} rgb: ${JSON.stringify([red, green, blue])}`);
282
296
  const payload = {
283
297
  commandType: 'command',
284
298
  command: 'setColor',
285
299
  parameter: `${red}:${green}:${blue}`,
286
300
  };
287
- this.infoLog(`Color Bulb: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
301
+ this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
288
302
  ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
289
303
  // Make the API request
290
304
  const push = await this.platform.axios.post(`${settings_1.DeviceURL}/${this.device.deviceId}/commands`, payload);
291
- this.debugLog(`Color Bulb: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
305
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
292
306
  this.statusCode(push);
293
307
  this.HueCached = this.Hue;
294
308
  this.SaturationCached = this.Saturation;
295
309
  }
296
310
  else {
297
- this.debugLog(`Color Bulb: ${this.accessory.displayName} No Changes.` +
311
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No Changes.` +
298
312
  `Hue: ${this.Hue}, HueCached: ${this.HueCached}, Saturation: ${this.Saturation}, SaturationCached: ${this.SaturationCached}`);
299
313
  }
300
314
  }
301
315
  catch (e) {
302
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
316
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
303
317
  if (this.deviceLogging === 'debug') {
304
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`);
318
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` +
319
+ ` Error Message: ${JSON.stringify(e.message)}`);
305
320
  }
306
321
  if (this.platform.debugMode) {
307
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
322
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
308
323
  }
309
324
  this.apiError(e);
310
325
  }
@@ -319,26 +334,27 @@ class ColorBulb {
319
334
  command: 'setColorTemperature',
320
335
  parameter: `${kelvin}`,
321
336
  };
322
- this.infoLog(`Color Bulb: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
337
+ this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
323
338
  ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
324
339
  // Make the API request
325
340
  const push = await this.platform.axios.post(`${settings_1.DeviceURL}/${this.device.deviceId}/commands`, payload);
326
- this.debugLog(`Color Bulb: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
341
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
327
342
  this.statusCode(push);
328
343
  this.ColorTemperatureCached = this.ColorTemperature;
329
344
  }
330
345
  else {
331
- this.debugLog(`Color Bulb: ${this.accessory.displayName} No Changes.` +
346
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No Changes.` +
332
347
  `ColorTemperature: ${this.ColorTemperature}, ColorTemperatureCached: ${this.ColorTemperatureCached}`);
333
348
  }
334
349
  }
335
350
  catch (e) {
336
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
351
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
337
352
  if (this.deviceLogging === 'debug') {
338
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`);
353
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` +
354
+ ` Error Message: ${JSON.stringify(e.message)}`);
339
355
  }
340
356
  if (this.platform.debugMode) {
341
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
357
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
342
358
  }
343
359
  this.apiError(e);
344
360
  }
@@ -351,135 +367,141 @@ class ColorBulb {
351
367
  command: 'setBrightness',
352
368
  parameter: `${this.Brightness}`,
353
369
  };
354
- this.infoLog(`Color Bulb: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
370
+ this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
355
371
  ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
356
372
  // Make the API request
357
373
  const push = await this.platform.axios.post(`${settings_1.DeviceURL}/${this.device.deviceId}/commands`, payload);
358
- this.debugLog(`Color Bulb: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
374
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
359
375
  this.statusCode(push);
360
376
  this.BrightnessCached = this.Brightness;
361
377
  }
362
378
  else {
363
- this.debugLog(`Color Bulb: ${this.accessory.displayName} No Changes.` + `Brightness: ${this.Brightness}, BrightnessCached: ${this.BrightnessCached}`);
379
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No Changes.` +
380
+ `Brightness: ${this.Brightness}, BrightnessCached: ${this.BrightnessCached}`);
364
381
  }
365
382
  }
366
383
  catch (e) {
367
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
384
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
368
385
  if (this.deviceLogging === 'debug') {
369
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`);
386
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` +
387
+ ` Error Message: ${JSON.stringify(e.message)}`);
370
388
  }
371
389
  if (this.platform.debugMode) {
372
- this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
390
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
373
391
  }
374
392
  this.apiError(e);
375
393
  }
376
394
  }
377
- updateHomeKitCharacteristics() {
395
+ async updateHomeKitCharacteristics() {
378
396
  if (this.On === undefined) {
379
- this.debugLog(`Color Bulb: ${this.accessory.displayName} On: ${this.On}`);
397
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
380
398
  }
381
399
  else {
382
- this.service.updateCharacteristic(this.platform.Characteristic.On, this.On);
383
- this.debugLog(`Color Bulb: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
400
+ this.lightBulbService.updateCharacteristic(this.platform.Characteristic.On, this.On);
401
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
384
402
  }
385
403
  if (this.Brightness === undefined) {
386
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Brightness: ${this.Brightness}`);
404
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Brightness: ${this.Brightness}`);
387
405
  }
388
406
  else {
389
- this.service.updateCharacteristic(this.platform.Characteristic.Brightness, this.Brightness);
390
- this.debugLog(`Color Bulb: ${this.accessory.displayName} updateCharacteristic Brightness: ${this.Brightness}`);
407
+ this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Brightness, this.Brightness);
408
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Brightness: ${this.Brightness}`);
391
409
  }
392
- if (this.ColorTemperature === undefined) {
393
- this.debugLog(`Color Bulb: ${this.accessory.displayName} ColorTemperature: ${this.ColorTemperature}`);
394
- }
395
- else {
396
- this.service.updateCharacteristic(this.platform.Characteristic.ColorTemperature, this.ColorTemperature);
397
- this.debugLog(`Color Bulb: ${this.accessory.displayName} updateCharacteristic ColorTemperature: ${this.ColorTemperature}`);
410
+ if (this.device.deviceType === 'Color Bulb') {
411
+ if (this.ColorTemperature === undefined) {
412
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ColorTemperature: ${this.ColorTemperature}`);
413
+ }
414
+ else {
415
+ this.lightBulbService.updateCharacteristic(this.platform.Characteristic.ColorTemperature, this.ColorTemperature);
416
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic ColorTemperature: ${this.ColorTemperature}`);
417
+ }
398
418
  }
399
419
  if (this.Hue === undefined) {
400
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Hue: ${this.Hue}`);
420
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Hue: ${this.Hue}`);
401
421
  }
402
422
  else {
403
- this.service.updateCharacteristic(this.platform.Characteristic.Hue, this.Hue);
404
- this.debugLog(`Color Bulb: ${this.accessory.displayName} updateCharacteristic Hue: ${this.Hue}`);
423
+ this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Hue, this.Hue);
424
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Hue: ${this.Hue}`);
405
425
  }
406
426
  if (this.Saturation === undefined) {
407
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Saturation: ${this.Saturation}`);
427
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Saturation: ${this.Saturation}`);
408
428
  }
409
429
  else {
410
- this.service.updateCharacteristic(this.platform.Characteristic.Saturation, this.Saturation);
411
- this.debugLog(`Color Bulb: ${this.accessory.displayName} updateCharacteristic Saturation: ${this.Saturation}`);
430
+ this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Saturation, this.Saturation);
431
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Saturation: ${this.Saturation}`);
412
432
  }
413
433
  }
414
434
  apiError(e) {
415
- this.service.updateCharacteristic(this.platform.Characteristic.On, e);
416
- this.service.updateCharacteristic(this.platform.Characteristic.Hue, e);
417
- this.service.updateCharacteristic(this.platform.Characteristic.Brightness, e);
418
- this.service.updateCharacteristic(this.platform.Characteristic.Saturation, e);
419
- this.service.updateCharacteristic(this.platform.Characteristic.ColorTemperature, e);
435
+ this.lightBulbService.updateCharacteristic(this.platform.Characteristic.On, e);
436
+ this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Hue, e);
437
+ this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Brightness, e);
438
+ this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Saturation, e);
439
+ if (this.device.deviceType === 'Color Bulb') {
440
+ this.lightBulbService.updateCharacteristic(this.platform.Characteristic.ColorTemperature, e);
441
+ }
420
442
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
421
443
  }
422
444
  statusCode(push) {
423
445
  switch (push.data.statusCode) {
424
446
  case 151:
425
- this.errorLog(`Color Bulb: ${this.accessory.displayName} Command not supported by this device type.`);
447
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Command not supported by this device type.`);
426
448
  break;
427
449
  case 152:
428
- this.errorLog(`Color Bulb: ${this.accessory.displayName} Device not found.`);
450
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Device not found.`);
429
451
  break;
430
452
  case 160:
431
- this.errorLog(`Color Bulb: ${this.accessory.displayName} Command is not supported.`);
453
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Command is not supported.`);
432
454
  break;
433
455
  case 161:
434
- this.errorLog(`Color Bulb: ${this.accessory.displayName} Device is offline.`);
456
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Device is offline.`);
435
457
  this.offlineOff();
436
458
  break;
437
459
  case 171:
438
- this.errorLog(`Color Bulb: ${this.accessory.displayName} is offline. Hub: ${this.device.hubDeviceId}`);
460
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} is offline. Hub: ${this.device.hubDeviceId}`);
439
461
  this.offlineOff();
440
462
  break;
441
463
  case 190:
442
- this.errorLog(`Color Bulb: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,` +
464
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,` +
443
465
  ` Or command: ${JSON.stringify(push.data)} format is invalid`);
444
466
  break;
445
467
  case 100:
446
468
  if (this.platform.debugMode) {
447
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Command successfully sent.`);
469
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Command successfully sent.`);
448
470
  }
449
471
  break;
450
472
  default:
451
473
  if (this.platform.debugMode) {
452
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Unknown statusCode.`);
474
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Unknown statusCode.`);
453
475
  }
454
476
  }
455
477
  }
456
- offlineOff() {
478
+ async offlineOff() {
457
479
  if (this.device.offline) {
458
480
  this.On = false;
459
- this.service.getCharacteristic(this.platform.Characteristic.On).updateValue(this.On);
481
+ this.lightBulbService.getCharacteristic(this.platform.Characteristic.On).updateValue(this.On);
460
482
  }
461
483
  }
462
484
  /**
463
485
  * Handle requests to set the value of the "On" characteristic
464
486
  */
465
- OnSet(value) {
466
- this.debugLog(`Color Bulb: ${this.accessory.displayName} On: ${value}`);
487
+ async OnSet(value) {
488
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${value}`);
467
489
  this.On = value;
468
490
  this.doColorBulbUpdate.next();
469
491
  }
470
492
  /**
471
493
  * Handle requests to set the value of the "Brightness" characteristic
472
494
  */
473
- BrightnessSet(value) {
474
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Brightness: ${value}`);
495
+ async BrightnessSet(value) {
496
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Brightness: ${value}`);
475
497
  this.Brightness = value;
476
498
  this.doColorBulbUpdate.next();
477
499
  }
478
500
  /**
479
501
  * Handle requests to set the value of the "ColorTemperature" characteristic
480
502
  */
481
- ColorTemperatureSet(value) {
482
- this.debugLog(`Color Bulb: ${this.accessory.displayName} ColorTemperature: ${value}`);
503
+ async ColorTemperatureSet(value) {
504
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ColorTemperature: ${value}`);
483
505
  // Convert mired to kelvin to nearest 100 (SwitchBot seems to need this)
484
506
  const kelvin = Math.round(1000000 / Number(value) / 100) * 100;
485
507
  // Check and increase/decrease kelvin to range of device
@@ -489,30 +511,44 @@ class ColorBulb {
489
511
  }
490
512
  // Updating the hue/sat to the corresponding values mimics native adaptive lighting
491
513
  const hs = (0, settings_1.m2hs)(value);
492
- this.service.updateCharacteristic(this.platform.Characteristic.Hue, hs[0]);
493
- this.service.updateCharacteristic(this.platform.Characteristic.Saturation, hs[1]);
514
+ this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Hue, hs[0]);
515
+ this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Saturation, hs[1]);
494
516
  this.ColorTemperature = value;
495
517
  this.doColorBulbUpdate.next();
496
518
  }
497
519
  /**
498
520
  * Handle requests to set the value of the "Hue" characteristic
499
521
  */
500
- HueSet(value) {
501
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Hue: ${value}`);
502
- this.service.updateCharacteristic(this.platform.Characteristic.ColorTemperature, 140);
522
+ async HueSet(value) {
523
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Hue: ${value}`);
524
+ if (this.device.deviceType === 'Color Bulb') {
525
+ this.lightBulbService.updateCharacteristic(this.platform.Characteristic.ColorTemperature, 140);
526
+ }
503
527
  this.Hue = value;
504
528
  this.doColorBulbUpdate.next();
505
529
  }
506
530
  /**
507
531
  * Handle requests to set the value of the "Saturation" characteristic
508
532
  */
509
- SaturationSet(value) {
510
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Saturation: ${value}`);
511
- this.service.updateCharacteristic(this.platform.Characteristic.ColorTemperature, 140);
533
+ async SaturationSet(value) {
534
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Saturation: ${value}`);
535
+ if (this.device.deviceType === 'Color Bulb') {
536
+ this.lightBulbService.updateCharacteristic(this.platform.Characteristic.ColorTemperature, 140);
537
+ }
512
538
  this.Saturation = value;
513
539
  this.doColorBulbUpdate.next();
514
540
  }
515
- config(device) {
541
+ model(device) {
542
+ let model;
543
+ if (device.deviceType === 'Strip Light') {
544
+ model = 'W1701100';
545
+ }
546
+ else {
547
+ model = 'W1401400';
548
+ }
549
+ return model;
550
+ }
551
+ async config(device) {
516
552
  let config = {};
517
553
  if (device.colorbulb) {
518
554
  config = device.colorbulb;
@@ -533,45 +569,45 @@ class ColorBulb {
533
569
  config['offline'] = device.offline;
534
570
  }
535
571
  if (Object.entries(config).length !== 0) {
536
- this.warnLog(`Color Bulb: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
572
+ this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
537
573
  }
538
574
  }
539
- refreshRate(device) {
575
+ async refreshRate(device) {
540
576
  if (device.refreshRate) {
541
577
  this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
542
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
578
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
543
579
  }
544
580
  else if (this.platform.config.options.refreshRate) {
545
581
  this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options.refreshRate;
546
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
582
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
547
583
  }
548
584
  }
549
- logs(device) {
585
+ async logs(device) {
550
586
  if (this.platform.debugMode) {
551
587
  this.deviceLogging = this.accessory.context.logging = 'debugMode';
552
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
588
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
553
589
  }
554
590
  else if (device.logging) {
555
591
  this.deviceLogging = this.accessory.context.logging = device.logging;
556
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
592
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
557
593
  }
558
594
  else if (this.platform.config.options?.logging) {
559
595
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
560
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
596
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
561
597
  }
562
598
  else {
563
599
  this.deviceLogging = this.accessory.context.logging = 'standard';
564
- this.debugLog(`Color Bulb: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
600
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
565
601
  }
566
602
  }
567
- adaptiveLighting(device) {
603
+ async adaptiveLighting(device) {
568
604
  if (device.colorbulb?.adaptiveLightingShift) {
569
605
  this.adaptiveLightingShift = device.colorbulb.adaptiveLightingShift;
570
- this.debugLog(`Color Bulb: ${this.accessory.displayName} adaptiveLightingShift: ${this.adaptiveLightingShift}`);
606
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} adaptiveLightingShift: ${this.adaptiveLightingShift}`);
571
607
  }
572
608
  else {
573
609
  this.adaptiveLightingShift = 0;
574
- this.debugLog(`Color Bulb: ${this.accessory.displayName} adaptiveLightingShift: ${this.adaptiveLightingShift}`);
610
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} adaptiveLightingShift: ${this.adaptiveLightingShift}`);
575
611
  }
576
612
  }
577
613
  minStep(device) {