homebridge-lg-thinq-2 2.0.18 → 2.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +1 -1
- package/config.schema.json +119 -60
- package/dist/devices/AirConditioner.js +20 -3
- package/homebridge-ui/public/index.html +14 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## v2.0.19
|
|
4
|
+
|
|
5
|
+
### Homebridge UI
|
|
6
|
+
|
|
7
|
+
* Cleaner device settings: one heading per device type ("Washer and dryer options", "Air conditioner options", and so on) with a separator line, instead of a "Device Settings" title plus a "specific settings" title and a description.
|
|
8
|
+
* Every option has a short name and a one-line explanation, for example **Program finished sensor** instead of "Enable program finished trigger?".
|
|
9
|
+
* Air conditioner: the three lists come first and show the mode in use (both heating and cooling, both swing directions, Celsius) instead of "None". The **Display light switch** option, which was missing from the form, is shown.
|
|
10
|
+
* Air conditioner **Mode buttons**: explained, with a list of modes (Cool, Dry, Fan, Heat, Air clean, Auto) instead of a number field. The empty row the form always shows is not saved.
|
|
11
|
+
|
|
12
|
+
### Air conditioner
|
|
13
|
+
|
|
14
|
+
* Mode buttons without a name or a mode are skipped, so an empty row in the settings no longer creates an unnamed switch.
|
|
15
|
+
|
|
3
16
|
## v2.0.18
|
|
4
17
|
|
|
5
18
|
### Homebridge UI
|
package/README.md
CHANGED
|
@@ -206,7 +206,7 @@ Every device entry accepts `id` (required), `name`, and `serial_number`. The opt
|
|
|
206
206
|
| `ac_jet_control` | `false` | Add a switch for jet mode. |
|
|
207
207
|
| `ac_energy_save` | `true` | Add a switch for energy saving. |
|
|
208
208
|
| `ac_air_clean` | `true` | Add a switch for air purification. |
|
|
209
|
-
| `ac_buttons` | `[]` |
|
|
209
|
+
| `ac_buttons` | `[]` | Mode buttons: a switch for each entry, as `{ "name": "...", "op_mode": number }`, where `op_mode` is 0 cool, 1 dry, 2 fan, 4 heat, 5 air clean, or 6 auto. Turning a switch on sets that mode; turning it off goes back to cooling. Entries without a name or mode are ignored. |
|
|
210
210
|
|
|
211
211
|
#### Washer and Dryer
|
|
212
212
|
|
package/config.schema.json
CHANGED
|
@@ -100,28 +100,32 @@
|
|
|
100
100
|
"type": "string"
|
|
101
101
|
},
|
|
102
102
|
"dishwasher_trigger": {
|
|
103
|
-
"title": "
|
|
104
|
-
"type": "boolean"
|
|
103
|
+
"title": "Program finished sensor",
|
|
104
|
+
"type": "boolean",
|
|
105
|
+
"description": "Adds an occupancy sensor that turns on when a program finishes. Use it in a HomeKit automation, for example to get a notification."
|
|
105
106
|
},
|
|
106
107
|
"washer_tub_clean": {
|
|
107
|
-
"title": "
|
|
108
|
-
"type": "boolean"
|
|
108
|
+
"title": "Tub clean reminder",
|
|
109
|
+
"type": "boolean",
|
|
110
|
+
"description": "Adds an occupancy sensor that turns on when the washer recommends a tub clean."
|
|
109
111
|
},
|
|
110
112
|
"washer_trigger": {
|
|
111
|
-
"title": "
|
|
112
|
-
"type": "boolean"
|
|
113
|
+
"title": "Program finished sensor",
|
|
114
|
+
"type": "boolean",
|
|
115
|
+
"description": "Adds an occupancy sensor that turns on when a program finishes. Use it in a HomeKit automation, for example to get a notification."
|
|
113
116
|
},
|
|
114
117
|
"washer_door_lock": {
|
|
115
|
-
"title": "
|
|
116
|
-
"type": "boolean"
|
|
118
|
+
"title": "Door lock status",
|
|
119
|
+
"type": "boolean",
|
|
120
|
+
"description": "Shows whether the door is locked, as a lock in HomeKit. Only for models that report it."
|
|
117
121
|
},
|
|
118
122
|
"ac_air_quality": {
|
|
119
|
-
"title": "
|
|
120
|
-
"description": "if
|
|
123
|
+
"title": "Air quality sensor",
|
|
124
|
+
"description": "Adds an air quality sensor, if the air conditioner has one.",
|
|
121
125
|
"type": "boolean"
|
|
122
126
|
},
|
|
123
127
|
"ac_mode": {
|
|
124
|
-
"title": "
|
|
128
|
+
"title": "Modes shown in HomeKit",
|
|
125
129
|
"type": "string",
|
|
126
130
|
"oneOf": [
|
|
127
131
|
{
|
|
@@ -145,7 +149,7 @@
|
|
|
145
149
|
]
|
|
146
150
|
},
|
|
147
151
|
"ac_swing_mode": {
|
|
148
|
-
"title": "Swing
|
|
152
|
+
"title": "Swing control",
|
|
149
153
|
"type": "string",
|
|
150
154
|
"oneOf": [
|
|
151
155
|
{
|
|
@@ -175,50 +179,98 @@
|
|
|
175
179
|
]
|
|
176
180
|
},
|
|
177
181
|
"ac_temperature_sensor": {
|
|
178
|
-
"title": "
|
|
179
|
-
"type": "boolean"
|
|
182
|
+
"title": "Temperature sensor",
|
|
183
|
+
"type": "boolean",
|
|
184
|
+
"description": "Adds the current room temperature as a separate sensor."
|
|
180
185
|
},
|
|
181
186
|
"ac_humidity_sensor": {
|
|
182
|
-
"title": "
|
|
183
|
-
"type": "boolean"
|
|
187
|
+
"title": "Humidity sensor",
|
|
188
|
+
"type": "boolean",
|
|
189
|
+
"description": "Adds a humidity sensor, if the air conditioner reports humidity."
|
|
184
190
|
},
|
|
185
191
|
"ac_led_control": {
|
|
186
|
-
"title": "
|
|
187
|
-
"type": "boolean"
|
|
192
|
+
"title": "Display light switch",
|
|
193
|
+
"type": "boolean",
|
|
194
|
+
"description": "Adds a switch to turn the display light on and off."
|
|
188
195
|
},
|
|
189
196
|
"ac_fan_control": {
|
|
190
|
-
"title": "
|
|
191
|
-
"type": "boolean"
|
|
197
|
+
"title": "Separate fan control",
|
|
198
|
+
"type": "boolean",
|
|
199
|
+
"description": "Adds a fan to control the fan speed separately from the air conditioner."
|
|
192
200
|
},
|
|
193
201
|
"ac_jet_control": {
|
|
194
|
-
"title": "
|
|
195
|
-
"type": "boolean"
|
|
202
|
+
"title": "Jet mode switch",
|
|
203
|
+
"type": "boolean",
|
|
204
|
+
"description": "Adds a switch for jet mode, on models that support it."
|
|
196
205
|
},
|
|
197
206
|
"ac_buttons": {
|
|
198
|
-
"title": "
|
|
207
|
+
"title": "Mode buttons",
|
|
199
208
|
"type": "array",
|
|
200
209
|
"items": {
|
|
201
210
|
"type": "object",
|
|
202
211
|
"properties": {
|
|
203
212
|
"name": {
|
|
204
|
-
"
|
|
213
|
+
"title": "Button name",
|
|
214
|
+
"type": "string",
|
|
215
|
+
"description": "The name of the switch in HomeKit, for example \"Dry mode\". Leave empty if you do not want mode buttons."
|
|
205
216
|
},
|
|
206
217
|
"op_mode": {
|
|
207
|
-
"
|
|
218
|
+
"title": "Mode",
|
|
219
|
+
"type": "integer",
|
|
220
|
+
"oneOf": [
|
|
221
|
+
{
|
|
222
|
+
"title": "Cool",
|
|
223
|
+
"enum": [
|
|
224
|
+
0
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"title": "Dry",
|
|
229
|
+
"enum": [
|
|
230
|
+
1
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"title": "Fan",
|
|
235
|
+
"enum": [
|
|
236
|
+
2
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"title": "Heat",
|
|
241
|
+
"enum": [
|
|
242
|
+
4
|
|
243
|
+
]
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"title": "Air clean",
|
|
247
|
+
"enum": [
|
|
248
|
+
5
|
|
249
|
+
]
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"title": "Auto",
|
|
253
|
+
"enum": [
|
|
254
|
+
6
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
]
|
|
208
258
|
}
|
|
209
259
|
}
|
|
210
260
|
}
|
|
211
261
|
},
|
|
212
262
|
"ac_energy_save": {
|
|
213
|
-
"title": "Energy
|
|
214
|
-
"type": "boolean"
|
|
263
|
+
"title": "Energy saving switch",
|
|
264
|
+
"type": "boolean",
|
|
265
|
+
"description": "Adds a switch for energy saving mode, on models that support it."
|
|
215
266
|
},
|
|
216
267
|
"ac_air_clean": {
|
|
217
|
-
"title": "Air
|
|
218
|
-
"type": "boolean"
|
|
268
|
+
"title": "Air purification switch",
|
|
269
|
+
"type": "boolean",
|
|
270
|
+
"description": "Adds a switch for air purification, on models that support it."
|
|
219
271
|
},
|
|
220
272
|
"ac_temperature_unit": {
|
|
221
|
-
"title": "Temperature
|
|
273
|
+
"title": "Temperature unit",
|
|
222
274
|
"type": "string",
|
|
223
275
|
"oneOf": [
|
|
224
276
|
{
|
|
@@ -233,23 +285,28 @@
|
|
|
233
285
|
"F"
|
|
234
286
|
]
|
|
235
287
|
}
|
|
236
|
-
]
|
|
288
|
+
],
|
|
289
|
+
"description": "The unit the air conditioner uses."
|
|
237
290
|
},
|
|
238
291
|
"ref_express_freezer": {
|
|
239
|
-
"title": "Express Freezer / Ice Plus",
|
|
240
|
-
"type": "boolean"
|
|
292
|
+
"title": "Express Freezer / Ice Plus switch",
|
|
293
|
+
"type": "boolean",
|
|
294
|
+
"description": "Adds a switch for Express Freezer or Ice Plus, if the refrigerator has it."
|
|
241
295
|
},
|
|
242
296
|
"ref_express_fridge": {
|
|
243
|
-
"title": "Express Fridge",
|
|
244
|
-
"type": "boolean"
|
|
297
|
+
"title": "Express Fridge switch",
|
|
298
|
+
"type": "boolean",
|
|
299
|
+
"description": "Adds a switch for Express Fridge, if the refrigerator has it."
|
|
245
300
|
},
|
|
246
301
|
"ref_eco_friendly": {
|
|
247
|
-
"title": "Eco Friendly",
|
|
248
|
-
"type": "boolean"
|
|
302
|
+
"title": "Eco Friendly switch",
|
|
303
|
+
"type": "boolean",
|
|
304
|
+
"description": "Adds a switch for Eco Friendly mode, if the refrigerator has it."
|
|
249
305
|
},
|
|
250
306
|
"air_fast_mode": {
|
|
251
|
-
"title": "
|
|
252
|
-
"type": "boolean"
|
|
307
|
+
"title": "Fast mode switch",
|
|
308
|
+
"type": "boolean",
|
|
309
|
+
"description": "Adds a switch for the fast mode of the air purifier."
|
|
253
310
|
}
|
|
254
311
|
}
|
|
255
312
|
}
|
|
@@ -288,23 +345,21 @@
|
|
|
288
345
|
{
|
|
289
346
|
"key": "devices[]",
|
|
290
347
|
"type": "fieldset",
|
|
291
|
-
"title": "Device Settings",
|
|
292
348
|
"items": [
|
|
293
349
|
{
|
|
294
350
|
"type": "fieldset",
|
|
295
|
-
"title": "Air purifier
|
|
296
|
-
"description": "Configure air purifier device settings.",
|
|
351
|
+
"title": "Air purifier options",
|
|
297
352
|
"items": [
|
|
298
353
|
"devices[].air_fast_mode"
|
|
299
354
|
],
|
|
300
355
|
"condition": {
|
|
301
356
|
"functionBody": "return model.devices && model.devices[arrayIndices] && ['AIR_PURIFIER'].includes(model.devices[arrayIndices].type);"
|
|
302
|
-
}
|
|
357
|
+
},
|
|
358
|
+
"htmlClass": "border-top mt-4 pt-3"
|
|
303
359
|
},
|
|
304
360
|
{
|
|
305
361
|
"type": "fieldset",
|
|
306
|
-
"title": "Washer
|
|
307
|
-
"description": "Configure washer/dryer device settings.",
|
|
362
|
+
"title": "Washer and dryer options",
|
|
308
363
|
"items": [
|
|
309
364
|
"devices[].washer_trigger",
|
|
310
365
|
"devices[].washer_tub_clean",
|
|
@@ -312,43 +367,46 @@
|
|
|
312
367
|
],
|
|
313
368
|
"condition": {
|
|
314
369
|
"functionBody": "return model.devices && model.devices[arrayIndices] && ['WASHER','WASHER_NEW', 'WASH_TOWER', 'DRYER', 'WASH_TOWER_2'].includes(model.devices[arrayIndices].type);"
|
|
315
|
-
}
|
|
370
|
+
},
|
|
371
|
+
"htmlClass": "border-top mt-4 pt-3"
|
|
316
372
|
},
|
|
317
373
|
{
|
|
318
374
|
"type": "fieldset",
|
|
319
|
-
"title": "Air conditioner
|
|
320
|
-
"description": "Configure AC device settings.",
|
|
375
|
+
"title": "Air conditioner options",
|
|
321
376
|
"items": [
|
|
322
|
-
"devices[].ac_air_quality",
|
|
323
377
|
"devices[].ac_mode",
|
|
324
378
|
"devices[].ac_swing_mode",
|
|
379
|
+
"devices[].ac_temperature_unit",
|
|
380
|
+
"devices[].ac_air_quality",
|
|
325
381
|
"devices[].ac_temperature_sensor",
|
|
326
382
|
"devices[].ac_humidity_sensor",
|
|
383
|
+
"devices[].ac_led_control",
|
|
327
384
|
"devices[].ac_fan_control",
|
|
328
385
|
"devices[].ac_jet_control",
|
|
329
386
|
"devices[].ac_energy_save",
|
|
330
387
|
"devices[].ac_air_clean",
|
|
331
|
-
"devices[].ac_temperature_unit",
|
|
332
388
|
{
|
|
333
389
|
"key": "devices[].ac_buttons",
|
|
334
|
-
"title": "
|
|
335
|
-
"description": "
|
|
390
|
+
"title": "Mode buttons",
|
|
391
|
+
"description": "Adds a switch for each mode you list. Turning a switch on sets the air conditioner to that mode; turning it off goes back to cooling.",
|
|
336
392
|
"type": "array",
|
|
337
393
|
"buttonText": "Add button",
|
|
338
394
|
"items": [
|
|
339
395
|
"devices[].ac_buttons[].name",
|
|
340
396
|
"devices[].ac_buttons[].op_mode"
|
|
341
|
-
]
|
|
397
|
+
],
|
|
398
|
+
"listItems": 0,
|
|
399
|
+
"htmlClass": "mt-3"
|
|
342
400
|
}
|
|
343
401
|
],
|
|
344
402
|
"condition": {
|
|
345
403
|
"functionBody": "return model.devices && model.devices[arrayIndices] && ['AC'].includes(model.devices[arrayIndices].type);"
|
|
346
|
-
}
|
|
404
|
+
},
|
|
405
|
+
"htmlClass": "border-top mt-4 pt-3"
|
|
347
406
|
},
|
|
348
407
|
{
|
|
349
408
|
"type": "fieldset",
|
|
350
|
-
"title": "Refrigerator
|
|
351
|
-
"description": "Configure refrigerator device settings.",
|
|
409
|
+
"title": "Refrigerator options",
|
|
352
410
|
"items": [
|
|
353
411
|
"devices[].ref_express_freezer",
|
|
354
412
|
"devices[].ref_express_fridge",
|
|
@@ -356,18 +414,19 @@
|
|
|
356
414
|
],
|
|
357
415
|
"condition": {
|
|
358
416
|
"functionBody": "return model.devices && model.devices[arrayIndices] && ['REFRIGERATOR'].includes(model.devices[arrayIndices].type);"
|
|
359
|
-
}
|
|
417
|
+
},
|
|
418
|
+
"htmlClass": "border-top mt-4 pt-3"
|
|
360
419
|
},
|
|
361
420
|
{
|
|
362
421
|
"type": "fieldset",
|
|
363
|
-
"title": "Dishwasher
|
|
364
|
-
"description": "Configure dishwasher device settings.",
|
|
422
|
+
"title": "Dishwasher options",
|
|
365
423
|
"items": [
|
|
366
424
|
"devices[].dishwasher_trigger"
|
|
367
425
|
],
|
|
368
426
|
"condition": {
|
|
369
427
|
"functionBody": "return model.devices && model.devices[arrayIndices] && ['DISHWASHER'].includes(model.devices[arrayIndices].type);"
|
|
370
|
-
}
|
|
428
|
+
},
|
|
429
|
+
"htmlClass": "border-top mt-4 pt-3"
|
|
371
430
|
}
|
|
372
431
|
]
|
|
373
432
|
}
|
|
@@ -307,6 +307,22 @@ export function windStrengthFromRotationSpeed(value) {
|
|
|
307
307
|
const step = Math.min(HOMEKIT_FAN_SPEED_MAX, Math.max(1, Math.round(vNum)));
|
|
308
308
|
return LG_FAN_SPEEDS[step - 1];
|
|
309
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* The mode buttons to create from the `ac_buttons` setting. The settings form always
|
|
312
|
+
* shows one button row, so rows without a name or a mode are skipped.
|
|
313
|
+
*/
|
|
314
|
+
export function modeButtonsFromConfig(buttons) {
|
|
315
|
+
if (!Array.isArray(buttons)) {
|
|
316
|
+
return [];
|
|
317
|
+
}
|
|
318
|
+
return buttons
|
|
319
|
+
.map(button => ({
|
|
320
|
+
name: typeof button?.name === 'string' ? button.name.trim() : '',
|
|
321
|
+
opMode: typeof button?.op_mode === 'number' ? button.op_mode
|
|
322
|
+
: typeof button?.op_mode === 'string' && button.op_mode.trim() !== '' ? Number(button.op_mode) : NaN,
|
|
323
|
+
}))
|
|
324
|
+
.filter(button => button.name !== '' && Number.isInteger(button.opMode));
|
|
325
|
+
}
|
|
310
326
|
export function swingCommandsForMode(value, swingMode) {
|
|
311
327
|
if (!isSwingModeEnabled(swingMode)) {
|
|
312
328
|
return [];
|
|
@@ -1306,7 +1322,8 @@ export default class AirConditioner extends BaseDevice {
|
|
|
1306
1322
|
return this.jetModeModels.includes(model); // cool mode only
|
|
1307
1323
|
}
|
|
1308
1324
|
setupButton(device) {
|
|
1309
|
-
|
|
1325
|
+
const buttons = modeButtonsFromConfig(this.config.ac_buttons);
|
|
1326
|
+
if (!buttons.length) {
|
|
1310
1327
|
return;
|
|
1311
1328
|
}
|
|
1312
1329
|
this.serviceLabelButtons = this.accessory.getService('Buttons')
|
|
@@ -1315,8 +1332,8 @@ export default class AirConditioner extends BaseDevice {
|
|
|
1315
1332
|
for (let i = 0; i < this.serviceLabelButtons.linkedServices.length; i++) {
|
|
1316
1333
|
this.accessory.removeService(this.serviceLabelButtons.linkedServices[i]);
|
|
1317
1334
|
}
|
|
1318
|
-
for (
|
|
1319
|
-
this.setupButtonOpmode(device,
|
|
1335
|
+
for (const button of buttons) {
|
|
1336
|
+
this.setupButtonOpmode(device, button.name, button.opMode);
|
|
1320
1337
|
}
|
|
1321
1338
|
}
|
|
1322
1339
|
setupButtonOpmode(device, name, opMode) {
|
|
@@ -455,11 +455,24 @@
|
|
|
455
455
|
return device;
|
|
456
456
|
}
|
|
457
457
|
|
|
458
|
-
|
|
458
|
+
const next = {
|
|
459
459
|
...device,
|
|
460
460
|
ac_energy_save: typeof device.ac_energy_save === 'boolean' ? device.ac_energy_save : true,
|
|
461
461
|
ac_air_clean: typeof device.ac_air_clean === 'boolean' ? device.ac_air_clean : true,
|
|
462
|
+
// Same defaults as the plugin, so the lists show the mode in use instead of "None".
|
|
463
|
+
ac_mode: device.ac_mode || 'BOTH',
|
|
464
|
+
ac_swing_mode: device.ac_swing_mode || 'BOTH',
|
|
465
|
+
ac_temperature_unit: device.ac_temperature_unit || 'C',
|
|
462
466
|
};
|
|
467
|
+
|
|
468
|
+
// The form always shows one mode button row; do not save it while it is empty.
|
|
469
|
+
if (Array.isArray(next.ac_buttons)) {
|
|
470
|
+
next.ac_buttons = next.ac_buttons.filter(button => button
|
|
471
|
+
&& ((typeof button.name === 'string' && button.name.trim() !== '')
|
|
472
|
+
|| (button.op_mode !== undefined && button.op_mode !== null && button.op_mode !== '')));
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
return next;
|
|
463
476
|
}
|
|
464
477
|
|
|
465
478
|
function pruneDeviceSettingsForType(device, options = {}) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Homebridge LG ThinQ 2",
|
|
3
3
|
"name": "homebridge-lg-thinq-2",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.19",
|
|
5
5
|
"description": "Community-maintained continuation of homebridge-lg-thinq: a Homebridge plugin for controlling/monitoring LG ThinQ devices via the LG ThinQ platform.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"type": "module",
|