homebridge-tydom 0.32.3 → 0.33.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/README.md
CHANGED
|
@@ -201,6 +201,7 @@ Pointing `hostname` at your gateway's IP (e.g. `192.168.0.42`) skips Delta Dore'
|
|
|
201
201
|
| `name` | any | Rename the accessory. |
|
|
202
202
|
| `category` | any | Pin the device to a HAP category, bypassing hardware detection. See [Category overrides](#category-overrides). |
|
|
203
203
|
| `trigger` | switches | Publish a stateless switch that returns to off, rather than a toggle. |
|
|
204
|
+
| `autoShutdownDelay` | switches, outlets, fans | Switch off again this many **milliseconds** after coming on, whether that was from HomeKit or from the device's own button. Off by default. |
|
|
204
205
|
| `smokeDetector` | temperature sensors | Publish as a smoke detector instead. |
|
|
205
206
|
| `delay` | garage doors | Travel time in **milliseconds**. Defaults to `20000`. |
|
|
206
207
|
| `autoCloseDelay` | garage doors | Close again this many **milliseconds** after opening. Off by default. |
|
package/config.schema.json
CHANGED
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"patternProperties": {
|
|
116
116
|
"^[0-9]+$": { "type": "object" }
|
|
117
117
|
},
|
|
118
|
-
"description": "Per-device overrides, keyed by numeric device id. Free-form, because the options a device accepts depend on what it is — edit this in the JSON config rather than here.\n\n```json\n\"settings\": {\n \"1234567\": { \"name\": \"Kitchen blind\" },\n \"1234568\": { \"trigger\": true },\n \"1234569\": { \"delay\": 10000, \"autoCloseDelay\": 300000 },\n \"1657464\": {\n \"pin\": \"1234\",\n \"sensors\": true,\n \"aliases\": { \"stay\": [1], \"night\": [1, 2] }\n }\n}\n```\n\n`name` renames the accessory and `category` pins it to a HAP category, bypassing hardware detection. `trigger` turns a switch into a stateless one that returns to off. On a garage door, `delay` is the travel time in **milliseconds** (default 20000) and `autoCloseDelay` closes it again after that many milliseconds. `smokeDetector` publishes a temperature sensor as a smoke detector. On an alarm: `pin` overrides the platform PIN, `sensors: false` drops the companion accessory that holds one contact sensor per opening detector (it is published by default), `aliases` says which armed-zone combinations HomeKit should show as Home and Night, and `legacy` selects the CTX60 protocol (detected automatically; only set it if detection is wrong)."
|
|
118
|
+
"description": "Per-device overrides, keyed by numeric device id. Free-form, because the options a device accepts depend on what it is — edit this in the JSON config rather than here.\n\n```json\n\"settings\": {\n \"1234567\": { \"name\": \"Kitchen blind\" },\n \"1234568\": { \"trigger\": true },\n \"1234569\": { \"delay\": 10000, \"autoCloseDelay\": 300000 },\n \"1657464\": {\n \"pin\": \"1234\",\n \"sensors\": true,\n \"aliases\": { \"stay\": [1], \"night\": [1, 2] }\n }\n}\n```\n\n`name` renames the accessory and `category` pins it to a HAP category, bypassing hardware detection. `trigger` turns a switch into a stateless one that returns to off. On a garage door, `delay` is the travel time in **milliseconds** (default 20000) and `autoCloseDelay` closes it again after that many milliseconds. `autoShutdownDelay` switches a switch, outlet or fan off again that many milliseconds after it comes on, counted from the moment it was switched on rather than from the last thing the gateway reported, and it follows the device's own button as well as HomeKit. `smokeDetector` publishes a temperature sensor as a smoke detector. On an alarm: `pin` overrides the platform PIN, `sensors: false` drops the companion accessory that holds one contact sensor per opening detector (it is published by default), `aliases` says which armed-zone combinations HomeKit should show as Home and Night, and `legacy` selects the CTX60 protocol (detected automatically; only set it if detection is wrong)."
|
|
119
119
|
},
|
|
120
120
|
"debug": {
|
|
121
121
|
"title": "Verbose logging",
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as PLUGIN_NAME, t as PLATFORM_NAME } from "./env-B2-Dw8C2.mjs";
|
|
2
2
|
//#region src/index.ts
|
|
3
3
|
process.setSourceMapsEnabled(true);
|
|
4
|
-
const { default: TydomPlatform } = await import("./platform-
|
|
4
|
+
const { default: TydomPlatform } = await import("./platform-Bp1Glauz.mjs");
|
|
5
5
|
var src_default = (homebridge) => {
|
|
6
6
|
homebridge.registerPlatform(PLUGIN_NAME, PLATFORM_NAME, TydomPlatform);
|
|
7
7
|
};
|
|
@@ -5211,10 +5211,26 @@ const createWindowCoveringAccessory = (deps) => new WindowCoveringAccessory(deps
|
|
|
5211
5211
|
var MappedAccessory = class extends BaseAccessory {
|
|
5212
5212
|
#service;
|
|
5213
5213
|
#bindings;
|
|
5214
|
+
/** How long after switching on to switch off again, if the user asked. */
|
|
5215
|
+
#autoShutdownMs;
|
|
5216
|
+
/** The writable `On` binding, which is the only thing there is to switch off. */
|
|
5217
|
+
#onBinding;
|
|
5218
|
+
#autoShutdownTimer;
|
|
5219
|
+
/**
|
|
5220
|
+
* What the `On` characteristic last read, so a repeat can be told from a
|
|
5221
|
+
* change. The periodic refresh pushes the current state whether or not it
|
|
5222
|
+
* moved, and re-arming on those would push the shutdown out for as long as
|
|
5223
|
+
* the device stayed on — which is the one thing it must not do.
|
|
5224
|
+
*/
|
|
5225
|
+
#isOn;
|
|
5214
5226
|
constructor(deps, spec) {
|
|
5215
5227
|
super(deps);
|
|
5216
5228
|
this.#service = this.service(spec.service(this.platform.Service));
|
|
5217
5229
|
this.#bindings = spec.bindings(this.platform.Characteristic);
|
|
5230
|
+
const { autoShutdownDelay } = this.accessory.context.settings ?? {};
|
|
5231
|
+
this.#autoShutdownMs = autoShutdownDelay;
|
|
5232
|
+
const { On } = this.platform.Characteristic;
|
|
5233
|
+
this.#onBinding = this.#bindings.find((binding) => binding.characteristic === On && binding.toTydom);
|
|
5218
5234
|
for (const binding of this.#bindings) this.#bind(binding);
|
|
5219
5235
|
}
|
|
5220
5236
|
/** The service this accessory publishes. Exposed for tests. */
|
|
@@ -5243,9 +5259,45 @@ var MappedAccessory = class extends BaseAccessory {
|
|
|
5243
5259
|
value: tydomValue
|
|
5244
5260
|
}]);
|
|
5245
5261
|
debugSetResult(characteristic, service, value, tydomValue);
|
|
5262
|
+
this.#trackAutoShutdown(binding, value);
|
|
5246
5263
|
});
|
|
5247
5264
|
}
|
|
5248
5265
|
/**
|
|
5266
|
+
* Arm or stand down the auto-shutdown, following the device's on state.
|
|
5267
|
+
*
|
|
5268
|
+
* Called from both directions on purpose: the Home app is the case nobody
|
|
5269
|
+
* needs help with, and a switch left on at the wall is the case the setting
|
|
5270
|
+
* exists for.
|
|
5271
|
+
*/
|
|
5272
|
+
#trackAutoShutdown(binding, value) {
|
|
5273
|
+
if (this.#autoShutdownMs === void 0 || binding !== this.#onBinding) return;
|
|
5274
|
+
const isOn = value === true;
|
|
5275
|
+
if (isOn === this.#isOn) return;
|
|
5276
|
+
this.#isOn = isOn;
|
|
5277
|
+
this.clearTimer(this.#autoShutdownTimer);
|
|
5278
|
+
this.#autoShutdownTimer = void 0;
|
|
5279
|
+
if (!isOn) return;
|
|
5280
|
+
this.#autoShutdownTimer = this.setTimer(() => {
|
|
5281
|
+
this.#autoShutdownTimer = void 0;
|
|
5282
|
+
this.#switchOff(binding);
|
|
5283
|
+
}, this.#autoShutdownMs);
|
|
5284
|
+
}
|
|
5285
|
+
async #switchOff(binding) {
|
|
5286
|
+
const { On } = this.platform.Characteristic;
|
|
5287
|
+
this.#isOn = false;
|
|
5288
|
+
try {
|
|
5289
|
+
await this.api.putDeviceData(this.deviceId, this.endpointId, [{
|
|
5290
|
+
name: binding.prop,
|
|
5291
|
+
value: binding.toTydom?.(false)
|
|
5292
|
+
}]);
|
|
5293
|
+
} catch (err) {
|
|
5294
|
+
this.platform.log.error(`Failed to switch off ${this.accessory.displayName} after its shutdown delay: ${String(err)}`);
|
|
5295
|
+
return;
|
|
5296
|
+
}
|
|
5297
|
+
debugSetUpdate(On, this.#service, false);
|
|
5298
|
+
this.#service.updateCharacteristic(On, false);
|
|
5299
|
+
}
|
|
5300
|
+
/**
|
|
5249
5301
|
* The mapping a pushed property feeds, or undefined if this binding ignores
|
|
5250
5302
|
* it. Read and push therefore agree by construction.
|
|
5251
5303
|
*/
|
|
@@ -5260,6 +5312,7 @@ var MappedAccessory = class extends BaseAccessory {
|
|
|
5260
5312
|
const next = map(value);
|
|
5261
5313
|
debugSetUpdate(binding.characteristic, this.#service, next);
|
|
5262
5314
|
this.#service.updateCharacteristic(binding.characteristic, next);
|
|
5315
|
+
this.#trackAutoShutdown(binding, next);
|
|
5263
5316
|
}
|
|
5264
5317
|
}
|
|
5265
5318
|
};
|
|
@@ -5675,4 +5728,4 @@ var TydomPlatform = class {
|
|
|
5675
5728
|
//#endregion
|
|
5676
5729
|
export { TydomPlatform as default };
|
|
5677
5730
|
|
|
5678
|
-
//# sourceMappingURL=platform-
|
|
5731
|
+
//# sourceMappingURL=platform-Bp1Glauz.mjs.map
|