homebridge-nest-accfactory 0.0.4-a
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 +27 -0
- package/LICENSE +176 -0
- package/README.md +121 -0
- package/config.schema.json +107 -0
- package/dist/HomeKitDevice.js +441 -0
- package/dist/HomeKitHistory.js +2835 -0
- package/dist/camera.js +1276 -0
- package/dist/doorbell.js +122 -0
- package/dist/index.js +35 -0
- package/dist/nexustalk.js +741 -0
- package/dist/protect.js +240 -0
- package/dist/protobuf/google/rpc/status.proto +91 -0
- package/dist/protobuf/google/rpc/stream_body.proto +26 -0
- package/dist/protobuf/google/trait/product/camera.proto +53 -0
- package/dist/protobuf/googlehome/foyer.proto +208 -0
- package/dist/protobuf/nest/messages.proto +8 -0
- package/dist/protobuf/nest/services/apigateway.proto +107 -0
- package/dist/protobuf/nest/trait/audio.proto +7 -0
- package/dist/protobuf/nest/trait/cellular.proto +313 -0
- package/dist/protobuf/nest/trait/debug.proto +37 -0
- package/dist/protobuf/nest/trait/detector.proto +41 -0
- package/dist/protobuf/nest/trait/diagnostics.proto +87 -0
- package/dist/protobuf/nest/trait/firmware.proto +221 -0
- package/dist/protobuf/nest/trait/guest.proto +105 -0
- package/dist/protobuf/nest/trait/history.proto +345 -0
- package/dist/protobuf/nest/trait/humanlibrary.proto +19 -0
- package/dist/protobuf/nest/trait/hvac.proto +1353 -0
- package/dist/protobuf/nest/trait/input.proto +29 -0
- package/dist/protobuf/nest/trait/lighting.proto +61 -0
- package/dist/protobuf/nest/trait/located.proto +193 -0
- package/dist/protobuf/nest/trait/media.proto +68 -0
- package/dist/protobuf/nest/trait/network.proto +352 -0
- package/dist/protobuf/nest/trait/occupancy.proto +373 -0
- package/dist/protobuf/nest/trait/olive.proto +15 -0
- package/dist/protobuf/nest/trait/pairing.proto +85 -0
- package/dist/protobuf/nest/trait/product/camera.proto +283 -0
- package/dist/protobuf/nest/trait/product/detect.proto +67 -0
- package/dist/protobuf/nest/trait/product/doorbell.proto +18 -0
- package/dist/protobuf/nest/trait/product/guard.proto +59 -0
- package/dist/protobuf/nest/trait/product/protect.proto +344 -0
- package/dist/protobuf/nest/trait/promonitoring.proto +14 -0
- package/dist/protobuf/nest/trait/resourcedirectory.proto +32 -0
- package/dist/protobuf/nest/trait/safety.proto +119 -0
- package/dist/protobuf/nest/trait/security.proto +516 -0
- package/dist/protobuf/nest/trait/selftest.proto +78 -0
- package/dist/protobuf/nest/trait/sensor.proto +291 -0
- package/dist/protobuf/nest/trait/service.proto +46 -0
- package/dist/protobuf/nest/trait/structure.proto +85 -0
- package/dist/protobuf/nest/trait/system.proto +51 -0
- package/dist/protobuf/nest/trait/test.proto +15 -0
- package/dist/protobuf/nest/trait/ui.proto +65 -0
- package/dist/protobuf/nest/trait/user.proto +98 -0
- package/dist/protobuf/nest/trait/voiceassistant.proto +30 -0
- package/dist/protobuf/nestlabs/eventingapi/v1.proto +83 -0
- package/dist/protobuf/nestlabs/gateway/v1.proto +273 -0
- package/dist/protobuf/nestlabs/gateway/v2.proto +96 -0
- package/dist/protobuf/nestlabs/history/v1.proto +73 -0
- package/dist/protobuf/root.proto +64 -0
- package/dist/protobuf/wdl-event-importance.proto +11 -0
- package/dist/protobuf/wdl.proto +450 -0
- package/dist/protobuf/weave/common.proto +144 -0
- package/dist/protobuf/weave/trait/audio.proto +12 -0
- package/dist/protobuf/weave/trait/auth.proto +22 -0
- package/dist/protobuf/weave/trait/description.proto +32 -0
- package/dist/protobuf/weave/trait/heartbeat.proto +38 -0
- package/dist/protobuf/weave/trait/locale.proto +20 -0
- package/dist/protobuf/weave/trait/network.proto +24 -0
- package/dist/protobuf/weave/trait/pairing.proto +8 -0
- package/dist/protobuf/weave/trait/peerdevices.proto +18 -0
- package/dist/protobuf/weave/trait/power.proto +86 -0
- package/dist/protobuf/weave/trait/schedule.proto +76 -0
- package/dist/protobuf/weave/trait/security.proto +343 -0
- package/dist/protobuf/weave/trait/telemetry/tunnel.proto +37 -0
- package/dist/protobuf/weave/trait/time.proto +16 -0
- package/dist/res/Nest_camera_connecting.h264 +0 -0
- package/dist/res/Nest_camera_connecting.jpg +0 -0
- package/dist/res/Nest_camera_off.h264 +0 -0
- package/dist/res/Nest_camera_off.jpg +0 -0
- package/dist/res/Nest_camera_offline.h264 +0 -0
- package/dist/res/Nest_camera_offline.jpg +0 -0
- package/dist/res/Nest_camera_transfer.jpg +0 -0
- package/dist/streamer.js +344 -0
- package/dist/system.js +3112 -0
- package/dist/tempsensor.js +99 -0
- package/dist/thermostat.js +1026 -0
- package/dist/weather.js +205 -0
- package/dist/webrtc.js +55 -0
- package/package.json +66 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Nest Temperature Sensor
|
|
2
|
+
// Part of homebridge-nest-accfactory
|
|
3
|
+
//
|
|
4
|
+
// Code version 27/8/2024
|
|
5
|
+
// Mark Hulskamp
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
// Define our modules
|
|
9
|
+
import HomeKitDevice from './HomeKitDevice.js';
|
|
10
|
+
|
|
11
|
+
const LOWBATTERYLEVEL = 10; // Low battery level percentage
|
|
12
|
+
|
|
13
|
+
export default class NestTemperatureSensor extends HomeKitDevice {
|
|
14
|
+
batteryService = undefined;
|
|
15
|
+
temperatureService = undefined;
|
|
16
|
+
|
|
17
|
+
constructor(accessory, api, log, eventEmitter, deviceData) {
|
|
18
|
+
super(accessory, api, log, eventEmitter, deviceData);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Class functions
|
|
22
|
+
addServices() {
|
|
23
|
+
// Setup the temperature service if not already present on the accessory
|
|
24
|
+
this.temperatureService = this.accessory.getService(this.hap.Service.TemperatureSensor);
|
|
25
|
+
if (this.temperatureService === undefined) {
|
|
26
|
+
this.temperatureService = this.accessory.addService(this.hap.Service.TemperatureSensor, '', 1);
|
|
27
|
+
}
|
|
28
|
+
this.temperatureService.setPrimaryService();
|
|
29
|
+
|
|
30
|
+
// Setup the battery service if not already present on the accessory
|
|
31
|
+
this.batteryService = this.accessory.getService(this.hap.Service.Battery);
|
|
32
|
+
if (this.batteryService === undefined) {
|
|
33
|
+
this.batteryService = this.accessory.addService(this.hap.Service.Battery, '', 1);
|
|
34
|
+
}
|
|
35
|
+
this.batteryService.setHiddenService(true);
|
|
36
|
+
|
|
37
|
+
// Setup linkage to EveHome app if configured todo so
|
|
38
|
+
if (
|
|
39
|
+
this.deviceData?.eveHistory === true &&
|
|
40
|
+
this.temperatureService !== undefined &&
|
|
41
|
+
typeof this.historyService?.linkToEveHome === 'function'
|
|
42
|
+
) {
|
|
43
|
+
this.historyService.linkToEveHome(this.temperatureService, {
|
|
44
|
+
description: this.deviceData.description,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
updateServices(deviceData) {
|
|
50
|
+
if (typeof deviceData !== 'object' || this.temperatureService === undefined || this.batteryService === undefined) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// If device isn't online report in HomeKit
|
|
55
|
+
this.temperatureService.updateCharacteristic(
|
|
56
|
+
this.hap.Characteristic.StatusFault,
|
|
57
|
+
deviceData.online === true ? this.hap.Characteristic.StatusFault.NO_FAULT : this.hap.Characteristic.StatusFault.GENERAL_FAULT,
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
this.temperatureService.updateCharacteristic(this.hap.Characteristic.StatusActive, deviceData.online);
|
|
61
|
+
if (typeof deviceData?.associated_thermostat === 'string' && deviceData.associated_thermostat !== '') {
|
|
62
|
+
// This tempature sensor is assocated with a theromstat
|
|
63
|
+
// Update sttaus if providing active temperature for the thermostats
|
|
64
|
+
this.temperatureService.updateCharacteristic(
|
|
65
|
+
this.hap.Characteristic.StatusActive,
|
|
66
|
+
deviceData.online === true && deviceData?.active_sensor === true,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Update temperature
|
|
71
|
+
this.temperatureService.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, deviceData.current_temperature);
|
|
72
|
+
|
|
73
|
+
// Update battery level and status
|
|
74
|
+
this.batteryService.updateCharacteristic(this.hap.Characteristic.BatteryLevel, deviceData.battery_level);
|
|
75
|
+
this.batteryService.updateCharacteristic(
|
|
76
|
+
this.hap.Characteristic.StatusLowBattery,
|
|
77
|
+
deviceData.battery_level > LOWBATTERYLEVEL
|
|
78
|
+
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
|
|
79
|
+
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW,
|
|
80
|
+
);
|
|
81
|
+
this.batteryService.updateCharacteristic(this.hap.Characteristic.ChargingState, this.hap.Characteristic.ChargingState.NOT_CHARGEABLE);
|
|
82
|
+
|
|
83
|
+
// If we have the history service running and temperature has changed to previous in past 5mins
|
|
84
|
+
if (
|
|
85
|
+
deviceData.current_temperature !== this.deviceData.current_temperature &&
|
|
86
|
+
this.temperatureService !== undefined &&
|
|
87
|
+
typeof this.historyService?.addHistory === 'function'
|
|
88
|
+
) {
|
|
89
|
+
this.historyService.addHistory(
|
|
90
|
+
this.temperatureService,
|
|
91
|
+
{
|
|
92
|
+
time: Math.floor(Date.now() / 1000),
|
|
93
|
+
temperature: deviceData.current_temperature,
|
|
94
|
+
},
|
|
95
|
+
300,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|