homebridge-digital-intercom 0.0.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/LICENSE +176 -0
- package/README.md +14 -0
- package/assets/snapshot.png +0 -0
- package/config.schema.json +30 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.js +17 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/platform.d.ts +32 -0
- package/dist/platform.js +69 -0
- package/dist/platform.js.map +1 -0
- package/dist/platformAccessory.d.ts +18 -0
- package/dist/platformAccessory.js +135 -0
- package/dist/platformAccessory.js.map +1 -0
- package/dist/settings.d.ts +8 -0
- package/dist/settings.js +9 -0
- package/dist/settings.js.map +1 -0
- package/dist/streamingDelegate.d.ts +17 -0
- package/dist/streamingDelegate.js +341 -0
- package/dist/streamingDelegate.js.map +1 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Homebridge Digital Intercom Plugin
|
|
2
|
+
|
|
3
|
+
Homebridge plugin to interface with the [Digital Intercom](https://github.com/nkalupahana/digital-intercom)
|
|
4
|
+
ecosystem (wall intercom, NFC reader, Apple Home).
|
|
5
|
+
|
|
6
|
+
### Apple Home features:
|
|
7
|
+
|
|
8
|
+
- Two-way audio
|
|
9
|
+
- Stateless switch to open door
|
|
10
|
+
- Doorbell integration when doorbell signal is received
|
|
11
|
+
|
|
12
|
+
### Additional features:
|
|
13
|
+
|
|
14
|
+
- Opens door when registered credit card hash is received
|
|
Binary file
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pluginAlias": "Digital Intercom",
|
|
3
|
+
"pluginType": "platform",
|
|
4
|
+
"singular": true,
|
|
5
|
+
"strictValidation": false,
|
|
6
|
+
"schema": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"required": ["allowedCards"],
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"properties": {
|
|
11
|
+
"allowedCards": {
|
|
12
|
+
"title": "Allowed Cards",
|
|
13
|
+
"type": "array",
|
|
14
|
+
"items": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"properties": {
|
|
17
|
+
"hash": {
|
|
18
|
+
"title": "Card Number",
|
|
19
|
+
"type": "string"
|
|
20
|
+
},
|
|
21
|
+
"description": {
|
|
22
|
+
"title": "Description",
|
|
23
|
+
"type": "string"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum Command {
|
|
2
|
+
OPEN_DOOR = "D",
|
|
3
|
+
LISTEN_ON = "L",
|
|
4
|
+
TALK_ON = "T",
|
|
5
|
+
LISTEN_STOP = "S",
|
|
6
|
+
HEARTBEAT = "H"
|
|
7
|
+
}
|
|
8
|
+
export declare enum IntercomEventType {
|
|
9
|
+
BUZZER = "B",
|
|
10
|
+
CREDIT_CARD = "C"
|
|
11
|
+
}
|
|
12
|
+
export declare const CREDIT_CARD_DATA_LEN = 34;
|
|
13
|
+
export declare const HEARTBEAT_INTERVAL = 1000;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// These should be kept in sync with the C++ code
|
|
2
|
+
export var Command;
|
|
3
|
+
(function (Command) {
|
|
4
|
+
Command["OPEN_DOOR"] = "D";
|
|
5
|
+
Command["LISTEN_ON"] = "L";
|
|
6
|
+
Command["TALK_ON"] = "T";
|
|
7
|
+
Command["LISTEN_STOP"] = "S";
|
|
8
|
+
Command["HEARTBEAT"] = "H";
|
|
9
|
+
})(Command || (Command = {}));
|
|
10
|
+
export var IntercomEventType;
|
|
11
|
+
(function (IntercomEventType) {
|
|
12
|
+
IntercomEventType["BUZZER"] = "B";
|
|
13
|
+
IntercomEventType["CREDIT_CARD"] = "C";
|
|
14
|
+
})(IntercomEventType || (IntercomEventType = {}));
|
|
15
|
+
export const CREDIT_CARD_DATA_LEN = 34;
|
|
16
|
+
export const HEARTBEAT_INTERVAL = 1000;
|
|
17
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,MAAM,CAAN,IAAY,OAMX;AAND,WAAY,OAAO;IACjB,0BAAe,CAAA;IACf,0BAAe,CAAA;IACf,wBAAa,CAAA;IACb,4BAAiB,CAAA;IACjB,0BAAe,CAAA;AACjB,CAAC,EANW,OAAO,KAAP,OAAO,QAMlB;AAED,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,iCAAY,CAAA;IACZ,sCAAiB,CAAA;AACnB,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AACvC,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DigitalIntercomPlatform } from "./platform.js";
|
|
2
|
+
import { PLATFORM_NAME } from "./settings.js";
|
|
3
|
+
/**
|
|
4
|
+
* This method registers the platform with Homebridge
|
|
5
|
+
*/
|
|
6
|
+
export default (api) => {
|
|
7
|
+
api.registerPlatform(PLATFORM_NAME, DigitalIntercomPlatform);
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;GAEG;AACH,eAAe,CAAC,GAAQ,EAAE,EAAE;IAC1B,GAAG,CAAC,gBAAgB,CAAC,aAAa,EAAE,uBAAuB,CAAC,CAAC;AAC/D,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { API, Characteristic, DynamicPlatformPlugin, Logging, PlatformAccessory, PlatformConfig, Service } from "homebridge";
|
|
2
|
+
interface DigitalIntercomPlatformConfig extends PlatformConfig {
|
|
3
|
+
allowedCards: {
|
|
4
|
+
hash: string;
|
|
5
|
+
description: string;
|
|
6
|
+
}[];
|
|
7
|
+
}
|
|
8
|
+
export declare class DigitalIntercomPlatform implements DynamicPlatformPlugin {
|
|
9
|
+
readonly log: Logging;
|
|
10
|
+
readonly _config: DigitalIntercomPlatformConfig;
|
|
11
|
+
readonly api: API;
|
|
12
|
+
readonly Service: typeof Service;
|
|
13
|
+
readonly Characteristic: typeof Characteristic;
|
|
14
|
+
readonly accessories: Map<string, PlatformAccessory>;
|
|
15
|
+
readonly discoveredCacheUUIDs: string[];
|
|
16
|
+
readonly CustomServices: any;
|
|
17
|
+
readonly CustomCharacteristics: any;
|
|
18
|
+
readonly config: DigitalIntercomPlatformConfig;
|
|
19
|
+
constructor(log: Logging, _config: DigitalIntercomPlatformConfig, api: API);
|
|
20
|
+
/**
|
|
21
|
+
* This function is invoked when homebridge restores cached accessories from disk at startup.
|
|
22
|
+
* It should be used to set up event handlers for characteristics and update respective values.
|
|
23
|
+
*/
|
|
24
|
+
configureAccessory(accessory: PlatformAccessory): void;
|
|
25
|
+
/**
|
|
26
|
+
* This is an example method showing how to register discovered accessories.
|
|
27
|
+
* Accessories must only be registered once, previously created accessories
|
|
28
|
+
* must not be registered again to prevent "duplicate UUID" errors.
|
|
29
|
+
*/
|
|
30
|
+
discoverDevices(): void;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
package/dist/platform.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { DigitalIntercomPlatformAccessory } from "./platformAccessory.js";
|
|
2
|
+
import { PLATFORM_NAME, PLUGIN_NAME } from "./settings.js";
|
|
3
|
+
export class DigitalIntercomPlatform {
|
|
4
|
+
log;
|
|
5
|
+
_config;
|
|
6
|
+
api;
|
|
7
|
+
Service;
|
|
8
|
+
Characteristic;
|
|
9
|
+
// this is used to track restored cached accessories
|
|
10
|
+
accessories = new Map();
|
|
11
|
+
discoveredCacheUUIDs = [];
|
|
12
|
+
// This is only required when using Custom Services and Characteristics not support by HomeKit
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
CustomServices;
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
CustomCharacteristics;
|
|
17
|
+
config;
|
|
18
|
+
constructor(log, _config, api) {
|
|
19
|
+
this.log = log;
|
|
20
|
+
this._config = _config;
|
|
21
|
+
this.api = api;
|
|
22
|
+
this.Service = api.hap.Service;
|
|
23
|
+
this.Characteristic = api.hap.Characteristic;
|
|
24
|
+
this.config = _config;
|
|
25
|
+
// When this event is fired it means Homebridge has restored all cached accessories from disk.
|
|
26
|
+
// Dynamic Platform plugins should only register new accessories after this event was fired,
|
|
27
|
+
// in order to ensure they weren't added to homebridge already. This event can also be used
|
|
28
|
+
// to start discovery of new accessories.
|
|
29
|
+
this.api.on("didFinishLaunching", () => {
|
|
30
|
+
log.debug("Executed didFinishLaunching callback");
|
|
31
|
+
// run the method to discover / register your devices as accessories
|
|
32
|
+
this.discoverDevices();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* This function is invoked when homebridge restores cached accessories from disk at startup.
|
|
37
|
+
* It should be used to set up event handlers for characteristics and update respective values.
|
|
38
|
+
*/
|
|
39
|
+
configureAccessory(accessory) {
|
|
40
|
+
this.log.info("Loading accessory from cache:", accessory.displayName);
|
|
41
|
+
// add the restored accessory to the accessories cache, so we can track if it has already been registered
|
|
42
|
+
this.accessories.set(accessory.UUID, accessory);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* This is an example method showing how to register discovered accessories.
|
|
46
|
+
* Accessories must only be registered once, previously created accessories
|
|
47
|
+
* must not be registered again to prevent "duplicate UUID" errors.
|
|
48
|
+
*/
|
|
49
|
+
discoverDevices() {
|
|
50
|
+
const accessoryName = "Intercom";
|
|
51
|
+
const uuid = this.api.hap.uuid.generate(accessoryName);
|
|
52
|
+
const existingAccessory = this.accessories.get(uuid);
|
|
53
|
+
if (existingAccessory) {
|
|
54
|
+
this.log.info("Restoring existing accessory from cache:", existingAccessory.displayName);
|
|
55
|
+
new DigitalIntercomPlatformAccessory(this, existingAccessory);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// the accessory does not yet exist, so we need to create it
|
|
59
|
+
this.log.info("Adding new accessory:", accessoryName);
|
|
60
|
+
// create a new accessory
|
|
61
|
+
const accessory = new this.api.platformAccessory(accessoryName, uuid);
|
|
62
|
+
new DigitalIntercomPlatformAccessory(this, accessory);
|
|
63
|
+
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [
|
|
64
|
+
accessory,
|
|
65
|
+
]);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAS3D,MAAM,OAAO,uBAAuB;IAgBhB;IACA;IACA;IAjBF,OAAO,CAAiB;IACxB,cAAc,CAAwB;IAEtD,oDAAoD;IACpC,WAAW,GAAmC,IAAI,GAAG,EAAE,CAAC;IACxD,oBAAoB,GAAa,EAAE,CAAC;IAEpD,8FAA8F;IAC9F,8DAA8D;IAC9C,cAAc,CAAM;IACpC,8DAA8D;IAC9C,qBAAqB,CAAM;IAC3B,MAAM,CAAgC;IAEtD,YACkB,GAAY,EACZ,OAAsC,EACtC,GAAQ;QAFR,QAAG,GAAH,GAAG,CAAS;QACZ,YAAO,GAAP,OAAO,CAA+B;QACtC,QAAG,GAAH,GAAG,CAAK;QAExB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;QAEtB,8FAA8F;QAC9F,4FAA4F;QAC5F,2FAA2F;QAC3F,yCAAyC;QACzC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,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CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type HAP, type PlatformAccessory } from "homebridge";
|
|
2
|
+
import type { DigitalIntercomPlatform } from "./platform.js";
|
|
3
|
+
import { Command } from "./constants.js";
|
|
4
|
+
export declare class DigitalIntercomPlatformAccessory {
|
|
5
|
+
private readonly platform;
|
|
6
|
+
private readonly paccessory;
|
|
7
|
+
hap: HAP;
|
|
8
|
+
private log;
|
|
9
|
+
private accessory;
|
|
10
|
+
private streamingDelegate;
|
|
11
|
+
private socket;
|
|
12
|
+
private doorbellService;
|
|
13
|
+
getSocketAddress(): string | null;
|
|
14
|
+
sendCommand(cmd: Command): void;
|
|
15
|
+
onIntercomData(data: Buffer<ArrayBuffer>): void;
|
|
16
|
+
startServer(): void;
|
|
17
|
+
constructor(platform: DigitalIntercomPlatform, paccessory: PlatformAccessory);
|
|
18
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { IntercomStreamingDelegate } from "./streamingDelegate.js";
|
|
2
|
+
import net from "net";
|
|
3
|
+
import { Command, CREDIT_CARD_DATA_LEN, HEARTBEAT_INTERVAL, IntercomEventType, } from "./constants.js";
|
|
4
|
+
export class DigitalIntercomPlatformAccessory {
|
|
5
|
+
platform;
|
|
6
|
+
paccessory;
|
|
7
|
+
hap;
|
|
8
|
+
log;
|
|
9
|
+
accessory;
|
|
10
|
+
streamingDelegate;
|
|
11
|
+
socket = null;
|
|
12
|
+
doorbellService = null;
|
|
13
|
+
getSocketAddress() {
|
|
14
|
+
if (this.socket === null) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return this.socket.remoteAddress ?? null;
|
|
18
|
+
}
|
|
19
|
+
sendCommand(cmd) {
|
|
20
|
+
if (this.socket === null) {
|
|
21
|
+
this.log.error("Cannot send command because no TCP client connected");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
this.socket.write(cmd);
|
|
25
|
+
}
|
|
26
|
+
onIntercomData(data) {
|
|
27
|
+
const eventType = String.fromCharCode(data[0]);
|
|
28
|
+
if (eventType === IntercomEventType.BUZZER) {
|
|
29
|
+
if (this.doorbellService) {
|
|
30
|
+
this.doorbellService
|
|
31
|
+
.getCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent)
|
|
32
|
+
.setValue(this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this.log.error("Unable ring doorbell because doorbellService is null");
|
|
36
|
+
}
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
else if (eventType === IntercomEventType.CREDIT_CARD) {
|
|
40
|
+
console.log("Got credit card event", data);
|
|
41
|
+
const messageLength = CREDIT_CARD_DATA_LEN + 1;
|
|
42
|
+
if (data.length !== messageLength) {
|
|
43
|
+
console.log("Invalid credit card data length", data.length, messageLength);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const creditCardData = data.subarray(1, messageLength);
|
|
47
|
+
const hash = creditCardData.toString("hex");
|
|
48
|
+
console.log("Got credit card data", hash);
|
|
49
|
+
const allowedCard = this.platform.config.allowedCards.find((card) => card.hash === hash);
|
|
50
|
+
if (!allowedCard) {
|
|
51
|
+
console.log("Card not allowed", hash);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
console.log("Card allowed", hash, allowedCard.description);
|
|
56
|
+
this.socket?.write(Command.OPEN_DOOR);
|
|
57
|
+
}
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
console.log("Invalid eventType", eventType, data);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
startServer() {
|
|
66
|
+
const server = net.createServer((socket) => {
|
|
67
|
+
if (this.socket !== null) {
|
|
68
|
+
this.log.warn("Client already connected, destroying old connection");
|
|
69
|
+
this.socket.destroy();
|
|
70
|
+
}
|
|
71
|
+
this.socket = socket;
|
|
72
|
+
this.log.info("Client connected:", socket.remoteAddress, socket.remotePort);
|
|
73
|
+
socket.on("data", (data) => {
|
|
74
|
+
this.onIntercomData(data);
|
|
75
|
+
});
|
|
76
|
+
socket.on("close", () => {
|
|
77
|
+
this.log.error("Client disconnected");
|
|
78
|
+
this.socket = null;
|
|
79
|
+
});
|
|
80
|
+
socket.on("error", (err) => {
|
|
81
|
+
this.log.error("Socket error:", err.message);
|
|
82
|
+
this.socket = null;
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
server.maxConnections = 1;
|
|
86
|
+
server.listen(9998, "0.0.0.0", () => {
|
|
87
|
+
this.log.info(`TCP server listening on 0.0.0.0:9998`);
|
|
88
|
+
});
|
|
89
|
+
setInterval(() => {
|
|
90
|
+
this.socket?.write(Command.HEARTBEAT);
|
|
91
|
+
}, HEARTBEAT_INTERVAL);
|
|
92
|
+
}
|
|
93
|
+
constructor(platform, paccessory) {
|
|
94
|
+
this.platform = platform;
|
|
95
|
+
this.paccessory = paccessory;
|
|
96
|
+
this.log = this.platform.log;
|
|
97
|
+
this.hap = this.platform.api.hap;
|
|
98
|
+
this.accessory = paccessory;
|
|
99
|
+
/// Configure doorbell
|
|
100
|
+
// Clear out any previous doorbell service.
|
|
101
|
+
this.doorbellService =
|
|
102
|
+
this.accessory.getService(this.hap.Service.Doorbell) ?? null;
|
|
103
|
+
let switchService = this.accessory.getService(this.hap.Service.Switch);
|
|
104
|
+
if (this.doorbellService) {
|
|
105
|
+
this.accessory.removeService(this.doorbellService);
|
|
106
|
+
}
|
|
107
|
+
if (switchService) {
|
|
108
|
+
this.accessory.removeService(switchService);
|
|
109
|
+
}
|
|
110
|
+
this.doorbellService = new this.hap.Service.Doorbell(this.accessory.displayName);
|
|
111
|
+
this.doorbellService.setPrimaryService(true);
|
|
112
|
+
this.streamingDelegate = new IntercomStreamingDelegate(this);
|
|
113
|
+
this.accessory.configureController(this.streamingDelegate.controller);
|
|
114
|
+
this.accessory
|
|
115
|
+
.addService(this.doorbellService)
|
|
116
|
+
.getCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent)
|
|
117
|
+
.on("get" /* CharacteristicEventTypes.GET */, (callback) => {
|
|
118
|
+
// HomeKit wants this to always be null.
|
|
119
|
+
callback(null, null);
|
|
120
|
+
});
|
|
121
|
+
switchService = new this.hap.Service.Switch("Door");
|
|
122
|
+
this.accessory
|
|
123
|
+
.addService(switchService)
|
|
124
|
+
.getCharacteristic(this.hap.Characteristic.On)
|
|
125
|
+
.onGet(() => 0)
|
|
126
|
+
.onSet((value) => {
|
|
127
|
+
this.log.info("Setting door", value);
|
|
128
|
+
if (value) {
|
|
129
|
+
this.sendCommand(Command.OPEN_DOOR);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
this.startServer();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=platformAccessory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platformAccessory.js","sourceRoot":"","sources":["../src/platformAccessory.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EACL,OAAO,EACP,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,MAAM,OAAO,gCAAgC;IA0GxB;IACA;IA1GnB,GAAG,CAAM;IACD,GAAG,CAAU;IACb,SAAS,CAAoB;IAC7B,iBAAiB,CAA4B;IAC7C,MAAM,GAAsB,IAAI,CAAC;IACjC,eAAe,GAAmB,IAAI,CAAC;IAE/C,gBAAgB;QACd,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,IAAI,CAAC;IAC3C,CAAC;IAED,WAAW,CAAC,GAAY;QACtB,IAAI,IAAI,CAAC,MAAM,KA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AAC,cAAc,EAAE,KAAK,CAAC,CAAC;YACrC,IAAI,KAAK,EAAE,CAAC;gBACV,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACtC,CAAC;QACH,CAAC,CAAC,CAAC;QAEL,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is the name of the platform that users will use to register the plugin in the Homebridge config.json
|
|
3
|
+
*/
|
|
4
|
+
export declare const PLATFORM_NAME = "DigitalIntercomHomebridgePlugin";
|
|
5
|
+
/**
|
|
6
|
+
* This must match the name of your plugin as defined the package.json `name` property
|
|
7
|
+
*/
|
|
8
|
+
export declare const PLUGIN_NAME = "homebridge-digital-intercom";
|
package/dist/settings.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is the name of the platform that users will use to register the plugin in the Homebridge config.json
|
|
3
|
+
*/
|
|
4
|
+
export const PLATFORM_NAME = "DigitalIntercomHomebridgePlugin";
|
|
5
|
+
/**
|
|
6
|
+
* This must match the name of your plugin as defined the package.json `name` property
|
|
7
|
+
*/
|
|
8
|
+
export const PLUGIN_NAME = "homebridge-digital-intercom";
|
|
9
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,iCAAiC,CAAC;AAE/D;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type CameraController, type CameraStreamingDelegate, type PrepareStreamCallback, type PrepareStreamRequest, type SnapshotRequest, type SnapshotRequestCallback, type StreamingRequest, type StreamRequestCallback } from "homebridge";
|
|
2
|
+
import { DigitalIntercomPlatformAccessory } from "./platformAccessory.js";
|
|
3
|
+
export declare class IntercomStreamingDelegate implements CameraStreamingDelegate {
|
|
4
|
+
private accessory;
|
|
5
|
+
private hap;
|
|
6
|
+
private pendingSessions;
|
|
7
|
+
private activeSession;
|
|
8
|
+
private readonly rtpPorts;
|
|
9
|
+
private ffmpegOptions;
|
|
10
|
+
controller: CameraController;
|
|
11
|
+
constructor(paccessory: DigitalIntercomPlatformAccessory);
|
|
12
|
+
handleSnapshotRequest(request: SnapshotRequest, callback: SnapshotRequestCallback): void;
|
|
13
|
+
prepareStream(request: PrepareStreamRequest, callback: PrepareStreamCallback): Promise<void>;
|
|
14
|
+
handleStreamRequest(request: StreamingRequest, callback: StreamRequestCallback): void;
|
|
15
|
+
private startStream;
|
|
16
|
+
private stopStream;
|
|
17
|
+
}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import getPort from "get-port";
|
|
2
|
+
import { exec } from "node:child_process";
|
|
3
|
+
import { FfmpegCodecs, FfmpegOptions, RtpDemuxer, RtpPortAllocator, } from "homebridge-plugin-utils";
|
|
4
|
+
import { Command } from "./constants.js";
|
|
5
|
+
import sharp from "sharp";
|
|
6
|
+
import pathToFfmpeg from "ffmpeg-for-homebridge";
|
|
7
|
+
const videomtu = 188 * 5;
|
|
8
|
+
const audiomtu = 188 * 1;
|
|
9
|
+
const ONE_SECOND = 1000;
|
|
10
|
+
export class IntercomStreamingDelegate {
|
|
11
|
+
accessory;
|
|
12
|
+
hap;
|
|
13
|
+
pendingSessions = {};
|
|
14
|
+
activeSession = null;
|
|
15
|
+
rtpPorts = new RtpPortAllocator();
|
|
16
|
+
ffmpegOptions = new FfmpegOptions({
|
|
17
|
+
codecSupport: new FfmpegCodecs({ log: console }),
|
|
18
|
+
hardwareDecoding: true,
|
|
19
|
+
hardwareTranscoding: true,
|
|
20
|
+
log: console,
|
|
21
|
+
name: () => "Intercom Streaming Delegate",
|
|
22
|
+
});
|
|
23
|
+
controller;
|
|
24
|
+
constructor(paccessory) {
|
|
25
|
+
this.accessory = paccessory;
|
|
26
|
+
this.hap = paccessory.hap;
|
|
27
|
+
const options = {
|
|
28
|
+
cameraStreamCount: 2, // HomeKit requires at least 2 streams, and HomeKit Secure Video requires 1.
|
|
29
|
+
delegate: this,
|
|
30
|
+
streamingOptions: {
|
|
31
|
+
supportedCryptoSuites: [
|
|
32
|
+
0 /* this.hap.SRTPCryptoSuites.AES_CM_128_HMAC_SHA1_80 */,
|
|
33
|
+
],
|
|
34
|
+
video: {
|
|
35
|
+
resolutions: [
|
|
36
|
+
// Width, height, framerate.
|
|
37
|
+
[1920, 1080, 30],
|
|
38
|
+
[1280, 960, 30],
|
|
39
|
+
[1280, 720, 30],
|
|
40
|
+
[1024, 768, 30],
|
|
41
|
+
[640, 480, 30],
|
|
42
|
+
[640, 360, 30],
|
|
43
|
+
[480, 360, 30],
|
|
44
|
+
[480, 270, 30],
|
|
45
|
+
[320, 240, 30],
|
|
46
|
+
[320, 240, 15], // Apple Watch requires this configuration
|
|
47
|
+
[320, 180, 30],
|
|
48
|
+
],
|
|
49
|
+
codec: {
|
|
50
|
+
profiles: [
|
|
51
|
+
0 /* this.hap.H264Profile.BASELINE */,
|
|
52
|
+
1 /* this.hap.H264Profile.MAIN */,
|
|
53
|
+
2 /* this.hap.H264Profile.HIGH */,
|
|
54
|
+
],
|
|
55
|
+
levels: [
|
|
56
|
+
0 /* this.hap.H264Level.LEVEL3_1 */,
|
|
57
|
+
1 /* this.hap.H264Level.LEVEL3_2 */,
|
|
58
|
+
2 /* this.hap.H264Level.LEVEL4_0 */,
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
audio: {
|
|
63
|
+
twoWayAudio: true,
|
|
64
|
+
codecs: [
|
|
65
|
+
// TODO: changing these values seems to do nothing
|
|
66
|
+
{
|
|
67
|
+
type: "AAC-eld" /* AudioStreamingCodecType.AAC_ELD */,
|
|
68
|
+
samplerate: 16 /* AudioStreamingSamplerate.KHZ_16 */,
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
this.controller = new this.hap.CameraController(options);
|
|
75
|
+
this.controller.on("microphone-change", () => {
|
|
76
|
+
if (this.activeSession === null) {
|
|
77
|
+
console.error("No session currently active");
|
|
78
|
+
}
|
|
79
|
+
else if (this.activeSession.microphoneMuted === null) {
|
|
80
|
+
this.activeSession.microphoneMuted = true;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
this.activeSession.microphoneMuted =
|
|
84
|
+
!this.activeSession.microphoneMuted;
|
|
85
|
+
}
|
|
86
|
+
console.log("Microphone muted", this.activeSession?.microphoneMuted);
|
|
87
|
+
if (this.activeSession?.microphoneMuted) {
|
|
88
|
+
this.accessory.sendCommand(Command.LISTEN_ON);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
this.accessory.sendCommand(Command.TALK_ON);
|
|
92
|
+
}
|
|
93
|
+
this.controller.setMicrophoneMuted(true);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
handleSnapshotRequest(request, callback) {
|
|
97
|
+
console.log("Received snapshot request", request);
|
|
98
|
+
sharp("assets/snapshot.png")
|
|
99
|
+
.resize(request.width, request.height, { fit: "cover" })
|
|
100
|
+
.toBuffer()
|
|
101
|
+
.then((buffer) => {
|
|
102
|
+
callback(undefined, buffer);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
async prepareStream(request, callback) {
|
|
106
|
+
console.log("Prepare stream request", request);
|
|
107
|
+
const videoReturnPort = await getPort();
|
|
108
|
+
const videoSSRC = this.hap.CameraController.generateSynchronisationSource();
|
|
109
|
+
const audioSSRC = this.hap.CameraController.generateSynchronisationSource();
|
|
110
|
+
let reservePortFailed = false;
|
|
111
|
+
const rtpPortReservations = [];
|
|
112
|
+
const reservePort = async (ipFamily = "ipv4", portCount = 1) => {
|
|
113
|
+
// If we've already failed, don't keep trying to find more ports.
|
|
114
|
+
if (reservePortFailed) {
|
|
115
|
+
return -1;
|
|
116
|
+
}
|
|
117
|
+
// Retrieve the ports we're looking for.
|
|
118
|
+
const assignedPort = await this.rtpPorts.reserve(ipFamily, portCount);
|
|
119
|
+
// We didn't get the ports we requested.
|
|
120
|
+
if (assignedPort === -1) {
|
|
121
|
+
reservePortFailed = true;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
// Add this reservation the list of ports we've successfully requested.
|
|
125
|
+
rtpPortReservations.push(assignedPort);
|
|
126
|
+
if (portCount === 2) {
|
|
127
|
+
rtpPortReservations.push(assignedPort + 1);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Return them.
|
|
131
|
+
return assignedPort;
|
|
132
|
+
};
|
|
133
|
+
const audioIncomingRtcpPort = await reservePort(request.addressVersion);
|
|
134
|
+
const audioIncomingPort = await reservePort(request.addressVersion);
|
|
135
|
+
const audioIncomingRtpPort = await reservePort(request.addressVersion, 2);
|
|
136
|
+
const rtpDemuxer = new RtpDemuxer(request.addressVersion, audioIncomingPort, audioIncomingRtcpPort, audioIncomingRtpPort, console);
|
|
137
|
+
const sessionInfo = {
|
|
138
|
+
address: request.targetAddress,
|
|
139
|
+
addressVersion: request.addressVersion,
|
|
140
|
+
videoPort: request.video.port,
|
|
141
|
+
videoReturnPort: videoReturnPort,
|
|
142
|
+
videoCryptoSuite: request.video.srtpCryptoSuite,
|
|
143
|
+
videoSRTP: Buffer.concat([
|
|
144
|
+
request.video.srtp_key,
|
|
145
|
+
request.video.srtp_salt,
|
|
146
|
+
]),
|
|
147
|
+
videoSSRC: videoSSRC,
|
|
148
|
+
rtpDemuxer,
|
|
149
|
+
audioPort: request.audio.port,
|
|
150
|
+
audioCryptoSuite: request.audio.srtpCryptoSuite,
|
|
151
|
+
audioSRTP: Buffer.concat([
|
|
152
|
+
request.audio.srtp_key,
|
|
153
|
+
request.audio.srtp_salt,
|
|
154
|
+
]),
|
|
155
|
+
audioSSRC: audioSSRC,
|
|
156
|
+
audioIncomingRtpPort: audioIncomingRtpPort,
|
|
157
|
+
audioIncomingRtcpPort: audioIncomingRtcpPort,
|
|
158
|
+
audioIncomingPort: audioIncomingPort,
|
|
159
|
+
};
|
|
160
|
+
this.pendingSessions[request.sessionID] = sessionInfo;
|
|
161
|
+
const response = {
|
|
162
|
+
video: {
|
|
163
|
+
port: videoReturnPort,
|
|
164
|
+
ssrc: videoSSRC,
|
|
165
|
+
srtp_key: request.video.srtp_key,
|
|
166
|
+
srtp_salt: request.video.srtp_salt,
|
|
167
|
+
},
|
|
168
|
+
audio: {
|
|
169
|
+
port: audioIncomingPort,
|
|
170
|
+
ssrc: audioSSRC,
|
|
171
|
+
srtp_key: request.audio.srtp_key,
|
|
172
|
+
srtp_salt: request.audio.srtp_salt,
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
console.log("Prepared stream response", response);
|
|
176
|
+
callback(undefined, response);
|
|
177
|
+
}
|
|
178
|
+
handleStreamRequest(request, callback) {
|
|
179
|
+
const sessionInfo = this.pendingSessions[request.sessionID];
|
|
180
|
+
switch (request.type) {
|
|
181
|
+
case "start" /* StreamRequestTypes.START */:
|
|
182
|
+
this.startStream(request, sessionInfo, callback);
|
|
183
|
+
break;
|
|
184
|
+
case "stop" /* StreamRequestTypes.STOP */:
|
|
185
|
+
this.stopStream(request, callback);
|
|
186
|
+
break;
|
|
187
|
+
default:
|
|
188
|
+
console.error("Unknown stream request type", request.type);
|
|
189
|
+
callback(undefined);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
async startStream(request, sessionInfo, callback) {
|
|
193
|
+
if (this.activeSession !== null) {
|
|
194
|
+
// TODO: it would be better to actually check the stream status,
|
|
195
|
+
// e.g. if it is transmitting data, and if not, kill it.
|
|
196
|
+
if (this.activeSession.startTime + ONE_SECOND * 120 < Date.now()) {
|
|
197
|
+
console.log("Stream already active, killing old session");
|
|
198
|
+
this.stopStream({
|
|
199
|
+
sessionID: this.activeSession.sessionID,
|
|
200
|
+
type: "stop" /* StreamRequestTypes.STOP */,
|
|
201
|
+
}, callback);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
const stopped = await new Promise((resolve) => {
|
|
205
|
+
(async () => {
|
|
206
|
+
for (let i = 0; i < 30; i++) {
|
|
207
|
+
await new Promise((innerResolve) => setTimeout(innerResolve, ONE_SECOND));
|
|
208
|
+
if (!this.activeSession) {
|
|
209
|
+
resolve(true);
|
|
210
|
+
}
|
|
211
|
+
if (this.activeSession &&
|
|
212
|
+
this.activeSession.startTime + ONE_SECOND * 120 < Date.now()) {
|
|
213
|
+
this.stopStream({
|
|
214
|
+
sessionID: this.activeSession.sessionID,
|
|
215
|
+
type: "stop" /* StreamRequestTypes.STOP */,
|
|
216
|
+
}, callback);
|
|
217
|
+
resolve(true);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
resolve(false);
|
|
221
|
+
})();
|
|
222
|
+
});
|
|
223
|
+
if (!stopped) {
|
|
224
|
+
console.error("Stream already active, not starting new stream");
|
|
225
|
+
callback(new Error("Stream already active"));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
console.log("Starting stream", request);
|
|
231
|
+
this.accessory.sendCommand(Command.LISTEN_ON);
|
|
232
|
+
const shell = process.platform === "win32" ? "powershell" : undefined;
|
|
233
|
+
// 1. INPUT GENERATORS
|
|
234
|
+
// const videoInput = `-f lavfi -i color=c=red:s=${request.video.width}x${request.video.height}:r=${request.video.fps}`;
|
|
235
|
+
const videoInput = `-f lavfi -i "movie=assets/snapshot.png:loop=0,setpts=N/(${request.video.fps}*TB)"`;
|
|
236
|
+
// Replace anullsrc with sine wave generator
|
|
237
|
+
// f=1000 sets the pitch to 1kHz
|
|
238
|
+
const audioInput = `-fflags nobuffer -flags low_delay -analyzeduration 0 -probesize 32 ` +
|
|
239
|
+
// `-f lavfi -i "sine=frequency=1000:sample_rate=16000"`;
|
|
240
|
+
`-ac 1 -f u16le -ar 32000 -i "udp://0.0.0.0:9999?pkt_size=1024&fifo_size=1000000&overrun_nonfatal=0"`;
|
|
241
|
+
// 2. VIDEO ARGUMENTS
|
|
242
|
+
const ffmpegVideoArgs = ` -map 0:0 -vcodec libx264 -pix_fmt yuvj420p -r ${request.video.fps} -f rawvideo -probesize 32 -analyzeduration 0 -fflags nobuffer -preset veryfast -refs 1 -x264-params intra-refresh=1:bframes=0 -b:v ${request.video.max_bit_rate}k -bufsize ${2 * request.video.max_bit_rate}k -maxrate ${request.video.max_bit_rate}k -payload_type ${request.video.pt}`;
|
|
243
|
+
const ffmpegVideoStream = ` -ssrc ${sessionInfo.videoSSRC} -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params ${sessionInfo.videoSRTP.toString("base64")} 'srtp://${sessionInfo.address}:${sessionInfo.videoPort}?rtcpport=${sessionInfo.videoPort}&localrtcpport=${sessionInfo.videoPort}&pkt_size=${videomtu}'`;
|
|
244
|
+
// 3. AUDIO ARGUMENTS
|
|
245
|
+
let ffmpegAudioFull = "";
|
|
246
|
+
const ffmpegAudioArgs = ` -map 1:0 -acodec libfdk_aac -profile:a aac_eld -flags +global_header -f null -ar ${request.audio.sample_rate}k -b:a ${request.audio.max_bit_rate}k -bufsize ${2 * request.audio.max_bit_rate}k -ac ${request.audio.channel} -payload_type ${request.audio.pt}`;
|
|
247
|
+
// const ffmpegAudioArgs = ` -map 1:0 -flags +global_header -f null -ar ${request.audio.sample_rate}k -b:a ${request.audio.max_bit_rate}k -bufsize ${2 * request.audio.max_bit_rate}k -ac 1 -payload_type ${request.audio.pt}`;
|
|
248
|
+
const ffmpegAudioStream = ` -ssrc ${sessionInfo.audioSSRC} -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params ${sessionInfo.audioSRTP.toString("base64")} 'srtp://${sessionInfo.address}:${sessionInfo.audioPort}?rtcpport=${sessionInfo.audioPort}&localrtcpport=${sessionInfo.audioPort}&pkt_size=${audiomtu}'`;
|
|
249
|
+
// const ffmpegAudioStream = "";
|
|
250
|
+
ffmpegAudioFull = `${ffmpegAudioArgs}${ffmpegAudioStream}`;
|
|
251
|
+
// 4. FINAL ASSEMBLY
|
|
252
|
+
// const debugFlag = this.platform.debugMode ? ' -loglevel debug' : '';
|
|
253
|
+
const fcmd = `${videoInput} ${audioInput}${ffmpegVideoArgs}${ffmpegVideoStream}${ffmpegAudioFull}`;
|
|
254
|
+
const ffmpegProcess = exec(`${pathToFfmpeg} ${fcmd}`, { shell });
|
|
255
|
+
const sdpIpVersion = sessionInfo.addressVersion === "ipv6" ? "IP6" : "IP4";
|
|
256
|
+
console.log("Return sample rate", request.audio.sample_rate);
|
|
257
|
+
const sdpReturnAudio = [
|
|
258
|
+
"v=0",
|
|
259
|
+
"o=- 0 0 IN " + sdpIpVersion + " 127.0.0.1",
|
|
260
|
+
"s=" + "Akash Audio Talkback",
|
|
261
|
+
"c=IN " + sdpIpVersion + " " + sessionInfo.address,
|
|
262
|
+
"t=0 0",
|
|
263
|
+
"m=audio " +
|
|
264
|
+
sessionInfo.audioIncomingRtpPort.toString() +
|
|
265
|
+
" RTP/AVP " +
|
|
266
|
+
request.audio.pt.toString(),
|
|
267
|
+
"b=AS:24",
|
|
268
|
+
"a=rtpmap:110 MPEG4-GENERIC/" +
|
|
269
|
+
(request.audio.sample_rate === 16 /* AudioStreamingSamplerate.KHZ_16 */
|
|
270
|
+
? "16000"
|
|
271
|
+
: "24000") +
|
|
272
|
+
"/" +
|
|
273
|
+
request.audio.channel.toString(),
|
|
274
|
+
"a=fmtp:110 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=" +
|
|
275
|
+
(request.audio.sample_rate === 16 /* AudioStreamingSamplerate.KHZ_16 */
|
|
276
|
+
? "F8F0212C00BC00"
|
|
277
|
+
: "F8EC212C00BC00"),
|
|
278
|
+
"a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:" +
|
|
279
|
+
sessionInfo.audioSRTP.toString("base64"),
|
|
280
|
+
].join("\n");
|
|
281
|
+
const ffmpegReturnAudioCmd = [
|
|
282
|
+
"-hide_banner",
|
|
283
|
+
"-nostats",
|
|
284
|
+
"-protocol_whitelist",
|
|
285
|
+
"crypto,file,pipe,rtp,udp",
|
|
286
|
+
"-f",
|
|
287
|
+
"sdp",
|
|
288
|
+
"-codec:a",
|
|
289
|
+
this.ffmpegOptions.audioDecoder,
|
|
290
|
+
"-i",
|
|
291
|
+
"pipe:0",
|
|
292
|
+
"-map",
|
|
293
|
+
"0:a:0",
|
|
294
|
+
...this.ffmpegOptions.audioEncoder(),
|
|
295
|
+
"-flags",
|
|
296
|
+
"+global_header",
|
|
297
|
+
"-ar",
|
|
298
|
+
"16000", //this.protectCamera.ufp.talkbackSettings.samplingRate.toString(),
|
|
299
|
+
// "-b:a",
|
|
300
|
+
// request.audio.max_bit_rate.toString() + "k",
|
|
301
|
+
"-ac",
|
|
302
|
+
"1", //this.protectCamera.ufp.talkbackSettings.channels.toString(),
|
|
303
|
+
"-f",
|
|
304
|
+
"s16le",
|
|
305
|
+
`udp://${this.accessory.getSocketAddress()}:9997?pkt_size=1024`,
|
|
306
|
+
];
|
|
307
|
+
// TODO: handle no socket address
|
|
308
|
+
const returnFfmpegProcess = exec(`${pathToFfmpeg} ${ffmpegReturnAudioCmd.join(" ")}`, { shell });
|
|
309
|
+
returnFfmpegProcess.stdin?.end(sdpReturnAudio + "\n");
|
|
310
|
+
this.activeSession = {
|
|
311
|
+
sessionID: request.sessionID,
|
|
312
|
+
startTime: Date.now(),
|
|
313
|
+
ffmpegProcess,
|
|
314
|
+
returnFfmpegProcess,
|
|
315
|
+
microphoneMuted: null,
|
|
316
|
+
rtpDemuxer: sessionInfo.rtpDemuxer,
|
|
317
|
+
};
|
|
318
|
+
this.controller.setMicrophoneMuted(true);
|
|
319
|
+
callback(undefined);
|
|
320
|
+
}
|
|
321
|
+
stopStream(request, callback) {
|
|
322
|
+
console.log("Stopping stream", request);
|
|
323
|
+
this.accessory.sendCommand(Command.LISTEN_STOP);
|
|
324
|
+
if (this.activeSession === null) {
|
|
325
|
+
console.error("No session currently active");
|
|
326
|
+
callback();
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (this.activeSession.sessionID !== request.sessionID) {
|
|
330
|
+
console.warn("Session ID mismatch", this.activeSession.sessionID, request.sessionID);
|
|
331
|
+
}
|
|
332
|
+
this.activeSession.ffmpegProcess.kill("SIGKILL");
|
|
333
|
+
this.activeSession.returnFfmpegProcess.kill("SIGKILL");
|
|
334
|
+
this.activeSession.rtpDemuxer.close();
|
|
335
|
+
this.activeSession = null;
|
|
336
|
+
console.log("Stream stopped");
|
|
337
|
+
callback(undefined);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
// TODO: setInterval to check if the stream is still active, and if not, stop it and clean up
|
|
341
|
+
//# sourceMappingURL=streamingDelegate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamingDelegate.js","sourceRoot":"","sources":["../src/streamingDelegate.ts"],"names":[],"mappings":"AAoBA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAgB,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,YAAY,EACZ,aAAa,EACb,UAAU,EACV,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,YAAY,MAAM,uBAAuB,CAAC;AAEjD,MAAM,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC;AACzB,MAAM,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC;AACzB,MAAM,UAAU,GAAG,IAAI,CAAC;AAgCxB,MAAM,OAAO,yBAAyB;IAC5B,SAAS,CAAmC;IAC5C,GAAG,CAAM;IACT,eAAe,GAAgC,EAAE,CAAC;IAClD,aAAa,GAAyB,IAAI,CAAC;IA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UAAU;SACnC,CAAC;QAEF,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACzC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACtB,CAAC;IAEO,UAAU,CAChB,OAA0B,EAC1B,QAA+B;QAE/B,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;QACxC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChD,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;YAChC,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;YAC7C,QAAQ,EAAE,CAAC;YACX,OAAO;QACT,CAAC;QAED,IAAI,IAAI,CAAC,aAAa,CAAC,SAAS,KAAK,OAAO,CAAC,SAAS,EAAE,CAAC;YACvD,OAAO,CAAC,IAAI,CACV,qBAAqB,EACrB,IAAI,CAAC,aAAa,CAAC,SAAS,EAC5B,OAAO,CAAC,SAAS,CAClB,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACjD,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvD,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACtC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAE1B,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC9B,QAAQ,CAAC,SAAS,CAAC,CAAC;IACtB,CAAC;CACF;AAED,6FAA6F"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "homebridge-digital-intercom",
|
|
3
|
+
"displayName": "Digital Intercom",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"description": "Homebridge plugin that integrates with the Digital Intercom system",
|
|
7
|
+
"author": "Nisala Kalupahana",
|
|
8
|
+
"license": "AGPL-3.0",
|
|
9
|
+
"homepage": "https://github.com/nkalupahana/digital-intercom#readme",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/nkalupahana/digital-intercom.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/nkalupahana/digital-intercom/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"homebridge-plugin"
|
|
19
|
+
],
|
|
20
|
+
"main": "dist/index.js",
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": "^20.18.0 || ^22.10.0 || ^24.0.0",
|
|
23
|
+
"homebridge": "^1.8.0 || ^2.0.0-beta.0"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "rimraf ./dist && tsc",
|
|
27
|
+
"lint": "eslint . --max-warnings=0",
|
|
28
|
+
"prepublishOnly": "npm run lint && npm run build",
|
|
29
|
+
"watch": "npm run build && npm link && nodemon"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"ffmpeg-for-homebridge": "^2.2.1",
|
|
33
|
+
"get-port": "^7.1.0",
|
|
34
|
+
"homebridge-lib": "^7.1.12",
|
|
35
|
+
"homebridge-plugin-utils": "^1.30.0",
|
|
36
|
+
"ip": "^2.0.1",
|
|
37
|
+
"sharp": "^0.34.5"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@eslint/js": "^9.39.1",
|
|
41
|
+
"@types/node": "^24.10.1",
|
|
42
|
+
"eslint": "^9.39.1",
|
|
43
|
+
"eslint-config-prettier": "^10.1.8",
|
|
44
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
45
|
+
"homebridge": "^1.11.1",
|
|
46
|
+
"nodemon": "^3.1.11",
|
|
47
|
+
"prettier": "3.8.1",
|
|
48
|
+
"rimraf": "^6.1.0",
|
|
49
|
+
"ts-node": "^10.9.2",
|
|
50
|
+
"typescript": "^5.9.3",
|
|
51
|
+
"typescript-eslint": "^8.46.4"
|
|
52
|
+
}
|
|
53
|
+
}
|