homebridge-nest-accfactory 0.3.0 → 0.3.1
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 +4 -0
- package/dist/HomeKitDevice.js +43 -34
- package/dist/config.js +10 -10
- package/dist/devices.js +14 -9
- package/dist/nexustalk.js +28 -28
- package/dist/plugins/camera.js +22 -20
- package/dist/plugins/protect.js +3 -3
- package/dist/plugins/tempsensor.js +3 -3
- package/dist/plugins/thermostat.js +3 -3
- package/dist/streamer.js +27 -27
- package/dist/system.js +79 -93
- package/dist/webrtc.js +12 -12
- package/package.json +5 -5
package/dist/webrtc.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// Handles connection and data from Google WebRTC systems
|
|
5
5
|
// Currently a "work in progress"
|
|
6
6
|
//
|
|
7
|
-
// Code version 2025.06.
|
|
7
|
+
// Code version 2025.06.15
|
|
8
8
|
// Mark Hulskamp
|
|
9
9
|
'use strict';
|
|
10
10
|
|
|
@@ -26,17 +26,17 @@ import { fileURLToPath } from 'node:url';
|
|
|
26
26
|
import Streamer from './streamer.js';
|
|
27
27
|
|
|
28
28
|
// Define constants
|
|
29
|
-
const
|
|
29
|
+
const EXTEND_INTERVAL = 120000; // Send extend command to Google Home Foyer every this period for active streams
|
|
30
30
|
const RTP_PACKET_HEADER_SIZE = 12;
|
|
31
31
|
const RTP_VIDEO_PAYLOAD_TYPE = 102;
|
|
32
32
|
const RTP_AUDIO_PAYLOAD_TYPE = 111;
|
|
33
33
|
//const RTP_TALKBACK_PAYLOAD_TYPE = 110;
|
|
34
|
-
const
|
|
35
|
-
const
|
|
34
|
+
const USER_AGENT = 'Nest/5.78.0 (iOScom.nestlabs.jasper.release) os=18.0'; // User Agent string
|
|
35
|
+
const GOOGLE_HOME_FOYER_PREFIX = 'google.internal.home.foyer.v1.';
|
|
36
36
|
const __dirname = path.dirname(fileURLToPath(import.meta.url)); // Make a defined for JS __dirname
|
|
37
37
|
|
|
38
38
|
// Blank audio in AAC format, mono channel @48000
|
|
39
|
-
const
|
|
39
|
+
const AAC_MONO_48000_BLANK = Buffer.from([
|
|
40
40
|
0xff, 0xf1, 0x4c, 0x40, 0x03, 0x9f, 0xfc, 0xde, 0x02, 0x00, 0x4c, 0x61, 0x76, 0x63, 0x35, 0x39, 0x2e, 0x31, 0x38, 0x2e, 0x31, 0x30, 0x30,
|
|
41
41
|
0x00, 0x02, 0x30, 0x40, 0x0e,
|
|
42
42
|
]);
|
|
@@ -51,7 +51,7 @@ export default class WebRTC extends Streamer {
|
|
|
51
51
|
extendTimer = undefined; // Stream extend timer
|
|
52
52
|
stalledTimer = undefined; // Timer object for no received data
|
|
53
53
|
pingTimer = undefined; // Google Hopme Foyer periodic ping
|
|
54
|
-
blankAudio =
|
|
54
|
+
blankAudio = AAC_MONO_48000_BLANK;
|
|
55
55
|
video = {}; // Video stream details once connected
|
|
56
56
|
audio = {}; // Audio stream details once connected
|
|
57
57
|
|
|
@@ -293,7 +293,7 @@ export default class WebRTC extends Streamer {
|
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
},
|
|
296
|
+
}, EXTEND_INTERVAL);
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
}
|
|
@@ -486,7 +486,7 @@ export default class WebRTC extends Streamer {
|
|
|
486
486
|
this.audio.opus = werift.OpusRtpPayload.deSerialize(weriftRtpPacket.payload);
|
|
487
487
|
if (this.audio.opus?.payload !== undefined) {
|
|
488
488
|
// Until work out audio, send blank aac
|
|
489
|
-
this.addToOutput('audio',
|
|
489
|
+
this.addToOutput('audio', AAC_MONO_48000_BLANK);
|
|
490
490
|
|
|
491
491
|
// Decode payload to opus??
|
|
492
492
|
//this.addToOutput('audio', this.audio.opus.payload);
|
|
@@ -503,8 +503,8 @@ export default class WebRTC extends Streamer {
|
|
|
503
503
|
}
|
|
504
504
|
|
|
505
505
|
// Attempt to retrieve both 'Request' and 'Reponse' traits for the associated service and command
|
|
506
|
-
let TraitMapRequest = this.#protobufFoyer.lookup(
|
|
507
|
-
let TraitMapResponse = this.#protobufFoyer.lookup(
|
|
506
|
+
let TraitMapRequest = this.#protobufFoyer.lookup(GOOGLE_HOME_FOYER_PREFIX + command + 'Request');
|
|
507
|
+
let TraitMapResponse = this.#protobufFoyer.lookup(GOOGLE_HOME_FOYER_PREFIX + command + 'Response');
|
|
508
508
|
let buffer = Buffer.alloc(0);
|
|
509
509
|
let commandResponse = {
|
|
510
510
|
status: undefined,
|
|
@@ -553,10 +553,10 @@ export default class WebRTC extends Streamer {
|
|
|
553
553
|
|
|
554
554
|
let request = this.#googleHomeFoyer.request({
|
|
555
555
|
':method': 'post',
|
|
556
|
-
':path': '/' +
|
|
556
|
+
':path': '/' + GOOGLE_HOME_FOYER_PREFIX + service + '/' + command,
|
|
557
557
|
authorization: 'Bearer ' + this.token,
|
|
558
558
|
'content-type': 'application/grpc',
|
|
559
|
-
'user-agent':
|
|
559
|
+
'user-agent': USER_AGENT,
|
|
560
560
|
te: 'trailers',
|
|
561
561
|
'request-id': crypto.randomUUID(),
|
|
562
562
|
'grpc-timeout': '10S',
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "homebridge-nest-accfactory",
|
|
3
3
|
"displayName": "Nest Accfactory",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.1",
|
|
6
6
|
"description": "Homebridge support for Nest/Google devices including HomeKit Secure Video (HKSV) support for doorbells and cameras",
|
|
7
7
|
"author": "n0rt0nthec4t",
|
|
8
8
|
"license": "Apache-2.0",
|
|
@@ -45,18 +45,18 @@
|
|
|
45
45
|
],
|
|
46
46
|
"scripts": {
|
|
47
47
|
"clean": "rimraf ./dist*",
|
|
48
|
-
"format": "prettier --write src/*.js src/**/*.js",
|
|
49
|
-
"lint": "eslint src/*.js src/**/*.js --fix --max-warnings=20",
|
|
48
|
+
"format": "prettier --write src/*.js src/**/*.js src/**/*.mjs",
|
|
49
|
+
"lint": "eslint src/*.js src/**/*.js src/**/*.mjs --fix --max-warnings=20",
|
|
50
50
|
"build": "npm run clean && copyfiles -u 1 src/*.js dist && copyfiles -u 2 src/HomeKitDevice/*.js dist && copyfiles -u 2 src/HomeKitHistory/*.js dist && copyfiles -u 1 src/res/*.h264 dist && copyfiles -u 1 src/res/*.jpg dist && copyfiles -u 1 'src/protobuf/**/*.proto' dist && copyfiles -u 1 src/plugins/*.js dist",
|
|
51
51
|
"prepublishOnly": "npm run lint && npm run build"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@eslint/js": "^9.
|
|
54
|
+
"@eslint/js": "^9.29.0",
|
|
55
55
|
"@stylistic/eslint-plugin": "^4.4.1",
|
|
56
56
|
"@types/node": "^24.0.1",
|
|
57
57
|
"@typescript-eslint/parser": "^8.34.0",
|
|
58
58
|
"copyfiles": "^2.4.1",
|
|
59
|
-
"eslint": "^9.
|
|
59
|
+
"eslint": "^9.29.0",
|
|
60
60
|
"homebridge": "^2.0.0-beta.0",
|
|
61
61
|
"prettier": "^3.5.3",
|
|
62
62
|
"prettier-eslint": "^16.4.2",
|