@uboness/homebridge-tedee 0.1.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +17 -0
  3. package/README.md +41 -0
  4. package/config.schema.json +146 -0
  5. package/dist/common.d.ts +25 -0
  6. package/dist/common.d.ts.map +1 -0
  7. package/dist/common.js +51 -0
  8. package/dist/common.js.map +1 -0
  9. package/dist/device/device.d.ts +26 -0
  10. package/dist/device/device.d.ts.map +1 -0
  11. package/dist/device/device.js +46 -0
  12. package/dist/device/device.js.map +1 -0
  13. package/dist/device/index.d.ts +5 -0
  14. package/dist/device/index.d.ts.map +1 -0
  15. package/dist/device/index.js +5 -0
  16. package/dist/device/index.js.map +1 -0
  17. package/dist/device/lock.d.ts +28 -0
  18. package/dist/device/lock.d.ts.map +1 -0
  19. package/dist/device/lock.js +175 -0
  20. package/dist/device/lock.js.map +1 -0
  21. package/dist/index.d.ts +4 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +6 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/logger.d.ts +16 -0
  26. package/dist/logger.d.ts.map +1 -0
  27. package/dist/logger.js +26 -0
  28. package/dist/logger.js.map +1 -0
  29. package/dist/settings.d.ts +9 -0
  30. package/dist/settings.d.ts.map +1 -0
  31. package/dist/settings.js +10 -0
  32. package/dist/settings.js.map +1 -0
  33. package/dist/tedee-client.d.ts +51 -0
  34. package/dist/tedee-client.d.ts.map +1 -0
  35. package/dist/tedee-client.js +442 -0
  36. package/dist/tedee-client.js.map +1 -0
  37. package/dist/tedee-event-server.d.ts +25 -0
  38. package/dist/tedee-event-server.d.ts.map +1 -0
  39. package/dist/tedee-event-server.js +109 -0
  40. package/dist/tedee-event-server.js.map +1 -0
  41. package/dist/tedee-platform.d.ts +51 -0
  42. package/dist/tedee-platform.d.ts.map +1 -0
  43. package/dist/tedee-platform.js +186 -0
  44. package/dist/tedee-platform.js.map +1 -0
  45. package/dist/tedee.d.ts +99 -0
  46. package/dist/tedee.d.ts.map +1 -0
  47. package/dist/tedee.js +30 -0
  48. package/dist/tedee.js.map +1 -0
  49. package/package.json +66 -0
  50. package/tsconfig.json +31 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
+
5
+ ## 0.1.1 (2026-06-02)
6
+
7
+ ## 0.1.0
8
+
9
+ - Initial Tedee local Bridge API platform implementation.
package/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ https://www.apache.org/licenses/
4
+
5
+ Copyright 2026 uboness
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ https://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Homebridge Tedee
2
+
3
+ Homebridge plugin for Tedee locks using the local Tedee Bridge API only.
4
+
5
+ ## Local Development
6
+
7
+ Install dependencies with pnpm:
8
+
9
+ ```sh
10
+ pnpm install
11
+ ```
12
+
13
+ Edit `.homebridge/config.json` with your Tedee Bridge IP or hostname and local API token.
14
+
15
+ Run Homebridge locally:
16
+
17
+ ```sh
18
+ pnpm run homebridge
19
+ ```
20
+
21
+ Run the Homebridge UI locally:
22
+
23
+ ```sh
24
+ pnpm run ui
25
+ ```
26
+
27
+ ## Tedee Features
28
+
29
+ - Discovers all locks paired to the configured Tedee Bridge.
30
+ - Exposes each lock as a HomeKit Lock Mechanism.
31
+ - Adds a Battery service per lock with battery level, low battery, and charging state.
32
+ - Adds a linked momentary Switch service for pulling the spring.
33
+ - Starts one platform-level local callback server and registers it with the Tedee Bridge.
34
+
35
+ ## Webhook Registration
36
+
37
+ The callback server is mandatory and is managed by the plugin. It listens on `webhookPort` when configured, or `8088` by default, and uses a hard-coded internal path.
38
+
39
+ On startup, after the local server is listening, the plugin resolves the local Homebridge host address by checking which local network interface would be used to reach the Tedee Bridge. It then registers a single POST callback with the Tedee Bridge.
40
+
41
+ The callback record is tagged with an internal `X-Homebridge-Tedee-Instance` header. On restart, the plugin finds that existing callback and updates it if the URL changed. Any duplicate callbacks with the same internal instance header are removed. The callback is not removed on normal shutdown; this avoids callback create/delete churn, and the next startup will update the existing record.
@@ -0,0 +1,146 @@
1
+ {
2
+ "pluginAlias": "Tedee",
3
+ "pluginType": "platform",
4
+ "singular": true,
5
+ "schema": {
6
+ "type": "object",
7
+ "properties": {
8
+ "name": {
9
+ "title": "Name",
10
+ "type": "string",
11
+ "required": false,
12
+ "default": "Tedee"
13
+ },
14
+ "host": {
15
+ "title": "Tedee Bridge IP/Host",
16
+ "type": "string",
17
+ "required": true,
18
+ "description": "The local IP address or hostname of the Tedee Bridge API."
19
+ },
20
+ "port": {
21
+ "title": "Bridge Port",
22
+ "type": "number",
23
+ "required": false,
24
+ "default": 80,
25
+ "description": "The local Tedee Bridge API port."
26
+ },
27
+ "token": {
28
+ "title": "API Token",
29
+ "type": "string",
30
+ "required": true,
31
+ "description": "The local Bridge API token from the Tedee app."
32
+ },
33
+ "tokenMode": {
34
+ "title": "Token Mode",
35
+ "type": "string",
36
+ "required": false,
37
+ "default": "plain",
38
+ "oneOf": [
39
+ {
40
+ "title": "Plain",
41
+ "enum": [
42
+ "plain"
43
+ ]
44
+ },
45
+ {
46
+ "title": "Encrypted",
47
+ "enum": [
48
+ "encrypted"
49
+ ]
50
+ }
51
+ ]
52
+ },
53
+ "apiVersion": {
54
+ "title": "Bridge API Version",
55
+ "type": "string",
56
+ "required": false,
57
+ "default": "v1.0"
58
+ },
59
+ "unlockMode": {
60
+ "title": "Unlock Mode",
61
+ "type": "number",
62
+ "required": false,
63
+ "default": 3,
64
+ "oneOf": [
65
+ {
66
+ "title": "Normal",
67
+ "enum": [
68
+ 0
69
+ ]
70
+ },
71
+ {
72
+ "title": "Force",
73
+ "enum": [
74
+ 2
75
+ ]
76
+ },
77
+ {
78
+ "title": "Without Pull",
79
+ "enum": [
80
+ 3
81
+ ]
82
+ },
83
+ {
84
+ "title": "Unlock Or Pull",
85
+ "enum": [
86
+ 4
87
+ ]
88
+ }
89
+ ],
90
+ "description": "Mode used when HomeKit unlocks the main lock service. The default avoids pulling the spring because a separate switch is exposed for that."
91
+ },
92
+ "lowBatteryThreshold": {
93
+ "title": "Low Battery Threshold",
94
+ "type": "number",
95
+ "required": false,
96
+ "default": 20,
97
+ "minimum": 1,
98
+ "maximum": 100
99
+ },
100
+ "refreshInterval": {
101
+ "title": "Refresh Interval",
102
+ "type": "number",
103
+ "required": false,
104
+ "default": 600000,
105
+ "description": "Periodic full refresh interval in milliseconds. Set to 0 to disable."
106
+ },
107
+ "webhookPort": {
108
+ "title": "Webhook Port",
109
+ "type": "number",
110
+ "required": false,
111
+ "default": 8088,
112
+ "minimum": 0,
113
+ "maximum": 65535,
114
+ "description": "Local port used by the plugin's mandatory Tedee callback server. The callback host and path are managed automatically."
115
+ },
116
+ "locks": {
117
+ "title": "Locks",
118
+ "type": "array",
119
+ "required": false,
120
+ "items": {
121
+ "title": "Lock",
122
+ "type": "object",
123
+ "properties": {
124
+ "id": {
125
+ "title": "ID",
126
+ "type": "number",
127
+ "required": true
128
+ },
129
+ "ignore": {
130
+ "title": "Ignore This Lock",
131
+ "type": "boolean",
132
+ "required": false,
133
+ "default": false
134
+ },
135
+ "pullSpringSwitch": {
136
+ "title": "Show Pull Spring Switch",
137
+ "type": "boolean",
138
+ "required": false,
139
+ "default": true
140
+ }
141
+ }
142
+ }
143
+ }
144
+ }
145
+ }
146
+ }
@@ -0,0 +1,25 @@
1
+ export type Detachable = {
2
+ detach: () => void;
3
+ };
4
+ export type Nil = null | undefined;
5
+ export type Promisable<T = void> = T | Promise<T>;
6
+ export type ValueCallback<V, R = void> = (value: V) => Promisable<R>;
7
+ export declare const isNil: (value: any) => value is Nil;
8
+ export declare const isNumber: (value: any) => value is number;
9
+ export type JSON = JSONPrimitive | JSONObject | JSONArray;
10
+ export type JSONPrimitive = string | number | boolean | null;
11
+ export type JSONArray = JSON[];
12
+ export type JSONObject = {
13
+ [key: string]: JSON;
14
+ };
15
+ export declare const sleep: (ms: number) => Promise<void>;
16
+ export declare const clamp: (value: number, min: number, max: number) => number;
17
+ export declare const toBoolean: (value: unknown) => boolean;
18
+ export declare const spliceFirstMatch: <T = any>(array: T[], predicate: (value: T) => boolean) => T | undefined;
19
+ export declare class Detachables implements Detachable {
20
+ private detachables;
21
+ constructor(detachables?: Detachable[]);
22
+ add(detachable: Detachable): Detachable;
23
+ detach(): void;
24
+ }
25
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IAAE,MAAM,EAAE,MAAM,IAAI,CAAC;CAAE,CAAA;AAChD,MAAM,MAAM,GAAG,GAAG,IAAI,GAAG,SAAS,CAAC;AAEnC,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAClD,MAAM,MAAM,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC;AAErE,eAAO,MAAM,KAAK,GAAI,OAAO,GAAG,KAAG,KAAK,IAAI,GAA4C,CAAC;AACzF,eAAO,MAAM,QAAQ,GAAI,OAAO,GAAG,KAAG,KAAK,IAAI,MAA4E,CAAC;AAE5H,MAAM,MAAM,IAAI,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,CAAC;AAC1D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAC7D,MAAM,MAAM,SAAS,GAAG,IAAI,EAAE,CAAC;AAC/B,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAEjD,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,kBAA0D,CAAC;AAE3F,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,WAAwC,CAAC;AAEtG,eAAO,MAAM,SAAS,GAAI,OAAO,OAAO,KAAG,OAW1C,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,CAAC,GAAG,GAAG,EAAE,OAAO,CAAC,EAAE,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,KAAG,CAAC,GAAG,SAQ5F,CAAA;AAED,qBAAa,WAAY,YAAW,UAAU;IAE1C,OAAO,CAAC,WAAW,CAAe;gBAEtB,WAAW,GAAE,UAAU,EAAO;IAI1C,GAAG,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;IAWvC,MAAM,IAAI,IAAI;CASjB"}
package/dist/common.js ADDED
@@ -0,0 +1,51 @@
1
+ export const isNil = (value) => value === null || value === undefined;
2
+ export const isNumber = (value) => !isNil(value) && typeof value === 'number' && !Number.isNaN(value);
3
+ export const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
4
+ export const clamp = (value, min, max) => Math.min(max, Math.max(min, value));
5
+ export const toBoolean = (value) => {
6
+ if (typeof value === 'boolean') {
7
+ return value;
8
+ }
9
+ if (typeof value === 'number') {
10
+ return value !== 0;
11
+ }
12
+ if (typeof value === 'string') {
13
+ return value === '1' || value.toLowerCase() === 'true';
14
+ }
15
+ return false;
16
+ };
17
+ export const spliceFirstMatch = (array, predicate) => {
18
+ const index = array.findIndex(predicate);
19
+ if (index < 0) {
20
+ return;
21
+ }
22
+ const removed = array[index];
23
+ array.splice(index, 1);
24
+ return removed;
25
+ };
26
+ export class Detachables {
27
+ detachables;
28
+ constructor(detachables = []) {
29
+ this.detachables = detachables;
30
+ }
31
+ add(detachable) {
32
+ const _detachable = {
33
+ detach: () => {
34
+ detachable.detach();
35
+ spliceFirstMatch(this.detachables, d => d === _detachable);
36
+ }
37
+ };
38
+ this.detachables.push(_detachable);
39
+ return _detachable;
40
+ }
41
+ detach() {
42
+ while (this.detachables.length > 0) {
43
+ try {
44
+ this.detachables.pop()?.detach();
45
+ }
46
+ catch {
47
+ }
48
+ }
49
+ }
50
+ }
51
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAU,EAAgB,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AACzF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAU,EAAmB,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAO5H,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAE3F,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAEtG,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC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AAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC;gBACD,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC;YACrC,CAAC;YAAC,MAAM,CAAC;YACT,CAAC;QACL,CAAC;IACL,CAAC;CAEJ"}
@@ -0,0 +1,26 @@
1
+ import { Characteristic, PlatformAccessory, Service } from 'homebridge';
2
+ import { Detachables } from '../common.ts';
3
+ import { ILogger } from '../logger.ts';
4
+ import { Tedee } from '../tedee.ts';
5
+ import { TedeeClient } from '../tedee-client.ts';
6
+ import { TedeePlatform } from '../tedee-platform.ts';
7
+ export declare abstract class Device<D extends Tedee.Lock = Tedee.Lock> {
8
+ readonly platform: TedeePlatform;
9
+ readonly client: TedeeClient;
10
+ readonly accessory: PlatformAccessory;
11
+ readonly primaryService: Service;
12
+ readonly logger: ILogger;
13
+ protected device: D;
14
+ protected statusFault: Characteristic;
15
+ protected readonly detachables: Detachables;
16
+ protected constructor(platform: TedeePlatform, client: TedeeClient, accessory: PlatformAccessory, device: D, primaryService: Service);
17
+ get id(): number;
18
+ get type(): string;
19
+ get name(): string;
20
+ close(): Promise<void>;
21
+ setFault(fault: boolean): void;
22
+ abstract update(device: D): void;
23
+ abstract onEvent(event: Tedee.Event): Promise<void> | void;
24
+ abstract doClose(): Promise<void>;
25
+ }
26
+ //# sourceMappingURL=device.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/device/device.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,8BAAsB,MAAM,CAAC,CAAC,SAAS,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI;IAE1D,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEzB,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;IACpB,SAAS,CAAC,WAAW,EAAE,cAAc,CAAC;IACtC,SAAS,CAAC,QAAQ,CAAC,WAAW,cAAqB;IAEnD,SAAS,aAAa,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC,EAAE,cAAc,EAAE,OAAO;IAqBpI,IAAI,EAAE,WAEL;IAED,IAAI,IAAI,WAEP;IAED,IAAI,IAAI,WAEP;IAEK,KAAK;IAKX,QAAQ,CAAC,KAAK,EAAE,OAAO;IAIvB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI;IAEhC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAE1D,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CACpC"}
@@ -0,0 +1,46 @@
1
+ import { Detachables } from "../common.js";
2
+ export class Device {
3
+ platform;
4
+ client;
5
+ accessory;
6
+ primaryService;
7
+ logger;
8
+ device;
9
+ statusFault;
10
+ detachables = new Detachables();
11
+ constructor(platform, client, accessory, device, primaryService) {
12
+ this.platform = platform;
13
+ this.client = client;
14
+ this.accessory = accessory;
15
+ this.device = device;
16
+ this.logger = platform.logger.getLogger(this.type, this.name);
17
+ this.primaryService = primaryService;
18
+ this.primaryService.setPrimaryService(true);
19
+ this.primaryService.setCharacteristic(platform.Characteristic.Name, accessory.displayName);
20
+ this.primaryService.addOptionalCharacteristic(platform.Characteristic.StatusFault);
21
+ this.statusFault = this.primaryService.getCharacteristic(platform.Characteristic.StatusFault);
22
+ this.statusFault.setValue(false);
23
+ this.detachables.add(client.on('event', event => {
24
+ if (event.data.deviceId === this.id) {
25
+ void this.onEvent(event);
26
+ }
27
+ }));
28
+ }
29
+ get id() {
30
+ return this.device.id;
31
+ }
32
+ get type() {
33
+ return String(this.device.type);
34
+ }
35
+ get name() {
36
+ return this.device.name;
37
+ }
38
+ async close() {
39
+ this.detachables.detach();
40
+ await this.doClose();
41
+ }
42
+ setFault(fault) {
43
+ this.statusFault.setValue(fault);
44
+ }
45
+ }
46
+ //# sourceMappingURL=device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/device/device.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,OAAgB,MAAM;IAEf,QAAQ,CAAgB;IACxB,MAAM,CAAc;IACpB,SAAS,CAAoB;IAC7B,cAAc,CAAU;IACxB,MAAM,CAAU;IAEf,MAAM,CAAI;IACV,WAAW,CAAiB;IACnB,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;IAEnD,YAAsB,QAAuB,EAAE,MAAmB,EAAE,SAA4B,EAAE,MAAS,EAAE,cAAuB;QAChI,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,C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C,CAAC;IACrC,CAAC;CAOJ"}
@@ -0,0 +1,5 @@
1
+ import { Lock } from './lock.ts';
2
+ export declare const Devices: {
3
+ lock: typeof Lock;
4
+ };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/device/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,eAAO,MAAM,OAAO;;CAEnB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Lock } from "./lock.js";
2
+ export const Devices = {
3
+ lock: Lock
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/device/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,IAAI,EAAE,IAAI;CACb,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { PlatformAccessory } from 'homebridge';
2
+ import { Tedee } from '../tedee.ts';
3
+ import { TedeeClient } from '../tedee-client.ts';
4
+ import { TedeePlatform } from '../tedee-platform.ts';
5
+ import { Device } from './device.ts';
6
+ export declare class Lock extends Device<Tedee.Lock> {
7
+ static readonly create: (platform: TedeePlatform, client: TedeeClient, accessory: PlatformAccessory, device: Tedee.Lock) => Promise<Lock>;
8
+ private readonly currentState;
9
+ private readonly targetState;
10
+ private readonly batteryLevel;
11
+ private readonly chargingState;
12
+ private readonly lowBattery;
13
+ private readonly batteryService;
14
+ private readonly pullSpringService?;
15
+ private readonly pullSpringOn?;
16
+ private pullSpringResetTimer?;
17
+ private constructor();
18
+ update(device: Tedee.Lock): void;
19
+ onEvent(event: Tedee.Event): Promise<void>;
20
+ doClose(): Promise<void>;
21
+ private refresh;
22
+ private updateFaultState;
23
+ private updateBattery;
24
+ private normalizedBatteryLevel;
25
+ private toLockCurrentState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IAQxB,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,sBAAsB;IAO9B,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,iBAAiB;CAM5B"}
@@ -0,0 +1,175 @@
1
+ import { clamp, toBoolean } from "../common.js";
2
+ import { Tedee } from "../tedee.js";
3
+ import { Device } from "./device.js";
4
+ export class Lock extends Device {
5
+ static create = async (platform, client, accessory, device) => {
6
+ return new Lock(platform, client, accessory, device);
7
+ };
8
+ currentState;
9
+ targetState;
10
+ batteryLevel;
11
+ chargingState;
12
+ lowBattery;
13
+ batteryService;
14
+ pullSpringService;
15
+ pullSpringOn;
16
+ pullSpringResetTimer;
17
+ constructor(platform, client, accessory, device) {
18
+ const lockService = accessory.getService(platform.Service.LockMechanism) ?? accessory.addService(platform.Service.LockMechanism);
19
+ super(platform, client, accessory, device, lockService);
20
+ this.targetState = this.primaryService.getCharacteristic(platform.Characteristic.LockTargetState)
21
+ .setValue(this.toLockTargetState(device))
22
+ .onSet(async (value, context) => {
23
+ if (context?.fromTedee) {
24
+ return;
25
+ }
26
+ const secured = value === platform.Characteristic.LockTargetState.SECURED;
27
+ this.currentState.setValue(platform.Characteristic.LockCurrentState.UNKNOWN);
28
+ if (secured) {
29
+ await client.lock(device.id);
30
+ }
31
+ else {
32
+ await client.unlock(device.id, platform.unlockMode);
33
+ }
34
+ });
35
+ this.currentState = this.primaryService.getCharacteristic(platform.Characteristic.LockCurrentState)
36
+ .setValue(this.toLockCurrentState(device));
37
+ this.batteryService = accessory.getService(platform.Service.Battery) ?? accessory.addService(platform.Service.Battery);
38
+ this.batteryService.setCharacteristic(platform.Characteristic.Name, `${accessory.displayName} Battery`);
39
+ this.batteryLevel = this.batteryService.getCharacteristic(platform.Characteristic.BatteryLevel);
40
+ this.chargingState = this.batteryService.getCharacteristic(platform.Characteristic.ChargingState);
41
+ this.lowBattery = this.batteryService.getCharacteristic(platform.Characteristic.StatusLowBattery);
42
+ const pullSpringEnabled = platform.lockConfig(device.id)?.pullSpringSwitch !== false;
43
+ const cachedPullSpring = accessory.getServiceById(platform.Service.Switch, 'pullSpring');
44
+ if (pullSpringEnabled) {
45
+ this.pullSpringService = cachedPullSpring
46
+ ?? accessory.addService(platform.Service.Switch, `${accessory.displayName} Pull Spring`, 'pullSpring');
47
+ this.pullSpringService.setCharacteristic(platform.Characteristic.Name, `${accessory.displayName} Pull Spring`);
48
+ const pullSpringOn = this.pullSpringService.getCharacteristic(platform.Characteristic.On)
49
+ .setValue(false)
50
+ .onSet(async (value, context) => {
51
+ if (!value) {
52
+ return;
53
+ }
54
+ setTimeout(() => pullSpringOn.setValue(false), 500);
55
+ if (!context?.fromTedee) {
56
+ await client.pullSpring(device.id);
57
+ }
58
+ });
59
+ this.pullSpringOn = pullSpringOn;
60
+ const linkedPrimaryService = this.primaryService;
61
+ linkedPrimaryService.addLinkedService?.(this.pullSpringService);
62
+ }
63
+ else if (cachedPullSpring) {
64
+ accessory.removeService(cachedPullSpring);
65
+ }
66
+ this.update(device);
67
+ }
68
+ update(device) {
69
+ this.device = device;
70
+ this.currentState.setValue(this.toLockCurrentState(device), { fromTedee: true });
71
+ this.targetState.setValue(this.toLockTargetState(device), { fromTedee: true });
72
+ this.updateFaultState();
73
+ this.updateBattery();
74
+ }
75
+ async onEvent(event) {
76
+ switch (event.event) {
77
+ case 'lock-status-changed':
78
+ this.device = {
79
+ ...this.device,
80
+ state: event.data.state,
81
+ doorState: event.data.doorState
82
+ };
83
+ this.currentState.setValue(this.toLockCurrentState(this.device), { fromTedee: true });
84
+ this.targetState.setValue(this.toLockTargetState(this.device), { fromTedee: true });
85
+ if (event.data.state === Tedee.LockState.Pulling) {
86
+ this.pullSpringOn?.setValue(true, { fromTedee: true });
87
+ }
88
+ return;
89
+ case 'device-battery-level-changed':
90
+ this.device = {
91
+ ...this.device,
92
+ batteryLevel: event.data.batteryLevel
93
+ };
94
+ this.updateBattery();
95
+ return;
96
+ case 'device-battery-start-charging':
97
+ this.device = { ...this.device, isCharging: true };
98
+ this.updateBattery();
99
+ return;
100
+ case 'device-battery-stop-charging':
101
+ this.device = { ...this.device, isCharging: false };
102
+ this.updateBattery();
103
+ return;
104
+ case 'device-battery-fully-charged':
105
+ this.device = { ...this.device, batteryLevel: 100, isCharging: false };
106
+ this.updateBattery();
107
+ return;
108
+ case 'device-connection-changed':
109
+ this.device = { ...this.device, isConnected: event.data.isConnected };
110
+ this.updateFaultState();
111
+ return;
112
+ case 'device-settings-changed':
113
+ await this.refresh();
114
+ return;
115
+ }
116
+ }
117
+ async doClose() {
118
+ if (this.pullSpringResetTimer) {
119
+ clearTimeout(this.pullSpringResetTimer);
120
+ this.pullSpringResetTimer = undefined;
121
+ }
122
+ }
123
+ async refresh() {
124
+ try {
125
+ this.update(await this.client.getLock(this.id));
126
+ }
127
+ catch (error) {
128
+ this.logger.warn(`failed to refresh lock [${this.id}] after settings event`, error);
129
+ }
130
+ }
131
+ updateFaultState() {
132
+ this.statusFault.setValue(!toBoolean(this.device.isConnected) || toBoolean(this.device.jammed)
133
+ ? this.platform.Characteristic.StatusFault.GENERAL_FAULT
134
+ : this.platform.Characteristic.StatusFault.NO_FAULT);
135
+ }
136
+ updateBattery() {
137
+ const batteryLevel = this.normalizedBatteryLevel(this.device.batteryLevel);
138
+ if (batteryLevel !== undefined) {
139
+ this.batteryLevel.setValue(batteryLevel);
140
+ this.lowBattery.setValue(batteryLevel <= this.platform.lowBatteryThreshold
141
+ ? this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
142
+ : this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL);
143
+ }
144
+ this.chargingState.setValue(toBoolean(this.device.isCharging)
145
+ ? this.platform.Characteristic.ChargingState.CHARGING
146
+ : this.platform.Characteristic.ChargingState.NOT_CHARGING);
147
+ }
148
+ normalizedBatteryLevel(value) {
149
+ if (value === 255 || !Number.isFinite(value)) {
150
+ return undefined;
151
+ }
152
+ return clamp(value, 0, 100);
153
+ }
154
+ toLockCurrentState(device) {
155
+ if (toBoolean(device.jammed)) {
156
+ return this.platform.Characteristic.LockCurrentState.JAMMED;
157
+ }
158
+ switch (device.state) {
159
+ case Tedee.LockState.Locked:
160
+ return this.platform.Characteristic.LockCurrentState.SECURED;
161
+ case Tedee.LockState.Unlocked:
162
+ case Tedee.LockState.SemiLocked:
163
+ case Tedee.LockState.Pulled:
164
+ return this.platform.Characteristic.LockCurrentState.UNSECURED;
165
+ default:
166
+ return this.platform.Characteristic.LockCurrentState.UNKNOWN;
167
+ }
168
+ }
169
+ toLockTargetState(device) {
170
+ return device.state === Tedee.LockState.Locked || device.state === Tedee.LockState.Locking
171
+ ? this.platform.Characteristic.LockTargetState.SECURED
172
+ : this.platform.Characteristic.LockTargetState.UNSECURED;
173
+ }
174
+ }
175
+ //# sourceMappingURL=lock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lock.js","sourceRoot":"","sources":["../../src/device/lock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,OAAO,IAAK,SAAQ,MAAkB;IAExC,MAAM,CAAU,MAAM,GAAG,KAAK,EAAE,QAAuB,EAAE,MAAmB,EAAE,SAA4B,EAAE,MAAkB,EAAE,EAAE;QAC9H,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC,CAAA;IAEgB,YAAY,CAAiB;IAC7B,WAAW,CAAiB;IAC5B,YAAY,CAAiB;IAC7B,aAAa,CAAiB;IAC9B,UAAU,CAAiB;IAC3B,cAAc,CAAU;IACxB,iBAAiB,CAAW;IAC5B,YAAY,CAAkB;IACvC,oBAAoB,CAAkB;IAE9C,YAAoB,QAAuB,EAAE,MAAmB,EAAE,SAA4B,EAAE,M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,MAAM,CAAC,KAAK,EAAE,CAAC;YACnB,KAAK,KAAK,CAAC,SAAS,CAAC,MAAM;gBACvB,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC,OAAO,CAAC;YACjE,KAAK,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC;YAC9B,KAAK,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC;YAChC,KAAK,KAAK,CAAC,SAAS,CAAC,MAAM;gBACvB,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC,SAAS,CAAC;YACnE;gBACI,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC,OAAO,CAAC;QACrE,CAAC;IACL,CAAC;IAEO,iBAAiB,CAAC,MAAkB;QACxC,OAAO,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC,SAAS,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC,SAAS,CAAC,OAAO;YACtF,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAC,OAAO;YACtD,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAC,SAAS,CAAC;IACjE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { API } from 'homebridge';
2
+ declare const _default: (api: API) => void;
3
+ export default _default;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;yBAKjB,KAAK,GAAG;AAAxB,wBAEE"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import { PLATFORM_NAME } from "./settings.js";
2
+ import { TedeePlatform } from "./tedee-platform.js";
3
+ export default (api) => {
4
+ api.registerPlatform(PLATFORM_NAME, TedeePlatform);
5
+ };
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,eAAe,CAAC,GAAQ,EAAE,EAAE;IAC1B,GAAG,CAAC,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AACrD,CAAC,CAAC"}