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.
Files changed (88) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +176 -0
  3. package/README.md +121 -0
  4. package/config.schema.json +107 -0
  5. package/dist/HomeKitDevice.js +441 -0
  6. package/dist/HomeKitHistory.js +2835 -0
  7. package/dist/camera.js +1276 -0
  8. package/dist/doorbell.js +122 -0
  9. package/dist/index.js +35 -0
  10. package/dist/nexustalk.js +741 -0
  11. package/dist/protect.js +240 -0
  12. package/dist/protobuf/google/rpc/status.proto +91 -0
  13. package/dist/protobuf/google/rpc/stream_body.proto +26 -0
  14. package/dist/protobuf/google/trait/product/camera.proto +53 -0
  15. package/dist/protobuf/googlehome/foyer.proto +208 -0
  16. package/dist/protobuf/nest/messages.proto +8 -0
  17. package/dist/protobuf/nest/services/apigateway.proto +107 -0
  18. package/dist/protobuf/nest/trait/audio.proto +7 -0
  19. package/dist/protobuf/nest/trait/cellular.proto +313 -0
  20. package/dist/protobuf/nest/trait/debug.proto +37 -0
  21. package/dist/protobuf/nest/trait/detector.proto +41 -0
  22. package/dist/protobuf/nest/trait/diagnostics.proto +87 -0
  23. package/dist/protobuf/nest/trait/firmware.proto +221 -0
  24. package/dist/protobuf/nest/trait/guest.proto +105 -0
  25. package/dist/protobuf/nest/trait/history.proto +345 -0
  26. package/dist/protobuf/nest/trait/humanlibrary.proto +19 -0
  27. package/dist/protobuf/nest/trait/hvac.proto +1353 -0
  28. package/dist/protobuf/nest/trait/input.proto +29 -0
  29. package/dist/protobuf/nest/trait/lighting.proto +61 -0
  30. package/dist/protobuf/nest/trait/located.proto +193 -0
  31. package/dist/protobuf/nest/trait/media.proto +68 -0
  32. package/dist/protobuf/nest/trait/network.proto +352 -0
  33. package/dist/protobuf/nest/trait/occupancy.proto +373 -0
  34. package/dist/protobuf/nest/trait/olive.proto +15 -0
  35. package/dist/protobuf/nest/trait/pairing.proto +85 -0
  36. package/dist/protobuf/nest/trait/product/camera.proto +283 -0
  37. package/dist/protobuf/nest/trait/product/detect.proto +67 -0
  38. package/dist/protobuf/nest/trait/product/doorbell.proto +18 -0
  39. package/dist/protobuf/nest/trait/product/guard.proto +59 -0
  40. package/dist/protobuf/nest/trait/product/protect.proto +344 -0
  41. package/dist/protobuf/nest/trait/promonitoring.proto +14 -0
  42. package/dist/protobuf/nest/trait/resourcedirectory.proto +32 -0
  43. package/dist/protobuf/nest/trait/safety.proto +119 -0
  44. package/dist/protobuf/nest/trait/security.proto +516 -0
  45. package/dist/protobuf/nest/trait/selftest.proto +78 -0
  46. package/dist/protobuf/nest/trait/sensor.proto +291 -0
  47. package/dist/protobuf/nest/trait/service.proto +46 -0
  48. package/dist/protobuf/nest/trait/structure.proto +85 -0
  49. package/dist/protobuf/nest/trait/system.proto +51 -0
  50. package/dist/protobuf/nest/trait/test.proto +15 -0
  51. package/dist/protobuf/nest/trait/ui.proto +65 -0
  52. package/dist/protobuf/nest/trait/user.proto +98 -0
  53. package/dist/protobuf/nest/trait/voiceassistant.proto +30 -0
  54. package/dist/protobuf/nestlabs/eventingapi/v1.proto +83 -0
  55. package/dist/protobuf/nestlabs/gateway/v1.proto +273 -0
  56. package/dist/protobuf/nestlabs/gateway/v2.proto +96 -0
  57. package/dist/protobuf/nestlabs/history/v1.proto +73 -0
  58. package/dist/protobuf/root.proto +64 -0
  59. package/dist/protobuf/wdl-event-importance.proto +11 -0
  60. package/dist/protobuf/wdl.proto +450 -0
  61. package/dist/protobuf/weave/common.proto +144 -0
  62. package/dist/protobuf/weave/trait/audio.proto +12 -0
  63. package/dist/protobuf/weave/trait/auth.proto +22 -0
  64. package/dist/protobuf/weave/trait/description.proto +32 -0
  65. package/dist/protobuf/weave/trait/heartbeat.proto +38 -0
  66. package/dist/protobuf/weave/trait/locale.proto +20 -0
  67. package/dist/protobuf/weave/trait/network.proto +24 -0
  68. package/dist/protobuf/weave/trait/pairing.proto +8 -0
  69. package/dist/protobuf/weave/trait/peerdevices.proto +18 -0
  70. package/dist/protobuf/weave/trait/power.proto +86 -0
  71. package/dist/protobuf/weave/trait/schedule.proto +76 -0
  72. package/dist/protobuf/weave/trait/security.proto +343 -0
  73. package/dist/protobuf/weave/trait/telemetry/tunnel.proto +37 -0
  74. package/dist/protobuf/weave/trait/time.proto +16 -0
  75. package/dist/res/Nest_camera_connecting.h264 +0 -0
  76. package/dist/res/Nest_camera_connecting.jpg +0 -0
  77. package/dist/res/Nest_camera_off.h264 +0 -0
  78. package/dist/res/Nest_camera_off.jpg +0 -0
  79. package/dist/res/Nest_camera_offline.h264 +0 -0
  80. package/dist/res/Nest_camera_offline.jpg +0 -0
  81. package/dist/res/Nest_camera_transfer.jpg +0 -0
  82. package/dist/streamer.js +344 -0
  83. package/dist/system.js +3112 -0
  84. package/dist/tempsensor.js +99 -0
  85. package/dist/thermostat.js +1026 -0
  86. package/dist/weather.js +205 -0
  87. package/dist/webrtc.js +55 -0
  88. package/package.json +66 -0
@@ -0,0 +1,205 @@
1
+ // Nest 'virtual' weather station
2
+ // Part of homebridge-nest-accfactory
3
+ //
4
+ // Code version 28/8/2024
5
+ // Mark Hulskamp
6
+ 'use strict';
7
+
8
+ // Define our modules
9
+ import HomeKitDevice from './HomeKitDevice.js';
10
+
11
+ export default class NestWeather extends HomeKitDevice {
12
+ batteryService = undefined;
13
+ airPressureService = undefined;
14
+ temperatureService = undefined;
15
+ humidityService = 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 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 humidity service if not already present on the accessory
31
+ this.humidityService = this.accessory.getService(this.hap.Service.HumiditySensor);
32
+ if (this.humidityService === undefined) {
33
+ this.humidityService = this.accessory.addService(this.hap.Service.HumiditySensor, '', 1);
34
+ }
35
+
36
+ // Setup battery service if not already present on the accessory
37
+ this.batteryService = this.accessory.getService(this.hap.Service.Battery);
38
+ if (this.batteryService === undefined) {
39
+ this.batteryService = this.accessory.addService(this.hap.Service.Battery, '', 1);
40
+ }
41
+ this.batteryService.setHiddenService(true);
42
+
43
+ // Add custom weather service and characteristics if they have been defined
44
+ if (this.hap.Service?.EveAirPressureSensor !== undefined) {
45
+ this.airPressureService = this.accessory.getService(this.hap.Service.EveAirPressureSensor);
46
+ if (this.airPressureService === undefined) {
47
+ this.airPressureService = this.accessory.addService(this.hap.Service.EveAirPressureSensor, '', 1);
48
+ }
49
+ }
50
+
51
+ if (
52
+ this.hap.Characteristic?.ForecastDay !== undefined &&
53
+ this.temperatureService.testCharacteristic(this.hap.Characteristic.ForecastDay) === false
54
+ ) {
55
+ this.temperatureService.addCharacteristic(this.hap.Characteristic.ForecastDay);
56
+ }
57
+ if (
58
+ this.hap.Characteristic?.ObservationStation !== undefined &&
59
+ this.temperatureService.testCharacteristic(this.hap.Characteristic.ObservationStation) === false
60
+ ) {
61
+ this.temperatureService.addCharacteristic(this.hap.Characteristic.ObservationStation);
62
+ }
63
+ if (
64
+ this.hap.Characteristic?.Condition !== undefined &&
65
+ this.temperatureService.testCharacteristic(this.hap.Characteristic.Condition) === false
66
+ ) {
67
+ this.temperatureService.addCharacteristic(this.hap.Characteristic.Condition);
68
+ }
69
+ if (
70
+ this.hap.Characteristic?.WindDirection !== undefined &&
71
+ this.temperatureService.testCharacteristic(this.hap.Characteristic.WindDirection) === false
72
+ ) {
73
+ this.temperatureService.addCharacteristic(this.hap.Characteristic.WindDirection);
74
+ }
75
+ if (
76
+ this.hap.Characteristic?.WindSpeed !== undefined &&
77
+ this.temperatureService.testCharacteristic(this.hap.Characteristic.WindSpeed) === false
78
+ ) {
79
+ this.temperatureService.addCharacteristic(this.hap.Characteristic.WindSpeed);
80
+ }
81
+ if (
82
+ this.hap.Characteristic?.SunriseTime !== undefined &&
83
+ this.temperatureService.testCharacteristic(this.hap.Characteristic.SunriseTime) === false
84
+ ) {
85
+ this.temperatureService.addCharacteristic(this.hap.Characteristic.SunriseTime);
86
+ }
87
+ if (
88
+ this.hap.Characteristic?.SunsetTime !== undefined &&
89
+ this.temperatureService.testCharacteristic(this.hap.Characteristic.SunsetTime) === false
90
+ ) {
91
+ this.temperatureService.addCharacteristic(this.hap.Characteristic.SunsetTime);
92
+ }
93
+
94
+ // Setup linkage to EveHome app if configured todo so
95
+ if (
96
+ this.deviceData?.eveHistory === true &&
97
+ this.airPressureService !== undefined &&
98
+ typeof this.historyService?.linkToEveHome === 'function'
99
+ ) {
100
+ this.historyService.linkToEveHome(this.airPressureService, {
101
+ description: this.deviceData.description,
102
+ });
103
+ }
104
+
105
+ // Create extra details for output
106
+ let postSetupDetails = [];
107
+ this.deviceData?.elevation !== undefined && postSetupDetails.push('Elevation of ' + this.deviceData.elevation + 'm');
108
+
109
+ return postSetupDetails;
110
+ }
111
+
112
+ updateServices(deviceData) {
113
+ if (
114
+ typeof deviceData !== 'object' ||
115
+ this.temperatureService === undefined ||
116
+ this.humidityService === undefined ||
117
+ this.batteryService === undefined
118
+ ) {
119
+ return;
120
+ }
121
+
122
+ this.temperatureService.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, deviceData.current_temperature);
123
+
124
+ this.batteryService.updateCharacteristic(this.hap.Characteristic.BatteryLevel, 100);
125
+ this.batteryService.updateCharacteristic(
126
+ this.hap.Characteristic.StatusLowBattery,
127
+ this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
128
+ );
129
+ this.batteryService.updateCharacteristic(this.hap.Characteristic.ChargingState, this.hap.Characteristic.ChargingState.NOT_CHARGEABLE);
130
+
131
+ this.humidityService.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity, deviceData.current_humidity);
132
+
133
+ if (this.airPressureService !== undefined) {
134
+ //this.airPressureService.updateCharacteristic(this.hap.Characteristic.EveAirPressure, 0); // Where from??
135
+ this.airPressureService.updateCharacteristic(this.hap.Characteristic.EveElevation, deviceData.elevation);
136
+ }
137
+
138
+ // Update custom characteristics if present on the accessory
139
+ if (
140
+ this.hap.Characteristic?.ForecastDay !== undefined &&
141
+ this.temperatureService.testCharacteristic(this.hap.Characteristic.ForecastDay) === true &&
142
+ this.deviceData?.forecast !== undefined
143
+ ) {
144
+ this.temperatureService.updateCharacteristic(this.hap.Characteristic.ForecastDay, deviceData.forecast);
145
+ }
146
+ if (
147
+ this.hap.Characteristic?.ObservationStation !== undefined &&
148
+ this.temperatureService.testCharacteristic(this.hap.Characteristic.ObservationStation) === true &&
149
+ this.deviceData?.station !== undefined
150
+ ) {
151
+ this.temperatureService.updateCharacteristic(this.hap.Characteristic.ObservationStation, deviceData.station);
152
+ }
153
+ if (
154
+ this.hap.Characteristic?.Condition !== undefined &&
155
+ this.temperatureService.testCharacteristic(this.hap.Characteristic.Condition) === true &&
156
+ this.deviceData?.condition !== undefined
157
+ ) {
158
+ this.temperatureService.updateCharacteristic(this.hap.Characteristic.Condition, deviceData.condition);
159
+ }
160
+ if (
161
+ this.hap.Characteristic?.WindDirection !== undefined &&
162
+ this.temperatureService.testCharacteristic(this.hap.Characteristic.WindDirection) === true &&
163
+ this.deviceData?.wind_direction !== undefined
164
+ ) {
165
+ this.temperatureService.updateCharacteristic(this.hap.Characteristic.WindDirection, deviceData.wind_direction);
166
+ }
167
+ if (
168
+ this.hap.Characteristic?.WindSpeed !== undefined &&
169
+ this.temperatureService.testCharacteristic(this.hap.Characteristic.WindSpeed) === true &&
170
+ this.deviceData?.wind_speed !== undefined
171
+ ) {
172
+ this.temperatureService.updateCharacteristic(this.hap.Characteristic.WindSpeed, deviceData.wind_speed);
173
+ }
174
+ if (
175
+ this.hap.Characteristic?.SunriseTime !== undefined &&
176
+ this.temperatureService.testCharacteristic(this.hap.Characteristic.SunriseTime) === true &&
177
+ this.deviceData?.sunrise !== undefined
178
+ ) {
179
+ let dateString = new Date(deviceData.sunrise * 1000).toLocaleTimeString();
180
+ this.temperatureService.updateCharacteristic(this.hap.Characteristic.SunriseTime, dateString);
181
+ }
182
+ if (
183
+ this.hap.Characteristic?.SunsetTime !== undefined &&
184
+ this.temperatureService.testCharacteristic(this.hap.Characteristic.SunsetTime) === true &&
185
+ this.deviceData?.sunset !== undefined
186
+ ) {
187
+ let dateString = new Date(deviceData.sunset * 1000).toLocaleTimeString();
188
+ this.temperatureService.updateCharacteristic(this.hap.Characteristic.SunsetTime, dateString);
189
+ }
190
+
191
+ // If we have the history service running, record temperature and humity every 5mins
192
+ if (this.airPressureService !== undefined && typeof this.historyService?.addHistory === 'function') {
193
+ this.historyService.addHistory(
194
+ this.airPressureService,
195
+ {
196
+ time: Math.floor(Date.now() / 1000),
197
+ temperature: deviceData.current_temperature,
198
+ humidity: deviceData.current_humidity,
199
+ pressure: 0,
200
+ },
201
+ 300,
202
+ );
203
+ }
204
+ }
205
+ }
package/dist/webrtc.js ADDED
@@ -0,0 +1,55 @@
1
+ // WebRTC
2
+ // Part of homebridge-nest-accfactory
3
+ //
4
+ // Handles connection and data from Google WeBRTC systems
5
+ //
6
+ // Code version 6/9/2024
7
+ // Mark Hulskamp
8
+ 'use strict';
9
+
10
+ // Define external library requirements
11
+ //import axios from 'axios';
12
+ //import protobuf from 'protobufjs';
13
+
14
+ // Define nodejs module requirements
15
+ //import { Buffer } from 'node:buffer';
16
+ //import { setInterval, clearInterval, setTimeout, clearTimeout } from 'node:timers';
17
+ //import tls from 'tls';
18
+ //import crypto from 'crypto';
19
+
20
+ // Define our modules
21
+ import Streamer from './streamer.js';
22
+
23
+ // Define constants
24
+
25
+ // WebRTC object
26
+ export default class WebRTC extends Streamer {
27
+ constructor(deviceData, options) {
28
+ super(deviceData, options);
29
+
30
+ this.host = deviceData?.streaming_host; // Host we'll connect to
31
+
32
+ // If specified option to start buffering, kick off
33
+ if (typeof options?.buffer === 'boolean' && options.buffer === true) {
34
+ this.startBuffering();
35
+ }
36
+ }
37
+
38
+ // Class functions
39
+ connect(host) {
40
+ this.log.info(host);
41
+ }
42
+
43
+ close(stopStreamFirst) {
44
+ this.log.info(stopStreamFirst);
45
+ }
46
+
47
+ update(deviceData) {
48
+ // Let our parent handle the remaining updates
49
+ super.update(deviceData);
50
+ }
51
+
52
+ talkingAudio(talkingData) {
53
+ this.log.info(talkingData);
54
+ }
55
+ }
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "displayName": "Nest Accfactory",
3
+ "name": "homebridge-nest-accfactory",
4
+ "homepage": "https://github.com/n0rt0nthec4t/homebridge-nest-accfactory",
5
+ "version": "0.0.4a",
6
+ "description": "Homebridge support for Nest/Google devices including HomeKit Secure Video (HKSV) support for doorbells and cameras",
7
+ "license": "Apache-2.0",
8
+ "author": "n0rt0nthec4t",
9
+ "type": "module",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/n0rt0nthec4t/homebridge-nest-accfactory.git"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/n0rt0nthec4t/homebridge-nest-accfactory/issues"
16
+ },
17
+ "engines": {
18
+ "node": "^18.20.4 || ^20.16.0 || ^22.6.0",
19
+ "homebridge": "^1.8.0 || ^2.0.0-beta.0"
20
+ },
21
+ "main": "dist/index.js",
22
+ "files": [
23
+ "LICENSE",
24
+ "dist/**/*",
25
+ "config.schema.json",
26
+ "README.md",
27
+ "CHANGELOG.md"
28
+ ],
29
+ "scripts": {
30
+ "clean": "rimraf ./dist",
31
+ "format": "prettier --write src/**/*.js",
32
+ "lint": "eslint src/**/*.js --max-warnings=100",
33
+ "build": "npm run clean && copyfiles -u 1 src/*.js dist && copyfiles -u 1 src/res/*.h264 dist && copyfiles -u 1 src/res/*.jpg dist && copyfiles -u 1 'src/protobuf/**/*.proto' dist",
34
+ "prepublishOnly": "npm run lint && npm run build"
35
+ },
36
+ "keywords": [
37
+ "homebridge-plugin",
38
+ "hksv",
39
+ "nest",
40
+ "google",
41
+ "doorbell",
42
+ "camera",
43
+ "thermostat",
44
+ "temperature",
45
+ "smoke",
46
+ "sensor"
47
+ ],
48
+ "devDependencies": {
49
+ "@eslint/js": "^9.10.0",
50
+ "@stylistic/eslint-plugin": "^2.7.2",
51
+ "@types/node": "^20.16.0",
52
+ "@typescript-eslint/parser": "^8.4.0",
53
+ "homebridge": "^2.0.0-beta.0",
54
+ "copyfiles": "^2.4.1",
55
+ "eslint": "^9.10.0",
56
+ "prettier": "^3.3.3",
57
+ "prettier-eslint": "^16.3.0",
58
+ "rimraf": "^6.0.1"
59
+ },
60
+ "dependencies": {
61
+ "axios": "^1.7.7",
62
+ "pbf": "^4.0.1",
63
+ "protobufjs": "^7.4.0",
64
+ "ws": "^8.18.0"
65
+ }
66
+ }