@homebridge-plugins/homebridge-august 3.2.3 → 3.3.0-beta.0
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/.github/npm-version-script-esm.js +97 -0
- package/CHANGELOG.md +15 -0
- package/dist/Platform.Base.d.ts +288 -0
- package/dist/Platform.Base.d.ts.map +1 -0
- package/dist/Platform.Base.js +797 -0
- package/dist/Platform.Base.js.map +1 -0
- package/dist/Platform.HAP.d.ts +20 -139
- package/dist/Platform.HAP.d.ts.map +1 -1
- package/dist/Platform.HAP.js +46 -733
- package/dist/Platform.HAP.js.map +1 -1
- package/dist/connectivity-manager.d.ts +3 -3
- package/dist/connectivity-manager.d.ts.map +1 -1
- package/dist/connectivity-manager.js +57 -14
- package/dist/connectivity-manager.js.map +1 -1
- package/dist/devices/device.d.ts +5 -16
- package/dist/devices/device.d.ts.map +1 -1
- package/dist/devices/device.js +18 -75
- package/dist/devices/device.js.map +1 -1
- package/dist/devices/lock.d.ts +3 -3
- package/dist/devices/lock.d.ts.map +1 -1
- package/dist/devices/lock.js +41 -41
- package/dist/devices/lock.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/package.json +8 -7
- package/dist/platform.matter.d.ts +18 -20
- package/dist/platform.matter.d.ts.map +1 -1
- package/dist/platform.matter.js +74 -80
- package/dist/platform.matter.js.map +1 -1
- package/docs/variables/default.html +1 -1
- package/package.json +8 -7
- package/test/device.test.ts +384 -0
- package/test/{platform.test.ts → platform.hap.test.ts} +23 -23
- package/test/platform.polling.test.ts +5 -5
- package/.github/scripts/compute-version-override.cjs +0 -51
- package/.github/scripts/normalize-changelog-header.cjs +0 -86
- package/.github/scripts/npm-version-script-esm-auto.js +0 -201
- package/.github/scripts/resolve-version-bump-esm.js +0 -118
- package/dist/devices/device.test.d.ts +0 -2
- package/dist/devices/device.test.d.ts.map +0 -1
- package/dist/devices/device.test.js +0 -294
- package/dist/devices/device.test.js.map +0 -1
- package/test/connectivity-manager.test.ts +0 -590
- package/test/platform.matter.test.ts +0 -660
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This scripts queries the npm registry to pull out the latest version for a given tag.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import assert from 'node:assert'
|
|
8
|
+
import child_process from 'node:child_process'
|
|
9
|
+
import fs from 'node:fs'
|
|
10
|
+
import process from 'node:process'
|
|
11
|
+
|
|
12
|
+
const BRANCH_VERSION_PATTERN = /^([A-Z]+)-(\d+\.\d+\.\d+)$/i
|
|
13
|
+
|
|
14
|
+
// Load the contents of the package.json file
|
|
15
|
+
const packageJSON = JSON.parse(fs.readFileSync('package.json', 'utf8'))
|
|
16
|
+
|
|
17
|
+
const refArgument = process.argv[2]
|
|
18
|
+
const tagArgument = process.argv[3] || 'latest'
|
|
19
|
+
|
|
20
|
+
if (!refArgument) {
|
|
21
|
+
console.error('ref argument is missing')
|
|
22
|
+
console.error('Usage: npm-version-script-esm.js <ref> [tag]')
|
|
23
|
+
process.exit(1)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Queries the NPM registry for the latest version for the provided base version and tag.
|
|
28
|
+
* If the tag is latest, then the base version is returned if it exists. For other tags, the latest
|
|
29
|
+
* version found for that base version and tag is returned.
|
|
30
|
+
* @param baseVersion The base version to query for, e.g. 2.0.0
|
|
31
|
+
* @param tag The tag to query for, e.g. beta or latest
|
|
32
|
+
* @returns {string} Returns the version, or '' if not found
|
|
33
|
+
*/
|
|
34
|
+
function getTagVersionFromNpm(baseVersion, tag) {
|
|
35
|
+
try {
|
|
36
|
+
return JSON.parse(child_process.execSync(`npm info ${packageJSON.name} versions --json`).toString('utf8').trim())
|
|
37
|
+
.filter(v => tag === 'latest' ? v === baseVersion : v.startsWith(`${baseVersion}-${tag}.`)) // find all published versions for this base version and tag
|
|
38
|
+
.reduce((_, current) => current, '') // choose the last as they're sorted in ascending order, or '' if there are none
|
|
39
|
+
} catch (e) {
|
|
40
|
+
console.error(`Failed to query the npm registry for the latest version for tag: ${tag}`, e)
|
|
41
|
+
// throw e;
|
|
42
|
+
return ''
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function desiredTargetVersion(ref) {
|
|
47
|
+
// ref is a GitHub action ref string
|
|
48
|
+
if (ref.startsWith('refs/pull/')) {
|
|
49
|
+
throw new Error('The version script was executed inside a PR!')
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
assert(ref.startsWith('refs/heads/'))
|
|
53
|
+
const branchName = ref.slice('refs/heads/'.length)
|
|
54
|
+
|
|
55
|
+
const results = branchName.match(BRANCH_VERSION_PATTERN)
|
|
56
|
+
if (results !== null) {
|
|
57
|
+
if (results[1] !== tagArgument) {
|
|
58
|
+
console.warn(`The base branch name (${results[1]}) differs from the tag name ${tagArgument}`)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return results[2]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
throw new Error(`Malformed branch name for ref: ${ref}. Can't derive the base version. Use a branch name like: beta-x.x.x or alpha-x.x.x`)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// derive the base version from the branch ref
|
|
68
|
+
const baseVersion = desiredTargetVersion(refArgument)
|
|
69
|
+
|
|
70
|
+
// query the npm registry for the latest version of the provided tag name
|
|
71
|
+
const latestReleasedVersion = getTagVersionFromNpm(baseVersion, tagArgument) // e.g. 0.7.0-beta.12
|
|
72
|
+
|
|
73
|
+
let publishTag
|
|
74
|
+
|
|
75
|
+
if (latestReleasedVersion) {
|
|
76
|
+
console.warn(`Latest published version for ${baseVersion} with tag ${tagArgument} is ${latestReleasedVersion}`)
|
|
77
|
+
publishTag = latestReleasedVersion // set this released beta or alpha to be incremented
|
|
78
|
+
} else {
|
|
79
|
+
console.warn(`No published versions for ${baseVersion} with tag ${tagArgument}`)
|
|
80
|
+
publishTag = baseVersion // start off with a new beta or alpha version
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (packageJSON.version !== publishTag) {
|
|
84
|
+
// report the change for CI
|
|
85
|
+
console.warn(`Changing version in package.json from ${packageJSON.version} to ${publishTag}`)
|
|
86
|
+
|
|
87
|
+
// save the package.json
|
|
88
|
+
packageJSON.version = publishTag
|
|
89
|
+
fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2))
|
|
90
|
+
|
|
91
|
+
// perform the same change to the package-lock.json
|
|
92
|
+
const packageLockJSON = JSON.parse(fs.readFileSync('package-lock.json', 'utf8'))
|
|
93
|
+
packageLockJSON.version = publishTag
|
|
94
|
+
fs.writeFileSync('package-lock.json', JSON.stringify(packageLockJSON, null, 2))
|
|
95
|
+
} else {
|
|
96
|
+
console.warn(`Leaving version in package.json at ${packageJSON.version}`)
|
|
97
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [3.3.0](https://github.com/homebridge-plugins/homebridge-august/releases/tag/v3.3.0) (2026-05-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
- Major refactor: Introduced a new shared Base Platform architecture for HAP (HomeKit) and Matter platforms, improving reliability and maintainability.
|
|
7
|
+
- Improved lock/device management and connectivity handling for both HAP and Matter modes.
|
|
8
|
+
|
|
9
|
+
### Other Changes
|
|
10
|
+
|
|
11
|
+
- Internal codebase cleanup and test reorganization.
|
|
12
|
+
- Removed legacy scripts and reduced code duplication.
|
|
13
|
+
|
|
14
|
+
**Full Changelog**: https://github.com/homebridge-plugins/homebridge-august/compare/v3.2.3...v3.3.0
|
|
15
|
+
|
|
1
16
|
## [3.2.3](https://github.com/homebridge-plugins/homebridge-august/releases/tag/v3.2.3) (2026-05-04)
|
|
2
17
|
|
|
3
18
|
### Bug Fixes
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import type { API, DynamicPlatformPlugin, Logging, PlatformAccessory } from 'homebridge';
|
|
2
|
+
import type { AugustPlatformConfig, credentials, device, devicesConfig, options } from './settings.js';
|
|
3
|
+
import { PluginLogger } from '@homebridge/plugin-logger';
|
|
4
|
+
import August from 'august-yale';
|
|
5
|
+
import { ConnectivityManager } from './connectivity-manager.js';
|
|
6
|
+
/**
|
|
7
|
+
* Base platform class for August/Yale Homebridge plugin.
|
|
8
|
+
* Contains all shared logic for config, credentials, device discovery, polling, etc.
|
|
9
|
+
* Protocol-specific logic (HAP/Matter) should be implemented in subclasses.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AugustPlatformBase implements DynamicPlatformPlugin {
|
|
12
|
+
/**
|
|
13
|
+
* Subscribes to PubNub push updates for a given lockId.
|
|
14
|
+
* Stores unsubscribe/teardown functions in the lockMechanisms map for unified cleanup.
|
|
15
|
+
* Calls the provided event handler on push events.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} lockId - The lock ID to subscribe to.
|
|
18
|
+
* @param {(event: any, timestamp: Date) => Promise<void>} onEvent - Handler for push events.
|
|
19
|
+
* @param {(status: any) => void} [onStatus] - Optional handler for PubNub status events.
|
|
20
|
+
* @returns {Promise<void>}
|
|
21
|
+
*/
|
|
22
|
+
subscribePubNub(lockId: string, onEvent: (event: any, timestamp: Date) => Promise<void>, onStatus?: (status: any) => void): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Tears down the PubNub subscription for a given lockId (if present).
|
|
25
|
+
* Safe to call multiple times.
|
|
26
|
+
* @param {string} lockId
|
|
27
|
+
*/
|
|
28
|
+
tearDownPubNubSubscription(lockId: string): void;
|
|
29
|
+
accessories: PlatformAccessory[];
|
|
30
|
+
readonly api: API;
|
|
31
|
+
readonly log: Logging;
|
|
32
|
+
config: AugustPlatformConfig;
|
|
33
|
+
platformConfig: AugustPlatformConfig;
|
|
34
|
+
platformLogging: options['logging'];
|
|
35
|
+
platformRefreshRate: options['refreshRate'];
|
|
36
|
+
platformPushRate: options['pushRate'];
|
|
37
|
+
platformUpdateRate: options['updateRate'];
|
|
38
|
+
registeringDevice: boolean;
|
|
39
|
+
debugMode: boolean;
|
|
40
|
+
version: string;
|
|
41
|
+
augustConfig?: August;
|
|
42
|
+
connectivity?: ConnectivityManager;
|
|
43
|
+
protected readonly lockMechanisms: Map<string, any>;
|
|
44
|
+
protected pollTimer?: NodeJS.Timeout;
|
|
45
|
+
protected normalizedCredentialsCache?: credentials;
|
|
46
|
+
logger: PluginLogger;
|
|
47
|
+
constructor(log: Logging, config: AugustPlatformConfig, api: API);
|
|
48
|
+
Lock(device: any): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Tears down resources for a lock mechanism, including PubNub subscriptions and polling if present.
|
|
51
|
+
*
|
|
52
|
+
* Removes the lock mechanism from the internal map and calls tearDownPubNubSubscription if implemented.
|
|
53
|
+
* Used by both HAP and Matter platforms. Lock mechanisms must implement tearDownPubNubSubscription for proper cleanup.
|
|
54
|
+
*
|
|
55
|
+
* @param {string} lockId - The lock ID whose mechanism should be torn down.
|
|
56
|
+
* @returns {void}
|
|
57
|
+
*/
|
|
58
|
+
protected tearDownLockMechanism(lockId: string): void;
|
|
59
|
+
/**
|
|
60
|
+
* Handles restoration of cached accessories from disk during Homebridge startup.
|
|
61
|
+
*
|
|
62
|
+
* Called by Homebridge for each accessory previously registered and persisted in the cache.
|
|
63
|
+
* Adds the accessory to the platform's accessories array for tracking and future management.
|
|
64
|
+
* Subclasses should override this method to set up event handlers and update characteristic values as needed.
|
|
65
|
+
*
|
|
66
|
+
* @param {PlatformAccessory} accessory - The accessory instance restored from cache.
|
|
67
|
+
* @returns {Promise<void>} Resolves when the accessory is processed and added to the cache.
|
|
68
|
+
*/
|
|
69
|
+
configureAccessory(accessory: PlatformAccessory): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Verifies that the plugin configuration contains all required credentials.
|
|
72
|
+
*
|
|
73
|
+
* Checks for the presence of credentials, August ID, and password. Throws descriptive errors
|
|
74
|
+
* if any required field is missing. Should be called during initialization to ensure the platform
|
|
75
|
+
* is properly configured before proceeding with authentication or device discovery.
|
|
76
|
+
*
|
|
77
|
+
* @returns {Promise<void>} Resolves if the configuration is valid.
|
|
78
|
+
* @throws {Error} If credentials, August ID, or password are missing.
|
|
79
|
+
*/
|
|
80
|
+
verifyConfig(): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Validates the August credentials and manages the Homebridge config state for authentication.
|
|
83
|
+
*
|
|
84
|
+
* - If the session is not validated and a validateCode is present, attempts to validate with the code,
|
|
85
|
+
* updates the config, and clears the validateCode on success.
|
|
86
|
+
* - If already validated or no validateCode is present, ensures installId is set and prompts the user
|
|
87
|
+
* to enter the verification code if needed.
|
|
88
|
+
* - Always updates the config file and clears the normalized credentials cache after changes.
|
|
89
|
+
* - Handles device discovery after successful validation.
|
|
90
|
+
*
|
|
91
|
+
* @returns {Promise<void>} Resolves when validation and config updates are complete.
|
|
92
|
+
* @throws {Error} If credentials are missing or validation fails unexpectedly.
|
|
93
|
+
*/
|
|
94
|
+
validated(): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Initializes and manages the August API credentials and connectivity manager.
|
|
97
|
+
*
|
|
98
|
+
* Ensures credentials are present, initializes the ConnectivityManager if needed,
|
|
99
|
+
* and keeps the public augustConfig field in sync with the manager's internal client.
|
|
100
|
+
* If already initialized, skips re-initialization. Handles automatic client rebuilds
|
|
101
|
+
* on authentication failures and network recovery.
|
|
102
|
+
*
|
|
103
|
+
* @returns {Promise<void>} Resolves when credentials and connectivity are initialized.
|
|
104
|
+
* @throws {Error} If credentials are missing.
|
|
105
|
+
*/
|
|
106
|
+
augustCredentials(): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Normalizes credentials for August API compatibility, handling country code variations.
|
|
109
|
+
*
|
|
110
|
+
* Maps regional country codes (e.g., CA, MX) to supported API endpoints (US) unless normalization is disabled in config.
|
|
111
|
+
* Logs normalization actions for debugging and API compatibility.
|
|
112
|
+
*
|
|
113
|
+
* @param {credentials} credentials - The credentials object to normalize.
|
|
114
|
+
* @returns {Promise<credentials>} Resolves with the normalized credentials object.
|
|
115
|
+
* @throws {Error} If credentials are null or undefined.
|
|
116
|
+
*/
|
|
117
|
+
private normalizeCredentialsForApi;
|
|
118
|
+
/**
|
|
119
|
+
* Clears the cached normalized credentials.
|
|
120
|
+
*
|
|
121
|
+
* Should be called whenever credentials are updated or invalidated to ensure
|
|
122
|
+
* that subsequent API calls use fresh, normalized credentials.
|
|
123
|
+
* Logs the cache clear operation for debugging.
|
|
124
|
+
*
|
|
125
|
+
* @returns {void}
|
|
126
|
+
*/
|
|
127
|
+
clearNormalizedCredentialsCache(): void;
|
|
128
|
+
/**
|
|
129
|
+
* Returns normalized credentials for use by device classes, with caching to avoid redundant normalization.
|
|
130
|
+
*
|
|
131
|
+
* If the credentials have not changed since the last call, returns the cached normalized credentials.
|
|
132
|
+
* Otherwise, normalizes the credentials, caches them, and returns the new value.
|
|
133
|
+
*
|
|
134
|
+
* @returns {Promise<credentials>} Resolves with the normalized credentials object for API use.
|
|
135
|
+
* @throws {Error} If credentials are missing or invalid.
|
|
136
|
+
*/
|
|
137
|
+
getNormalizedCredentials(): Promise<credentials>;
|
|
138
|
+
/**
|
|
139
|
+
* Starts the platform-level polling cycle for device state updates.
|
|
140
|
+
*
|
|
141
|
+
* Iterates registered locks serially (not in parallel) and short-circuits on the first failure.
|
|
142
|
+
*
|
|
143
|
+
* **Why serial:**
|
|
144
|
+
* - One outstanding request at a time on a healthy network is cheap enough (most cycles complete in <1s for a handful of locks) and avoids racing the August API.
|
|
145
|
+
* - On a failing network, a parallel cycle would produce N timeouts ~simultaneously, which is exactly the log-spam pattern the ConnectivityManager exists to prevent. Serial means one timeout, classified once, and the rest of the cycle aborts.
|
|
146
|
+
*
|
|
147
|
+
* **Why short-circuit on first failure:**
|
|
148
|
+
* - If the first call fails with a network error, the manager has already entered 'degraded' state and scheduled a probe. The remaining N-1 calls would all hit the same dead network and produce identical errors. Aborting the cycle is the correct thing to do.
|
|
149
|
+
*
|
|
150
|
+
* **Why skip when offline:**
|
|
151
|
+
* - The manager's state machine is already managing recovery via scheduled probes. Polling on top of that just wastes API calls and risks rate limiting.
|
|
152
|
+
*
|
|
153
|
+
* Idempotent: If discovery re-runs (e.g. after re-auth), does not stack timers.
|
|
154
|
+
*
|
|
155
|
+
* @returns {void}
|
|
156
|
+
*/
|
|
157
|
+
startPolling(): void;
|
|
158
|
+
/**
|
|
159
|
+
* Stops the platform polling cycle for device state updates.
|
|
160
|
+
*
|
|
161
|
+
* Clears the polling timer if active, halting periodic device refreshes.
|
|
162
|
+
* Typically called during plugin shutdown or when polling is no longer needed.
|
|
163
|
+
*
|
|
164
|
+
* @returns {void}
|
|
165
|
+
*/
|
|
166
|
+
stopPolling(): void;
|
|
167
|
+
/**
|
|
168
|
+
* Loads and returns the plugin's configuration and the full Homebridge config from disk.
|
|
169
|
+
*
|
|
170
|
+
* Reads the Homebridge config file, finds this plugin's config section, and ensures credentials is an object.
|
|
171
|
+
* Throws if the platforms array or plugin config is missing.
|
|
172
|
+
*
|
|
173
|
+
* @returns {Promise<{ pluginConfig: any, currentConfig: any }>} Resolves with the plugin's config and the full config object.
|
|
174
|
+
* @throws {TypeError|Error} If the platforms array or plugin config is missing.
|
|
175
|
+
*/
|
|
176
|
+
pluginConfig(): Promise<{
|
|
177
|
+
pluginConfig: any;
|
|
178
|
+
currentConfig: any;
|
|
179
|
+
}>;
|
|
180
|
+
/**
|
|
181
|
+
* Discovers and registers August/Yale lock devices for the platform.
|
|
182
|
+
*
|
|
183
|
+
* Fetches device details from the August API using normalized credentials, applies config-based filtering,
|
|
184
|
+
* unregisters excluded accessories, merges config overrides, and registers each device via the Lock method.
|
|
185
|
+
* Handles authentication errors and triggers re-authentication if needed.
|
|
186
|
+
*
|
|
187
|
+
* @returns {Promise<void>} Resolves when all devices have been discovered and registered.
|
|
188
|
+
* @throws {Error} If device discovery or authentication fails.
|
|
189
|
+
*/
|
|
190
|
+
discoverDevices(): Promise<void>;
|
|
191
|
+
/**
|
|
192
|
+
* --- Additional shared methods for config, logging, etc. ---
|
|
193
|
+
*/
|
|
194
|
+
/**
|
|
195
|
+
* Determines if a device should be registered based on its visibility and HomeKit enablement.
|
|
196
|
+
*
|
|
197
|
+
* This is a generic version; subclasses may override for protocol-specific logic.
|
|
198
|
+
* Sets the registeringDevice flag and logs the registration decision.
|
|
199
|
+
*
|
|
200
|
+
* @param {any} device - The device object to evaluate for registration.
|
|
201
|
+
* @returns {Promise<boolean>} Resolves to true if the device should be registered, false otherwise.
|
|
202
|
+
*/
|
|
203
|
+
protected registerDevice(device: any): Promise<boolean>;
|
|
204
|
+
/**
|
|
205
|
+
* Unregisters a platform accessory from Homebridge and removes it from the cache.
|
|
206
|
+
*
|
|
207
|
+
* Calls the Homebridge API to unregister the accessory, tears down the lock mechanism,
|
|
208
|
+
* removes the accessory from the internal cache, and logs the removal.
|
|
209
|
+
*
|
|
210
|
+
* @param {PlatformAccessory} existingAccessory - The accessory to unregister.
|
|
211
|
+
* @param {any} device - The device object (used for lockId and logging).
|
|
212
|
+
* @returns {Promise<void>} Resolves when the accessory has been unregistered and removed from cache.
|
|
213
|
+
*/
|
|
214
|
+
protected unregisterPlatformAccessories(existingAccessory: PlatformAccessory, device: any): Promise<void>;
|
|
215
|
+
/**
|
|
216
|
+
* Publishes an accessory as either an external accessory or a platform accessory based on device config.
|
|
217
|
+
*
|
|
218
|
+
* If the device config has `external` set, publishes the accessory as an external accessory and logs the mode.
|
|
219
|
+
* Otherwise, registers it as a platform accessory and logs the mode.
|
|
220
|
+
*
|
|
221
|
+
* @param {device & devicesConfig} device - The device configuration object.
|
|
222
|
+
* @param {PlatformAccessory} accessory - The accessory to publish or register.
|
|
223
|
+
* @returns {Promise<void>} Resolves when the accessory has been published or registered.
|
|
224
|
+
*/
|
|
225
|
+
externalOrPlatform(device: device & devicesConfig, accessory: PlatformAccessory): Promise<void>;
|
|
226
|
+
/**
|
|
227
|
+
* Publishes an accessory as an external accessory to Homebridge.
|
|
228
|
+
*
|
|
229
|
+
* Calls the Homebridge API to publish the provided accessory as an external accessory.
|
|
230
|
+
* This is used for accessories that should be exposed independently from the main bridge.
|
|
231
|
+
*
|
|
232
|
+
* @param {PlatformAccessory} accessory - The accessory to publish externally.
|
|
233
|
+
* @returns {Promise<void>} Resolves when the accessory has been published.
|
|
234
|
+
*/
|
|
235
|
+
externalAccessory(accessory: PlatformAccessory): Promise<void>;
|
|
236
|
+
/**
|
|
237
|
+
* Asynchronously determines and logs the platform logging mode based on config options and debug flags.
|
|
238
|
+
*
|
|
239
|
+
* Sets the platformLogging property to 'debug', 'standard', 'none', or 'debugMode' depending on config and CLI flags.
|
|
240
|
+
* Logs the selected logging mode for debugging purposes.
|
|
241
|
+
*
|
|
242
|
+
* @returns {Promise<void>} Resolves when the logging mode has been determined, set, and logged.
|
|
243
|
+
*/
|
|
244
|
+
protected getPlatformLogSettings(): Promise<void>;
|
|
245
|
+
/**
|
|
246
|
+
* Asynchronously loads and logs platform polling, update, and push rate settings from the config options.
|
|
247
|
+
*
|
|
248
|
+
* Reads refreshRate, updateRate, and pushRate from the config options, assigns them to instance properties,
|
|
249
|
+
* and logs the values for debugging purposes.
|
|
250
|
+
*
|
|
251
|
+
* @returns {Promise<void>} Resolves when the rates have been loaded, assigned, and logged.
|
|
252
|
+
*/
|
|
253
|
+
protected getPlatformRateSettings(): Promise<void>;
|
|
254
|
+
/**
|
|
255
|
+
* Asynchronously loads and logs platform configuration settings from the config options.
|
|
256
|
+
*
|
|
257
|
+
* Reads logging, refreshRate, updateRate, and pushRate from the config options,
|
|
258
|
+
* builds a platformConfig object, logs it if present, and assigns it to this.platformConfig.
|
|
259
|
+
*
|
|
260
|
+
* @returns {Promise<void>} Resolves when the config has been loaded, logged, and assigned.
|
|
261
|
+
*/
|
|
262
|
+
protected getPlatformConfigSettings(): Promise<void>;
|
|
263
|
+
/**
|
|
264
|
+
* Asynchronously retrieves and logs the plugin version from package.json.
|
|
265
|
+
*
|
|
266
|
+
* Reads the version from the package.json file, logs it using logger.debug, and
|
|
267
|
+
* assigns it to the `version` property of the class instance.
|
|
268
|
+
*
|
|
269
|
+
* @returns {Promise<void>} Resolves when the version has been read, logged, and assigned.
|
|
270
|
+
*/
|
|
271
|
+
protected getVersion(): Promise<void>;
|
|
272
|
+
/**
|
|
273
|
+
* Asynchronously validates and cleans a display name or characteristic value for HomeKit compatibility.
|
|
274
|
+
*
|
|
275
|
+
* If invalid characters are not allowed (default), this method:
|
|
276
|
+
* - Ensures the value contains only alphanumeric, space, and apostrophe characters.
|
|
277
|
+
* - Removes any invalid characters and trims invalid start/end characters.
|
|
278
|
+
* - Logs warnings and before/after values if modifications are made.
|
|
279
|
+
* If invalid characters are allowed by config, the value is returned unchanged.
|
|
280
|
+
*
|
|
281
|
+
* @param {string} displayName - The accessory's display name (for logging context).
|
|
282
|
+
* @param {string} name - The characteristic name (for logging context).
|
|
283
|
+
* @param {string} value - The value to validate and clean.
|
|
284
|
+
* @returns {Promise<string>} The cleaned (or original) value, suitable for HomeKit.
|
|
285
|
+
*/
|
|
286
|
+
protected validateAndCleanDisplayName(displayName: string, name: string, value: string): Promise<string>;
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=Platform.Base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Platform.Base.d.ts","sourceRoot":"","sources":["../src/Platform.Base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,qBAAqB,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAExF,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAKtG,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,MAAM,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B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