@switchbot/homebridge-switchbot 3.5.0-beta.51 → 3.5.0-beta.53

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.
@@ -65,258 +65,77 @@ export abstract class irdeviceBase {
65
65
  }
66
66
 
67
67
  async getDeviceConfigSettings(device: irdevice & irDevicesConfig): Promise<void> {
68
- let config = {};
69
- if (device.logging !== undefined) {
70
- config['logging'] = device.logging;
68
+ const deviceConfig = {};
69
+ if (device.logging !== 'standard') {
70
+ deviceConfig['logging'] = device.logging;
71
71
  }
72
- if (device.irair) {
73
- config = device.irair;
74
- }
75
- if (device.connectionType !== undefined) {
76
- config['connectionType'] = device.connectionType;
77
- }
78
- if (device.external !== undefined) {
79
- config['external'] = device.external;
80
- }
81
- if (device.customOn !== undefined) {
82
- config['customOn'] = device.customOn;
83
- }
84
- if (device.customOff !== undefined) {
85
- config['customOff'] = device.customOff;
72
+ if (device.connectionType !== '') {
73
+ deviceConfig['connectionType'] = device.connectionType;
86
74
  }
87
- if (device.customize !== undefined) {
88
- config['customize'] = device.customize;
75
+ if (device.external === true) {
76
+ deviceConfig['external'] = device.external;
89
77
  }
90
- if (device.disablePushOn !== undefined) {
91
- config['disablePushOn'] = device.disablePushOn;
92
- }
93
- if (device.disablePushOff !== undefined) {
94
- config['disablePushOff'] = device.disablePushOff;
95
- }
96
- if (device.disablePushDetail !== undefined) {
97
- config['disablePushDetail'] = device.disablePushDetail;
98
- }
99
- if (device.irpur) {
100
- config = device.irpur;
78
+ if (device.customize === true) {
79
+ deviceConfig['customize'] = device.customize;
101
80
  }
102
- if (device.logging !== undefined) {
103
- config['logging'] = device.logging;
81
+ if (device.commandType !== '') {
82
+ deviceConfig['commandType'] = device.commandType;
104
83
  }
105
- if (device.connectionType !== undefined) {
106
- config['connectionType'] = device.connectionType;
84
+ if (device.customOn !== '') {
85
+ deviceConfig['customOn'] = device.customOn;
107
86
  }
108
- if (device.external !== undefined) {
109
- config['external'] = device.external;
87
+ if (device.customOff !== '') {
88
+ deviceConfig['customOff'] = device.customOff;
110
89
  }
111
- if (device.customOn !== undefined) {
112
- config['customOn'] = device.customOn;
90
+ if (device.disablePushOn === true) {
91
+ deviceConfig['disablePushOn'] = device.disablePushOn;
113
92
  }
114
- if (device.customOff !== undefined) {
115
- config['customOff'] = device.customOff;
93
+ if (device.disablePushOff === true) {
94
+ deviceConfig['disablePushOff'] = device.disablePushOff;
116
95
  }
117
- if (device.customize !== undefined) {
118
- config['customize'] = device.customize;
96
+ if (device.disablePushDetail === true) {
97
+ deviceConfig['disablePushDetail'] = device.disablePushDetail;
119
98
  }
120
- if (device.disablePushOn !== undefined) {
121
- config['disablePushOn'] = device.disablePushOn;
99
+ let irairConfig = {};
100
+ if (device.irair) {
101
+ irairConfig = device.irair;
122
102
  }
123
- if (device.disablePushOff !== undefined) {
124
- config['disablePushOff'] = device.disablePushOff;
103
+ let irpurConfig = {};
104
+ if (device.irpur) {
105
+ irpurConfig = device.irpur;
125
106
  }
107
+ let ircamConfig = {};
126
108
  if (device.ircam) {
127
- config = device.ircam;
128
- }
129
- if (device.logging !== undefined) {
130
- config['logging'] = device.logging;
131
- }
132
- if (device.connectionType !== undefined) {
133
- config['connectionType'] = device.connectionType;
134
- }
135
- if (device.external !== undefined) {
136
- config['external'] = device.external;
137
- }
138
- if (device.customOn !== undefined) {
139
- config['customOn'] = device.customOn;
140
- }
141
- if (device.customOff !== undefined) {
142
- config['customOff'] = device.customOff;
143
- }
144
- if (device.customize !== undefined) {
145
- config['customize'] = device.customize;
146
- }
147
- if (device.disablePushOn !== undefined) {
148
- config['disablePushOn'] = device.disablePushOn;
149
- }
150
- if (device.disablePushOff !== undefined) {
151
- config['disablePushOff'] = device.disablePushOff;
109
+ ircamConfig = device.ircam;
152
110
  }
111
+ let irfanConfig = {};
153
112
  if (device.irfan) {
154
- config = device.irfan;
155
- }
156
- if (device.logging !== undefined) {
157
- config['logging'] = device.logging;
158
- }
159
- if (device.connectionType !== undefined) {
160
- config['connectionType'] = device.connectionType;
161
- }
162
- if (device.external !== undefined) {
163
- config['external'] = device.external;
164
- }
165
- if (device.customOn !== undefined) {
166
- config['customOn'] = device.customOn;
167
- }
168
- if (device.customOff !== undefined) {
169
- config['customOff'] = device.customOff;
170
- }
171
- if (device.customize !== undefined) {
172
- config['customize'] = device.customize;
173
- }
174
- if (device.disablePushOn !== undefined) {
175
- config['disablePushOn'] = device.disablePushOn;
176
- }
177
- if (device.disablePushOff !== undefined) {
178
- config['disablePushOff'] = device.disablePushOff;
113
+ irfanConfig = device.irfan;
179
114
  }
115
+ let irlightConfig = {};
180
116
  if (device.irlight) {
181
- config = device.irlight;
182
- }
183
- if (device.logging !== undefined) {
184
- config['logging'] = device.logging;
185
- }
186
- if (device.connectionType !== undefined) {
187
- config['connectionType'] = device.connectionType;
188
- }
189
- if (device.external !== undefined) {
190
- config['external'] = device.external;
191
- }
192
- if (device.customOn !== undefined) {
193
- config['customOn'] = device.customOn;
194
- }
195
- if (device.customOff !== undefined) {
196
- config['customOff'] = device.customOff;
197
- }
198
- if (device.customize !== undefined) {
199
- config['customize'] = device.customize;
200
- }
201
- if (device.disablePushOn !== undefined) {
202
- config['disablePushOn'] = device.disablePushOn;
203
- }
204
- if (device.disablePushOff !== undefined) {
205
- config['disablePushOff'] = device.disablePushOff;
117
+ irlightConfig = device.irlight;
206
118
  }
119
+ let otherConfig = {};
207
120
  if (device.other) {
208
- config = device.other;
209
- }
210
- if (device.logging !== undefined) {
211
- config['logging'] = device.logging;
212
- }
213
- if (device.connectionType !== undefined) {
214
- config['connectionType'] = device.connectionType;
215
- }
216
- if (device.external !== undefined) {
217
- config['external'] = device.external;
218
- }
219
- if (device.customOn !== undefined) {
220
- config['customOn'] = device.customOn;
221
- }
222
- if (device.customOff !== undefined) {
223
- config['customOff'] = device.customOff;
224
- }
225
- if (device.customize !== undefined) {
226
- config['customize'] = device.customize;
227
- }
228
- if (device.disablePushOn !== undefined) {
229
- config['disablePushOn'] = device.disablePushOn;
230
- }
231
- if (device.disablePushOff !== undefined) {
232
- config['disablePushOff'] = device.disablePushOff;
121
+ otherConfig = device.other;
233
122
  }
123
+ let irtvConfig = {};
234
124
  if (device.irtv) {
235
- config = device.irtv;
236
- }
237
- if (device.logging !== undefined) {
238
- config['logging'] = device.logging;
239
- }
240
- if (device.connectionType !== undefined) {
241
- config['connectionType'] = device.connectionType;
242
- }
243
- if (device.external !== undefined) {
244
- config['external'] = device.external;
245
- }
246
- if (device.customOn !== undefined) {
247
- config['customOn'] = device.customOn;
248
- }
249
- if (device.customOff !== undefined) {
250
- config['customOff'] = device.customOff;
251
- }
252
- if (device.customize !== undefined) {
253
- config['customize'] = device.customize;
254
- }
255
- if (device.disablePushOn !== undefined) {
256
- config['disablePushOn'] = device.disablePushOn;
257
- }
258
- if (device.disablePushOff !== undefined) {
259
- config['disablePushOff'] = device.disablePushOff;
260
- }
261
- if (device.disablePushDetail !== undefined) {
262
- config['disablePushDetail'] = device.disablePushDetail;
125
+ irtvConfig = device.irtv;
263
126
  }
127
+ let irvcConfig = {};
264
128
  if (device.irvc) {
265
- config = device.irvc;
266
- }
267
- if (device.logging !== undefined) {
268
- config['logging'] = device.logging;
269
- }
270
- if (device.connectionType !== undefined) {
271
- config['connectionType'] = device.connectionType;
272
- }
273
- if (device.external !== undefined) {
274
- config['external'] = device.external;
275
- }
276
- if (device.customOn !== undefined) {
277
- config['customOn'] = device.customOn;
278
- }
279
- if (device.customOff !== undefined) {
280
- config['customOff'] = device.customOff;
281
- }
282
- if (device.customize !== undefined) {
283
- config['customize'] = device.customize;
284
- }
285
- if (device.disablePushOn !== undefined) {
286
- config['disablePushOn'] = device.disablePushOn;
287
- }
288
- if (device.disablePushOff !== undefined) {
289
- config['disablePushOff'] = device.disablePushOff;
129
+ irvcConfig = device.irvc;
290
130
  }
131
+ let irwhConfig = {};
291
132
  if (device.irwh) {
292
- config = device.irwh;
293
- }
294
- if (device.logging !== undefined) {
295
- config['logging'] = device.logging;
296
- }
297
- if (device.connectionType !== undefined) {
298
- config['connectionType'] = device.connectionType;
299
- }
300
- if (device.external !== undefined) {
301
- config['external'] = device.external;
302
- }
303
- if (device.customOn !== undefined) {
304
- config['customOn'] = device.customOn;
305
- }
306
- if (device.customOff !== undefined) {
307
- config['customOff'] = device.customOff;
308
- }
309
- if (device.customize !== undefined) {
310
- config['customize'] = device.customize;
311
- }
312
- if (device.disablePushOn !== undefined) {
313
- config['disablePushOn'] = device.disablePushOn;
314
- }
315
- if (device.disablePushOff !== undefined) {
316
- config['disablePushOff'] = device.disablePushOff;
133
+ irwhConfig = device.irwh;
317
134
  }
135
+ const config = Object.assign({}, deviceConfig, irairConfig, irpurConfig, ircamConfig, irfanConfig, irlightConfig, otherConfig,
136
+ irtvConfig, irvcConfig, irwhConfig);
318
137
  if (Object.entries(config).length !== 0) {
319
- this.infoLog(`Lock: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
138
+ this.debugSuccessLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
320
139
  }
321
140
  }
322
141