homebridge-nest-accfactory 0.0.6 → 0.2.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.
- package/CHANGELOG.md +37 -3
- package/README.md +37 -19
- package/dist/HomeKitDevice.js +132 -109
- package/dist/camera.js +344 -263
- package/dist/doorbell.js +5 -3
- package/dist/floodlight.js +3 -3
- package/dist/nexustalk.js +62 -36
- package/dist/protect.js +2 -2
- package/dist/protobuf/googlehome/foyer.proto +216 -160
- package/dist/res/Nest_camera_connecting.h264 +0 -0
- package/dist/res/Nest_camera_off.h264 +0 -0
- package/dist/res/Nest_camera_offline.h264 +0 -0
- package/dist/res/Nest_camera_transfer.h264 +0 -0
- package/dist/streamer.js +78 -37
- package/dist/system.js +1321 -1263
- package/dist/thermostat.js +73 -27
- package/dist/webrtc.js +582 -0
- package/package.json +31 -29
package/dist/thermostat.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Nest Thermostat
|
|
2
2
|
// Part of homebridge-nest-accfactory
|
|
3
3
|
//
|
|
4
|
-
// Code version
|
|
4
|
+
// Code version 3/10/2024
|
|
5
5
|
// Mark Hulskamp
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
@@ -204,19 +204,35 @@ export default class NestThermostat extends HomeKitDevice {
|
|
|
204
204
|
if (this.fanService === undefined) {
|
|
205
205
|
this.fanService = this.accessory.addService(this.hap.Service.Fanv2, '', 1);
|
|
206
206
|
}
|
|
207
|
+
if (this.fanService.testCharacteristic(this.hap.Characteristic.RotationSpeed) === false) {
|
|
208
|
+
this.fanService.addCharacteristic(this.hap.Characteristic.RotationSpeed);
|
|
209
|
+
}
|
|
210
|
+
this.fanService.getCharacteristic(this.hap.Characteristic.RotationSpeed).setProps({
|
|
211
|
+
minStep: 100 / this.deviceData.fan_max_speed,
|
|
212
|
+
});
|
|
213
|
+
|
|
207
214
|
this.thermostatService.addLinkedService(this.fanService);
|
|
208
215
|
|
|
209
216
|
this.fanService.getCharacteristic(this.hap.Characteristic.Active).onSet((value) => {
|
|
210
|
-
this.setFan(
|
|
217
|
+
this.setFan(
|
|
218
|
+
value,
|
|
219
|
+
value === this.hap.Characteristic.Active.ACTIVE ? (this.deviceData.fan_timer_speed / this.deviceData.fan_max_speed) * 100 : 0,
|
|
220
|
+
);
|
|
221
|
+
});
|
|
222
|
+
this.fanService.getCharacteristic(this.hap.Characteristic.RotationSpeed).onSet((value) => {
|
|
223
|
+
this.setFan(value !== 0 ? this.hap.Characteristic.Active.ACTIVE : this.hap.Characteristic.Active.INACTIVE, value);
|
|
211
224
|
});
|
|
212
225
|
this.fanService.getCharacteristic(this.hap.Characteristic.Active).onGet(() => {
|
|
213
226
|
return this.deviceData.fan_state === true ? this.hap.Characteristic.Active.ACTIVE : this.hap.Characteristic.Active.INACTIVE;
|
|
214
227
|
});
|
|
228
|
+
this.fanService.getCharacteristic(this.hap.Characteristic.RotationSpeed).onGet(() => {
|
|
229
|
+
return (this.deviceData.fan_timer_speed / this.deviceData.fan_max_speed) * 100;
|
|
230
|
+
});
|
|
215
231
|
}
|
|
216
232
|
if (this.deviceData?.has_fan === false && this.fanService !== undefined) {
|
|
217
233
|
// No longer have a Fan configured and service present, so removed it
|
|
218
234
|
this.accessory.removeService(this.fanService);
|
|
219
|
-
this.fanService
|
|
235
|
+
this.fanService = undefined;
|
|
220
236
|
}
|
|
221
237
|
|
|
222
238
|
// Setup dehumifider service if supported by the thermostat and not already present on the accessory
|
|
@@ -313,20 +329,33 @@ export default class NestThermostat extends HomeKitDevice {
|
|
|
313
329
|
return postSetupDetails;
|
|
314
330
|
}
|
|
315
331
|
|
|
316
|
-
setFan(fanState) {
|
|
317
|
-
|
|
318
|
-
|
|
332
|
+
setFan(fanState, speed) {
|
|
333
|
+
if (
|
|
334
|
+
fanState !== this.fanService.getCharacteristic(this.hap.Characteristic.Active).value ||
|
|
335
|
+
speed !== this.fanService.getCharacteristic(this.hap.Characteristic.RotationSpeed).value
|
|
336
|
+
) {
|
|
337
|
+
this.set({
|
|
338
|
+
uuid: this.deviceData.nest_google_uuid,
|
|
339
|
+
fan_state: fanState === this.hap.Characteristic.Active.ACTIVE ? true : false,
|
|
340
|
+
fan_timer_speed: Math.round((speed / 100) * this.deviceData.fan_max_speed),
|
|
341
|
+
});
|
|
342
|
+
this.fanService.updateCharacteristic(this.hap.Characteristic.Active, fanState);
|
|
343
|
+
this.fanService.updateCharacteristic(this.hap.Characteristic.RotationSpeed, speed);
|
|
319
344
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
345
|
+
this?.log?.info &&
|
|
346
|
+
this.log.info(
|
|
347
|
+
'Set fan on thermostat "%s" to "%s"',
|
|
348
|
+
this.deviceData.description,
|
|
349
|
+
fanState === this.hap.Characteristic.Active.ACTIVE ? 'On with fan speed of ' + speed + '%' : 'Off',
|
|
350
|
+
);
|
|
351
|
+
}
|
|
326
352
|
}
|
|
327
353
|
|
|
328
354
|
setDehumidifier(dehumidiferState) {
|
|
329
|
-
this.set({
|
|
355
|
+
this.set({
|
|
356
|
+
uuid: this.deviceData.nest_google_uuid,
|
|
357
|
+
dehumidifer_State: dehumidiferState === this.hap.Characteristic.Active.ACTIVE ? true : false,
|
|
358
|
+
});
|
|
330
359
|
this.dehumidifierService.updateCharacteristic(this.hap.Characteristic.Active, dehumidiferState);
|
|
331
360
|
|
|
332
361
|
this?.log?.info &&
|
|
@@ -340,7 +369,10 @@ export default class NestThermostat extends HomeKitDevice {
|
|
|
340
369
|
}
|
|
341
370
|
|
|
342
371
|
setDisplayUnit(temperatureUnit) {
|
|
343
|
-
this.set({
|
|
372
|
+
this.set({
|
|
373
|
+
uuid: this.deviceData.nest_google_uuid,
|
|
374
|
+
temperature_scale: temperatureUnit === this.hap.Characteristic.TemperatureDisplayUnits.CELSIUS ? 'C' : 'F',
|
|
375
|
+
});
|
|
344
376
|
this.thermostatService.updateCharacteristic(this.hap.Characteristic.TemperatureDisplayUnits, temperatureUnit);
|
|
345
377
|
|
|
346
378
|
this?.log?.info &&
|
|
@@ -412,7 +444,7 @@ export default class NestThermostat extends HomeKitDevice {
|
|
|
412
444
|
mode = 'range';
|
|
413
445
|
}
|
|
414
446
|
|
|
415
|
-
this.set({ hvac_mode: mode });
|
|
447
|
+
this.set({ uuid: this.deviceData.nest_google_uuid, hvac_mode: mode });
|
|
416
448
|
|
|
417
449
|
this?.log?.info && this.log.info('Set mode on "%s" to "%s"', this.deviceData.description, mode);
|
|
418
450
|
}
|
|
@@ -448,7 +480,7 @@ export default class NestThermostat extends HomeKitDevice {
|
|
|
448
480
|
this.thermostatService.getCharacteristic(this.hap.Characteristic.TargetHeatingCoolingState).value !==
|
|
449
481
|
this.hap.Characteristic.TargetHeatingCoolingState.AUTO
|
|
450
482
|
) {
|
|
451
|
-
this.set({ target_temperature: temperature });
|
|
483
|
+
this.set({ uuid: this.deviceData.nest_google_uuid, target_temperature: temperature });
|
|
452
484
|
|
|
453
485
|
this?.log?.info &&
|
|
454
486
|
this.log.info(
|
|
@@ -467,7 +499,7 @@ export default class NestThermostat extends HomeKitDevice {
|
|
|
467
499
|
this.thermostatService.getCharacteristic(this.hap.Characteristic.TargetHeatingCoolingState).value ===
|
|
468
500
|
this.hap.Characteristic.TargetHeatingCoolingState.AUTO
|
|
469
501
|
) {
|
|
470
|
-
this.set({ target_temperature_low: temperature });
|
|
502
|
+
this.set({ uuid: this.deviceData.nest_google_uuid, target_temperature_low: temperature });
|
|
471
503
|
|
|
472
504
|
this?.log?.info &&
|
|
473
505
|
this.log.info(
|
|
@@ -482,7 +514,7 @@ export default class NestThermostat extends HomeKitDevice {
|
|
|
482
514
|
this.thermostatService.getCharacteristic(this.hap.Characteristic.TargetHeatingCoolingState).value ===
|
|
483
515
|
this.hap.Characteristic.TargetHeatingCoolingState.AUTO
|
|
484
516
|
) {
|
|
485
|
-
this.set({ target_temperature_high: temperature });
|
|
517
|
+
this.set({ uuid: this.deviceData.nest_google_uuid, target_temperature_high: temperature });
|
|
486
518
|
|
|
487
519
|
this?.log?.info &&
|
|
488
520
|
this.log.info(
|
|
@@ -533,7 +565,10 @@ export default class NestThermostat extends HomeKitDevice {
|
|
|
533
565
|
if (value === this.hap.Characteristic.LockPhysicalControls.CONTROL_LOCK_DISABLED) {
|
|
534
566
|
// Clear pin hash????
|
|
535
567
|
}
|
|
536
|
-
this.set({
|
|
568
|
+
this.set({
|
|
569
|
+
uuid: this.deviceData.nest_google_uuid,
|
|
570
|
+
temperature_lock: value === this.hap.Characteristic.LockPhysicalControls.CONTROL_LOCK_ENABLED ? true : false,
|
|
571
|
+
});
|
|
537
572
|
|
|
538
573
|
this?.log?.info &&
|
|
539
574
|
this.log.info(
|
|
@@ -639,6 +674,13 @@ export default class NestThermostat extends HomeKitDevice {
|
|
|
639
674
|
if (deviceData.has_fan === true && this.deviceData.has_fan === false && this.fanService === undefined) {
|
|
640
675
|
// Fan has been added
|
|
641
676
|
this.fanService = this.accessory.addService(this.hap.Service.Fanv2, '', 1);
|
|
677
|
+
|
|
678
|
+
if (this.fanService.testCharacteristic(this.hap.Characteristic.RotationSpeed) === false) {
|
|
679
|
+
this.fanService.addCharacteristic(this.hap.Characteristic.RotationSpeed);
|
|
680
|
+
}
|
|
681
|
+
this.fanService.getCharacteristic(this.hap.Characteristic.RotationSpeed).setProps({
|
|
682
|
+
minStep: 100 / this.deviceData.fan_max_speed,
|
|
683
|
+
});
|
|
642
684
|
this.thermostatService.addLinkedService(this.fanService);
|
|
643
685
|
|
|
644
686
|
this.fanService.getCharacteristic(this.hap.Characteristic.Active).onSet((value) => {
|
|
@@ -868,8 +910,12 @@ export default class NestThermostat extends HomeKitDevice {
|
|
|
868
910
|
this.externalFan.off();
|
|
869
911
|
}
|
|
870
912
|
}
|
|
871
|
-
|
|
872
|
-
|
|
913
|
+
|
|
914
|
+
this.fanService.updateCharacteristic(
|
|
915
|
+
this.hap.Characteristic.RotationSpeed,
|
|
916
|
+
deviceData.fan_state === true ? (deviceData.fan_timer_speed / deviceData.fan_max_speed) * 100 : 0,
|
|
917
|
+
);
|
|
918
|
+
|
|
873
919
|
this.fanService.updateCharacteristic(
|
|
874
920
|
this.hap.Characteristic.Active,
|
|
875
921
|
deviceData.fan_state === true ? this.hap.Characteristic.Active.ACTIVE : this.hap.Characteristic.Active.INACTIVE,
|
|
@@ -883,7 +929,7 @@ export default class NestThermostat extends HomeKitDevice {
|
|
|
883
929
|
this.externalDehumidifier !== undefined
|
|
884
930
|
) {
|
|
885
931
|
// Dehumidifier mode was switched on and external dehumidifier external code is being used
|
|
886
|
-
// Start dehumidifier via
|
|
932
|
+
// Start dehumidifier via dehumidifier external code
|
|
887
933
|
if (typeof this.externalDehumidifier.dehumififier === 'function') {
|
|
888
934
|
this.externalDehumidifier.dehumififier(0);
|
|
889
935
|
}
|
|
@@ -1013,13 +1059,13 @@ export default class NestThermostat extends HomeKitDevice {
|
|
|
1013
1059
|
}
|
|
1014
1060
|
|
|
1015
1061
|
if (typeof EveHomeSetData?.vacation === 'boolean') {
|
|
1016
|
-
this.set({ vacation_mode: EveHomeSetData.vacation.status });
|
|
1062
|
+
this.set({ uuid: this.deviceData.nest_google_uuid, vacation_mode: EveHomeSetData.vacation.status });
|
|
1017
1063
|
}
|
|
1018
1064
|
if (typeof EveHomeSetData?.programs === 'object') {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1065
|
+
//EveHomeSetData.programs.forEach((day) => {
|
|
1066
|
+
// Convert into Nest thermostat schedule format and set. Need to work this out
|
|
1067
|
+
// this.set({ uuid: this.deviceData.nest_google_uuid, days: { 6: { temp: 17, time: 13400, touched_at: Date.now() } } });
|
|
1068
|
+
//});
|
|
1023
1069
|
}
|
|
1024
1070
|
}
|
|
1025
1071
|
}
|