@camstack/addon-export-hap 1.2.200 → 1.2.201
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/hap-export.addon.js +154 -31
- package/dist/hap-export.addon.mjs +154 -31
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.201] - 2026-11-13
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- A switch with the role switch-light is published to HomeKit as an on/off Lightbulb
|
|
15
|
+
- An outlet becomes a HomeKit Outlet, a switch-fan a Fan (on/off), and a switch-heater keeps a Switch under the heater category, on the device and as a child. The accessory stays paired, but the Home app shows the new tile as a new service: re-attach any scene or automation that used the old switch.
|
|
16
|
+
|
|
10
17
|
## [1.2.200] - 2026-11-12
|
|
11
18
|
|
|
12
19
|
### Changed
|
package/dist/hap-export.addon.js
CHANGED
|
@@ -861,7 +861,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
861
861
|
return EventCategory;
|
|
862
862
|
}({});
|
|
863
863
|
//#endregion
|
|
864
|
-
//#region ../types/dist/composed-stable-id-
|
|
864
|
+
//#region ../types/dist/composed-stable-id-iddnCQ51.mjs
|
|
865
865
|
/**
|
|
866
866
|
import { errMsg } from '@camstack/types'
|
|
867
867
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -1203,6 +1203,11 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
1203
1203
|
* with the switch's on/off only. Speed or oscillation appear only when the
|
|
1204
1204
|
* device also has a fan cap (D1033). */
|
|
1205
1205
|
DeviceRole["SwitchFan"] = "switch-fan";
|
|
1206
|
+
/** A relay driving an on/off-only lamp: drawn as a light (bulb and glow, no
|
|
1207
|
+
* slider), presented to the exports as a light with power only. Not a
|
|
1208
|
+
* `light` type: the provider owns the type, and a light implies brightness
|
|
1209
|
+
* or colour this relay lacks. */
|
|
1210
|
+
DeviceRole["SwitchLight"] = "switch-light";
|
|
1206
1211
|
/** Air conditioner / split unit: cooling, fan speed, louvres. */
|
|
1207
1212
|
DeviceRole["ClimateAc"] = "climate-ac";
|
|
1208
1213
|
/** Room thermostat: a setpoint and a room temperature. The default. */
|
|
@@ -6103,7 +6108,7 @@ var ZodIssueCode = {
|
|
|
6103
6108
|
var ZodFirstPartyTypeKind;
|
|
6104
6109
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6105
6110
|
//#endregion
|
|
6106
|
-
//#region ../types/dist/sleep-
|
|
6111
|
+
//#region ../types/dist/sleep-BvVGLl30.mjs
|
|
6107
6112
|
/**
|
|
6108
6113
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6109
6114
|
* window to float samples (D455).
|
|
@@ -10816,6 +10821,13 @@ var ACTUATOR_CAP_VOCABULARY = {
|
|
|
10816
10821
|
},
|
|
10817
10822
|
state: { on: { icon: "lightbulb" } }
|
|
10818
10823
|
},
|
|
10824
|
+
[DeviceRole.SwitchLight]: {
|
|
10825
|
+
actions: {
|
|
10826
|
+
"switch.on": { icon: "lightbulb" },
|
|
10827
|
+
"switch.off": { icon: "lightbulb-off" }
|
|
10828
|
+
},
|
|
10829
|
+
state: { on: { icon: "lightbulb" } }
|
|
10830
|
+
},
|
|
10819
10831
|
[DeviceRole.Chime]: { actions: {
|
|
10820
10832
|
"switch.on": {
|
|
10821
10833
|
label: t("Enable chime", "Attiva il campanello"),
|
|
@@ -17595,7 +17607,7 @@ Object.freeze({
|
|
|
17595
17607
|
}
|
|
17596
17608
|
});
|
|
17597
17609
|
//#endregion
|
|
17598
|
-
//#region ../types/dist/implemented-methods-
|
|
17610
|
+
//#region ../types/dist/implemented-methods-CSTk6zYK.mjs
|
|
17599
17611
|
var AUDIO_ENCODER_BY_CODEC = {
|
|
17600
17612
|
opus: "libopus",
|
|
17601
17613
|
aac: "aac",
|
|
@@ -18245,6 +18257,60 @@ function portable(target) {
|
|
|
18245
18257
|
}
|
|
18246
18258
|
portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac64"), `${BASE}${FFMPEG_RELEASE}`;
|
|
18247
18259
|
/**
|
|
18260
|
+
* A device's KIND is its type plus its role (D1033): the type is the set of
|
|
18261
|
+
* controls it has, the role says which thing it is among the devices that
|
|
18262
|
+
* share those controls. A plug-in heater is a `switch` with role
|
|
18263
|
+
* `switch-heater`; an air conditioner and a radiator valve are both `climate`,
|
|
18264
|
+
* told apart by their `climate-*` role.
|
|
18265
|
+
*/
|
|
18266
|
+
/**
|
|
18267
|
+
* Type values a persisted row may still carry after the type was retired, and
|
|
18268
|
+
* the type each one is read as. The row is rewritten by the next registration
|
|
18269
|
+
* of the device (its provider stamps the live type), so this is a read alias,
|
|
18270
|
+
* not a migration.
|
|
18271
|
+
*
|
|
18272
|
+
* `heater` is deliberately absent: the only heaters were composed devices the
|
|
18273
|
+
* operator deletes. Such a row stays an unknown type, which every reader
|
|
18274
|
+
* treats as a generic device.
|
|
18275
|
+
*/
|
|
18276
|
+
var RETIRED_DEVICE_TYPES = { thermostat: DeviceType.Climate };
|
|
18277
|
+
/** The live type a stored `type` value stands for (itself unless retired). */
|
|
18278
|
+
function canonicalStoredDeviceType(stored) {
|
|
18279
|
+
return RETIRED_DEVICE_TYPES[stored] ?? stored;
|
|
18280
|
+
}
|
|
18281
|
+
preprocess((value) => typeof value === "string" ? canonicalStoredDeviceType(value) : value, _enum(DeviceType));
|
|
18282
|
+
DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
|
|
18283
|
+
/**
|
|
18284
|
+
* A relay driving an on/off-only lamp (a `switch` with role `switch-light`):
|
|
18285
|
+
* drawn and exported as a light, with the switch's power only. The one place
|
|
18286
|
+
* that reads the role for it — a consumer asks this, never the role string.
|
|
18287
|
+
*/
|
|
18288
|
+
function isSwitchLight(type, role) {
|
|
18289
|
+
return type === DeviceType.Switch && role === DeviceRole.SwitchLight;
|
|
18290
|
+
}
|
|
18291
|
+
/**
|
|
18292
|
+
* A smart plug (a `switch` with role `outlet`, D875): exported as a plug /
|
|
18293
|
+
* outlet. Exports ask this, never the role string.
|
|
18294
|
+
*/
|
|
18295
|
+
function isOutlet(type, role) {
|
|
18296
|
+
return type === DeviceType.Switch && role === DeviceRole.Outlet;
|
|
18297
|
+
}
|
|
18298
|
+
/**
|
|
18299
|
+
* A plain fan behind a switch (a `switch` with role `switch-fan`): exported as
|
|
18300
|
+
* a fan with the switch's on/off only — no speed it does not have.
|
|
18301
|
+
*/
|
|
18302
|
+
function isSwitchFan(type, role) {
|
|
18303
|
+
return type === DeviceType.Switch && role === DeviceRole.SwitchFan;
|
|
18304
|
+
}
|
|
18305
|
+
/**
|
|
18306
|
+
* A plug-in heater behind a switch (a `switch` with role `switch-heater`): it
|
|
18307
|
+
* has power only, no setpoint and no room temperature, so an export never
|
|
18308
|
+
* presents it as a thermostat.
|
|
18309
|
+
*/
|
|
18310
|
+
function isSwitchHeater(type, role) {
|
|
18311
|
+
return type === DeviceType.Switch && role === DeviceRole.SwitchHeater;
|
|
18312
|
+
}
|
|
18313
|
+
/**
|
|
18248
18314
|
* THE table "which boolean of this device type counts as HIGH", and the
|
|
18249
18315
|
* pure evaluator of its EDGE.
|
|
18250
18316
|
*
|
|
@@ -24172,7 +24238,7 @@ var DeviceTokenScopeSchema = object({
|
|
|
24172
24238
|
function migrateLegacyTokenScope(raw) {
|
|
24173
24239
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
24174
24240
|
if (Reflect.get(raw, "type") !== "device") return raw;
|
|
24175
|
-
if (Reflect.get(raw, "selector") !== void 0) return raw;
|
|
24241
|
+
if (Reflect.get(raw, "selector") !== void 0) return canonicalSelectorTypes(raw);
|
|
24176
24242
|
const targets = Reflect.get(raw, "targets");
|
|
24177
24243
|
if (!Array.isArray(targets)) return raw;
|
|
24178
24244
|
return {
|
|
@@ -24184,6 +24250,27 @@ function migrateLegacyTokenScope(raw) {
|
|
|
24184
24250
|
access: Reflect.get(raw, "access")
|
|
24185
24251
|
};
|
|
24186
24252
|
}
|
|
24253
|
+
/**
|
|
24254
|
+
* A stored `types` selector may name a type D1033 retired (`thermostat`). The
|
|
24255
|
+
* grant is read back through this same preprocess, so the retired name is
|
|
24256
|
+
* rewritten to its canonical type here and {@link DeviceSelectorSchema} itself
|
|
24257
|
+
* stays a strict enum on the wire.
|
|
24258
|
+
*/
|
|
24259
|
+
function canonicalSelectorTypes(raw) {
|
|
24260
|
+
const selector = Reflect.get(raw, "selector");
|
|
24261
|
+
if (selector === null || typeof selector !== "object") return raw;
|
|
24262
|
+
if (Reflect.get(selector, "kind") !== "types") return raw;
|
|
24263
|
+
const types = Reflect.get(selector, "types");
|
|
24264
|
+
if (!Array.isArray(types)) return raw;
|
|
24265
|
+
const canonical = types.map((t) => typeof t === "string" ? canonicalStoredDeviceType(t) : t);
|
|
24266
|
+
return {
|
|
24267
|
+
...raw,
|
|
24268
|
+
selector: {
|
|
24269
|
+
...selector,
|
|
24270
|
+
types: canonical
|
|
24271
|
+
}
|
|
24272
|
+
};
|
|
24273
|
+
}
|
|
24187
24274
|
var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
|
|
24188
24275
|
object({
|
|
24189
24276
|
type: literal("category"),
|
|
@@ -52238,8 +52325,8 @@ function actuator(input) {
|
|
|
52238
52325
|
};
|
|
52239
52326
|
}
|
|
52240
52327
|
new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
|
|
52241
|
-
DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
|
|
52242
52328
|
DeviceType.Camera;
|
|
52329
|
+
DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
|
|
52243
52330
|
var PowerSourceRefusalReasonSchema = _enum([
|
|
52244
52331
|
"no-power-source",
|
|
52245
52332
|
"switch-missing",
|
|
@@ -57890,7 +57977,7 @@ var HeroSceneSchema = object({
|
|
|
57890
57977
|
level: number$1().min(0).max(1).nullable()
|
|
57891
57978
|
});
|
|
57892
57979
|
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
|
|
57893
|
-
DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
|
|
57980
|
+
DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
|
|
57894
57981
|
var HeroRowIdSchema = _enum([
|
|
57895
57982
|
"progress",
|
|
57896
57983
|
"run-for",
|
|
@@ -80995,8 +81082,6 @@ var AccessoryKind = {
|
|
|
80995
81082
|
};
|
|
80996
81083
|
AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
|
|
80997
81084
|
DeviceType.HeatPump;
|
|
80998
|
-
DeviceType.Climate;
|
|
80999
|
-
DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
|
|
81000
81085
|
DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
|
|
81001
81086
|
new Set(Object.values(DeviceType));
|
|
81002
81087
|
/** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
|
|
@@ -83684,7 +83769,7 @@ lookOf({
|
|
|
83684
83769
|
});
|
|
83685
83770
|
DeviceType.Climate;
|
|
83686
83771
|
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
|
|
83687
|
-
DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
|
|
83772
|
+
DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
|
|
83688
83773
|
Object.freeze({
|
|
83689
83774
|
"accessories.getStatus": {
|
|
83690
83775
|
capName: "accessories",
|
|
@@ -148892,7 +148977,8 @@ function errMsg$14(err) {
|
|
|
148892
148977
|
* hands this builder the PARENT accessory + the CHILD's proxy + a
|
|
148893
148978
|
* unique subtype so each service round-trips deterministically through
|
|
148894
148979
|
* HAP serialisation. The builder:
|
|
148895
|
-
* - Maps `switch` cap → `Service.Switch
|
|
148980
|
+
* - Maps `switch` cap → `Service.Switch`, or the service the device's switch
|
|
148981
|
+
* sub-role names (`onOffServiceKind`).
|
|
148896
148982
|
* - Maps `switch` + `brightness` cap → `Service.Lightbulb` with
|
|
148897
148983
|
* Brightness characteristic (lighting devices only — see below).
|
|
148898
148984
|
* - Hydrates initial state from `getStatus({})`.
|
|
@@ -148914,7 +149000,21 @@ function errMsg$14(err) {
|
|
|
148914
149000
|
* Child devices without `switch` / `brightness` cap (status sensors,
|
|
148915
149001
|
* IR LED, etc.) return a no-op handle.
|
|
148916
149002
|
*/
|
|
148917
|
-
|
|
149003
|
+
function onOffServiceKind(deviceType, role, hasBrightness) {
|
|
149004
|
+
const isLightingDevice = deviceType === DeviceType.Light || deviceType === DeviceType.Generic;
|
|
149005
|
+
if (hasBrightness && isLightingDevice) return "dimmable-lightbulb";
|
|
149006
|
+
if (isSwitchLight(deviceType, role)) return "lightbulb";
|
|
149007
|
+
if (isOutlet(deviceType, role)) return "outlet";
|
|
149008
|
+
if (isSwitchFan(deviceType, role)) return "fan";
|
|
149009
|
+
return "switch";
|
|
149010
|
+
}
|
|
149011
|
+
function addOnOffService(accessory, kind, displayName, subtype) {
|
|
149012
|
+
if (kind === "dimmable-lightbulb" || kind === "lightbulb") return accessory.addService(import_dist.Service.Lightbulb, displayName, subtype);
|
|
149013
|
+
if (kind === "outlet") return accessory.addService(import_dist.Service.Outlet, displayName, subtype);
|
|
149014
|
+
if (kind === "fan") return accessory.addService(import_dist.Service.Fan, displayName, subtype);
|
|
149015
|
+
return accessory.addService(import_dist.Service.Switch, displayName, subtype);
|
|
149016
|
+
}
|
|
149017
|
+
async function buildChildSwitch(bctx, subtype, deviceType, role = null) {
|
|
148918
149018
|
const { ctx, accessory, proxy, numericDeviceId, displayName } = bctx;
|
|
148919
149019
|
const log = ctx.logger.withTags({ deviceId: numericDeviceId });
|
|
148920
149020
|
const hasSwitch = !!proxy.switch;
|
|
@@ -148923,17 +149023,21 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
|
|
|
148923
149023
|
log.debug("export-hap: child has no switch/brightness cap — skipping");
|
|
148924
149024
|
return { async dispose() {} };
|
|
148925
149025
|
}
|
|
148926
|
-
const
|
|
148927
|
-
const
|
|
148928
|
-
const service =
|
|
149026
|
+
const kind = onOffServiceKind(deviceType, role, hasBrightness);
|
|
149027
|
+
const dimmable = kind === "dimmable-lightbulb";
|
|
149028
|
+
const service = addOnOffService(accessory, kind, displayName, subtype);
|
|
148929
149029
|
applyServiceLabel(service, displayName);
|
|
149030
|
+
const setOn = (on) => {
|
|
149031
|
+
service.updateCharacteristic(import_dist.Characteristic.On, on);
|
|
149032
|
+
if (kind === "outlet") service.updateCharacteristic(import_dist.Characteristic.OutletInUse, on);
|
|
149033
|
+
};
|
|
148930
149034
|
try {
|
|
148931
149035
|
const switchStatus = await proxy.switch?.getStatus({});
|
|
148932
|
-
if (switchStatus && typeof switchStatus.on === "boolean")
|
|
149036
|
+
if (switchStatus && typeof switchStatus.on === "boolean") setOn(switchStatus.on);
|
|
148933
149037
|
} catch (err) {
|
|
148934
149038
|
log.debug("export-hap: child switch.getStatus failed (non-fatal)", { meta: { error: errMsg$13(err) } });
|
|
148935
149039
|
}
|
|
148936
|
-
if (
|
|
149040
|
+
if (dimmable) try {
|
|
148937
149041
|
const status = await proxy.brightness?.getStatus({});
|
|
148938
149042
|
if (status && typeof status.level === "number") service.updateCharacteristic(import_dist.Characteristic.Brightness, status.level);
|
|
148939
149043
|
} catch (err) {
|
|
@@ -148950,7 +149054,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
|
|
|
148950
149054
|
} });
|
|
148951
149055
|
}
|
|
148952
149056
|
});
|
|
148953
|
-
if (
|
|
149057
|
+
if (dimmable) service.getCharacteristic(import_dist.Characteristic.Brightness).onSet(async (value) => {
|
|
148954
149058
|
const percentage = typeof value === "number" ? value : Number(value);
|
|
148955
149059
|
if (!Number.isFinite(percentage)) return;
|
|
148956
149060
|
try {
|
|
@@ -148965,11 +149069,11 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
|
|
|
148965
149069
|
const unsubscribes = [];
|
|
148966
149070
|
if (proxy.state.switch) {
|
|
148967
149071
|
const unsubSwitch = proxy.state.switch.subscribe((value) => {
|
|
148968
|
-
if (value && typeof value.on === "boolean")
|
|
149072
|
+
if (value && typeof value.on === "boolean") setOn(value.on);
|
|
148969
149073
|
});
|
|
148970
149074
|
unsubscribes.push(unsubSwitch);
|
|
148971
149075
|
}
|
|
148972
|
-
if (
|
|
149076
|
+
if (dimmable && proxy.state.brightness) {
|
|
148973
149077
|
const unsubBrightness = proxy.state.brightness.subscribe((value) => {
|
|
148974
149078
|
if (value && typeof value.level === "number") service.updateCharacteristic(import_dist.Characteristic.Brightness, value.level);
|
|
148975
149079
|
});
|
|
@@ -149577,10 +149681,10 @@ var HAP_CAP_SERVICES = [
|
|
|
149577
149681
|
{
|
|
149578
149682
|
caps: ["switch", "brightness"],
|
|
149579
149683
|
label: "Power",
|
|
149580
|
-
build: ({ bctx, name, deviceType }) => buildChildSwitch({
|
|
149684
|
+
build: ({ bctx, name, deviceType, role }) => buildChildSwitch({
|
|
149581
149685
|
...bctx,
|
|
149582
149686
|
displayName: name
|
|
149583
|
-
}, "switch", deviceType)
|
|
149687
|
+
}, "switch", deviceType, role)
|
|
149584
149688
|
},
|
|
149585
149689
|
{
|
|
149586
149690
|
caps: ["lock-control"],
|
|
@@ -149638,7 +149742,17 @@ var ACCESSORY_CATEGORY_BY_TYPE = {
|
|
|
149638
149742
|
[DeviceType.Presence]: import_dist.Categories.SENSOR,
|
|
149639
149743
|
[DeviceType.AlarmPanel]: import_dist.Categories.SECURITY_SYSTEM
|
|
149640
149744
|
};
|
|
149641
|
-
|
|
149745
|
+
/**
|
|
149746
|
+
* The category, by type and then by the switch's sub-role (read only through
|
|
149747
|
+
* the `@camstack/types` accessors). A heater keeps a Switch service (see
|
|
149748
|
+
* `onOffServiceKind`) and takes HomeKit's heater category, which is an icon
|
|
149749
|
+
* and promises no characteristic. A helper boolean stays a SWITCH.
|
|
149750
|
+
*/
|
|
149751
|
+
function accessoryCategoryFor(deviceType, role) {
|
|
149752
|
+
if (isSwitchLight(deviceType, role)) return import_dist.Categories.LIGHTBULB;
|
|
149753
|
+
if (isOutlet(deviceType, role)) return import_dist.Categories.OUTLET;
|
|
149754
|
+
if (isSwitchFan(deviceType, role)) return import_dist.Categories.FAN;
|
|
149755
|
+
if (isSwitchHeater(deviceType, role)) return import_dist.Categories.AIR_HEATER;
|
|
149642
149756
|
return ACCESSORY_CATEGORY_BY_TYPE[deviceType] ?? import_dist.Categories.OTHER;
|
|
149643
149757
|
}
|
|
149644
149758
|
//#endregion
|
|
@@ -164625,7 +164739,7 @@ async function buildChildServicesFor(input) {
|
|
|
164625
164739
|
options
|
|
164626
164740
|
};
|
|
164627
164741
|
const subtype = `child-${child.id}`;
|
|
164628
|
-
handles.push(await buildChildSwitch(childCtx, subtype, asDeviceType(child.type)));
|
|
164742
|
+
handles.push(await buildChildSwitch(childCtx, subtype, asDeviceType(child.type), child.role ?? null));
|
|
164629
164743
|
}
|
|
164630
164744
|
return { async dispose() {
|
|
164631
164745
|
for (const h of handles) try {
|
|
@@ -165603,9 +165717,9 @@ async function buildGenericAccessory(input) {
|
|
|
165603
165717
|
const capNames = new Set(proxy.binding?.entries.map((e) => e.capName) ?? []);
|
|
165604
165718
|
const rows = rowsForCaps(capNames);
|
|
165605
165719
|
if (rows.length === 0) throw new Error(`export-hap: device ${numericId} carries no capability HomeKit can export (bound: ${[...capNames].toSorted().join(", ") || "none"})`);
|
|
165606
|
-
const deviceType = await
|
|
165720
|
+
const { type: deviceType, role } = await resolveDeviceKind(proxy);
|
|
165607
165721
|
const accessory = new import_dist.Accessory(displayName, accessoryUuidFor("generic", numericId, options.instanceId));
|
|
165608
|
-
accessory.category = accessoryCategoryFor(deviceType);
|
|
165722
|
+
accessory.category = accessoryCategoryFor(deviceType, role);
|
|
165609
165723
|
await populateAccessoryInfo(accessory, proxy, displayName, "Accessory");
|
|
165610
165724
|
const bctx = {
|
|
165611
165725
|
ctx,
|
|
@@ -165621,11 +165735,13 @@ async function buildGenericAccessory(input) {
|
|
|
165621
165735
|
handles.push(await row.build({
|
|
165622
165736
|
bctx,
|
|
165623
165737
|
name,
|
|
165624
|
-
deviceType
|
|
165738
|
+
deviceType,
|
|
165739
|
+
role
|
|
165625
165740
|
}));
|
|
165626
165741
|
}
|
|
165627
165742
|
log.info("export-hap: built generic accessory", { meta: {
|
|
165628
165743
|
deviceType,
|
|
165744
|
+
role,
|
|
165629
165745
|
services: rows.map((row) => row.caps[0]).join(",")
|
|
165630
165746
|
} });
|
|
165631
165747
|
return {
|
|
@@ -165641,20 +165757,27 @@ async function buildGenericAccessory(input) {
|
|
|
165641
165757
|
};
|
|
165642
165758
|
}
|
|
165643
165759
|
/**
|
|
165644
|
-
* The device's own type, or `Generic
|
|
165760
|
+
* The device's own type, or `Generic`, and its role (null when unread).
|
|
165645
165761
|
*
|
|
165646
165762
|
* Used ONLY where one capability has two HomeKit shapes — a siren's
|
|
165647
|
-
* `brightness` is alarm volume, not luminosity
|
|
165763
|
+
* `brightness` is alarm volume, not luminosity; a `switch-light` relay is a
|
|
165764
|
+
* Lightbulb, not a Switch — and for the accessory's icon.
|
|
165648
165765
|
* `Generic` is the safe reading: it is the shape `child-switch.ts` already
|
|
165649
165766
|
* treats as "a lamp if it dims, a switch otherwise".
|
|
165650
165767
|
*/
|
|
165651
|
-
async function
|
|
165768
|
+
async function resolveDeviceKind(proxy) {
|
|
165652
165769
|
try {
|
|
165653
165770
|
const device = await proxy.deviceManager?.getDevice({});
|
|
165654
165771
|
const raw = typeof device?.type === "string" ? device.type.toLowerCase() : "";
|
|
165655
|
-
return
|
|
165772
|
+
return {
|
|
165773
|
+
type: Object.values(DeviceType).find((value) => value === raw) ?? DeviceType.Generic,
|
|
165774
|
+
role: typeof device?.role === "string" ? device.role : null
|
|
165775
|
+
};
|
|
165656
165776
|
} catch {
|
|
165657
|
-
return
|
|
165777
|
+
return {
|
|
165778
|
+
type: DeviceType.Generic,
|
|
165779
|
+
role: null
|
|
165780
|
+
};
|
|
165658
165781
|
}
|
|
165659
165782
|
}
|
|
165660
165783
|
function errMsg$1(err) {
|
|
@@ -851,7 +851,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
851
851
|
return EventCategory;
|
|
852
852
|
}({});
|
|
853
853
|
//#endregion
|
|
854
|
-
//#region ../types/dist/composed-stable-id-
|
|
854
|
+
//#region ../types/dist/composed-stable-id-iddnCQ51.mjs
|
|
855
855
|
/**
|
|
856
856
|
import { errMsg } from '@camstack/types'
|
|
857
857
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -1193,6 +1193,11 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
1193
1193
|
* with the switch's on/off only. Speed or oscillation appear only when the
|
|
1194
1194
|
* device also has a fan cap (D1033). */
|
|
1195
1195
|
DeviceRole["SwitchFan"] = "switch-fan";
|
|
1196
|
+
/** A relay driving an on/off-only lamp: drawn as a light (bulb and glow, no
|
|
1197
|
+
* slider), presented to the exports as a light with power only. Not a
|
|
1198
|
+
* `light` type: the provider owns the type, and a light implies brightness
|
|
1199
|
+
* or colour this relay lacks. */
|
|
1200
|
+
DeviceRole["SwitchLight"] = "switch-light";
|
|
1196
1201
|
/** Air conditioner / split unit: cooling, fan speed, louvres. */
|
|
1197
1202
|
DeviceRole["ClimateAc"] = "climate-ac";
|
|
1198
1203
|
/** Room thermostat: a setpoint and a room temperature. The default. */
|
|
@@ -6093,7 +6098,7 @@ var ZodIssueCode = {
|
|
|
6093
6098
|
var ZodFirstPartyTypeKind;
|
|
6094
6099
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6095
6100
|
//#endregion
|
|
6096
|
-
//#region ../types/dist/sleep-
|
|
6101
|
+
//#region ../types/dist/sleep-BvVGLl30.mjs
|
|
6097
6102
|
/**
|
|
6098
6103
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6099
6104
|
* window to float samples (D455).
|
|
@@ -10806,6 +10811,13 @@ var ACTUATOR_CAP_VOCABULARY = {
|
|
|
10806
10811
|
},
|
|
10807
10812
|
state: { on: { icon: "lightbulb" } }
|
|
10808
10813
|
},
|
|
10814
|
+
[DeviceRole.SwitchLight]: {
|
|
10815
|
+
actions: {
|
|
10816
|
+
"switch.on": { icon: "lightbulb" },
|
|
10817
|
+
"switch.off": { icon: "lightbulb-off" }
|
|
10818
|
+
},
|
|
10819
|
+
state: { on: { icon: "lightbulb" } }
|
|
10820
|
+
},
|
|
10809
10821
|
[DeviceRole.Chime]: { actions: {
|
|
10810
10822
|
"switch.on": {
|
|
10811
10823
|
label: t("Enable chime", "Attiva il campanello"),
|
|
@@ -17585,7 +17597,7 @@ Object.freeze({
|
|
|
17585
17597
|
}
|
|
17586
17598
|
});
|
|
17587
17599
|
//#endregion
|
|
17588
|
-
//#region ../types/dist/implemented-methods-
|
|
17600
|
+
//#region ../types/dist/implemented-methods-CSTk6zYK.mjs
|
|
17589
17601
|
var AUDIO_ENCODER_BY_CODEC = {
|
|
17590
17602
|
opus: "libopus",
|
|
17591
17603
|
aac: "aac",
|
|
@@ -18235,6 +18247,60 @@ function portable(target) {
|
|
|
18235
18247
|
}
|
|
18236
18248
|
portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac64"), `${BASE}${FFMPEG_RELEASE}`;
|
|
18237
18249
|
/**
|
|
18250
|
+
* A device's KIND is its type plus its role (D1033): the type is the set of
|
|
18251
|
+
* controls it has, the role says which thing it is among the devices that
|
|
18252
|
+
* share those controls. A plug-in heater is a `switch` with role
|
|
18253
|
+
* `switch-heater`; an air conditioner and a radiator valve are both `climate`,
|
|
18254
|
+
* told apart by their `climate-*` role.
|
|
18255
|
+
*/
|
|
18256
|
+
/**
|
|
18257
|
+
* Type values a persisted row may still carry after the type was retired, and
|
|
18258
|
+
* the type each one is read as. The row is rewritten by the next registration
|
|
18259
|
+
* of the device (its provider stamps the live type), so this is a read alias,
|
|
18260
|
+
* not a migration.
|
|
18261
|
+
*
|
|
18262
|
+
* `heater` is deliberately absent: the only heaters were composed devices the
|
|
18263
|
+
* operator deletes. Such a row stays an unknown type, which every reader
|
|
18264
|
+
* treats as a generic device.
|
|
18265
|
+
*/
|
|
18266
|
+
var RETIRED_DEVICE_TYPES = { thermostat: DeviceType.Climate };
|
|
18267
|
+
/** The live type a stored `type` value stands for (itself unless retired). */
|
|
18268
|
+
function canonicalStoredDeviceType(stored) {
|
|
18269
|
+
return RETIRED_DEVICE_TYPES[stored] ?? stored;
|
|
18270
|
+
}
|
|
18271
|
+
preprocess((value) => typeof value === "string" ? canonicalStoredDeviceType(value) : value, _enum(DeviceType));
|
|
18272
|
+
DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
|
|
18273
|
+
/**
|
|
18274
|
+
* A relay driving an on/off-only lamp (a `switch` with role `switch-light`):
|
|
18275
|
+
* drawn and exported as a light, with the switch's power only. The one place
|
|
18276
|
+
* that reads the role for it — a consumer asks this, never the role string.
|
|
18277
|
+
*/
|
|
18278
|
+
function isSwitchLight(type, role) {
|
|
18279
|
+
return type === DeviceType.Switch && role === DeviceRole.SwitchLight;
|
|
18280
|
+
}
|
|
18281
|
+
/**
|
|
18282
|
+
* A smart plug (a `switch` with role `outlet`, D875): exported as a plug /
|
|
18283
|
+
* outlet. Exports ask this, never the role string.
|
|
18284
|
+
*/
|
|
18285
|
+
function isOutlet(type, role) {
|
|
18286
|
+
return type === DeviceType.Switch && role === DeviceRole.Outlet;
|
|
18287
|
+
}
|
|
18288
|
+
/**
|
|
18289
|
+
* A plain fan behind a switch (a `switch` with role `switch-fan`): exported as
|
|
18290
|
+
* a fan with the switch's on/off only — no speed it does not have.
|
|
18291
|
+
*/
|
|
18292
|
+
function isSwitchFan(type, role) {
|
|
18293
|
+
return type === DeviceType.Switch && role === DeviceRole.SwitchFan;
|
|
18294
|
+
}
|
|
18295
|
+
/**
|
|
18296
|
+
* A plug-in heater behind a switch (a `switch` with role `switch-heater`): it
|
|
18297
|
+
* has power only, no setpoint and no room temperature, so an export never
|
|
18298
|
+
* presents it as a thermostat.
|
|
18299
|
+
*/
|
|
18300
|
+
function isSwitchHeater(type, role) {
|
|
18301
|
+
return type === DeviceType.Switch && role === DeviceRole.SwitchHeater;
|
|
18302
|
+
}
|
|
18303
|
+
/**
|
|
18238
18304
|
* THE table "which boolean of this device type counts as HIGH", and the
|
|
18239
18305
|
* pure evaluator of its EDGE.
|
|
18240
18306
|
*
|
|
@@ -24162,7 +24228,7 @@ var DeviceTokenScopeSchema = object({
|
|
|
24162
24228
|
function migrateLegacyTokenScope(raw) {
|
|
24163
24229
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
24164
24230
|
if (Reflect.get(raw, "type") !== "device") return raw;
|
|
24165
|
-
if (Reflect.get(raw, "selector") !== void 0) return raw;
|
|
24231
|
+
if (Reflect.get(raw, "selector") !== void 0) return canonicalSelectorTypes(raw);
|
|
24166
24232
|
const targets = Reflect.get(raw, "targets");
|
|
24167
24233
|
if (!Array.isArray(targets)) return raw;
|
|
24168
24234
|
return {
|
|
@@ -24174,6 +24240,27 @@ function migrateLegacyTokenScope(raw) {
|
|
|
24174
24240
|
access: Reflect.get(raw, "access")
|
|
24175
24241
|
};
|
|
24176
24242
|
}
|
|
24243
|
+
/**
|
|
24244
|
+
* A stored `types` selector may name a type D1033 retired (`thermostat`). The
|
|
24245
|
+
* grant is read back through this same preprocess, so the retired name is
|
|
24246
|
+
* rewritten to its canonical type here and {@link DeviceSelectorSchema} itself
|
|
24247
|
+
* stays a strict enum on the wire.
|
|
24248
|
+
*/
|
|
24249
|
+
function canonicalSelectorTypes(raw) {
|
|
24250
|
+
const selector = Reflect.get(raw, "selector");
|
|
24251
|
+
if (selector === null || typeof selector !== "object") return raw;
|
|
24252
|
+
if (Reflect.get(selector, "kind") !== "types") return raw;
|
|
24253
|
+
const types = Reflect.get(selector, "types");
|
|
24254
|
+
if (!Array.isArray(types)) return raw;
|
|
24255
|
+
const canonical = types.map((t) => typeof t === "string" ? canonicalStoredDeviceType(t) : t);
|
|
24256
|
+
return {
|
|
24257
|
+
...raw,
|
|
24258
|
+
selector: {
|
|
24259
|
+
...selector,
|
|
24260
|
+
types: canonical
|
|
24261
|
+
}
|
|
24262
|
+
};
|
|
24263
|
+
}
|
|
24177
24264
|
var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
|
|
24178
24265
|
object({
|
|
24179
24266
|
type: literal("category"),
|
|
@@ -52228,8 +52315,8 @@ function actuator(input) {
|
|
|
52228
52315
|
};
|
|
52229
52316
|
}
|
|
52230
52317
|
new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
|
|
52231
|
-
DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
|
|
52232
52318
|
DeviceType.Camera;
|
|
52319
|
+
DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
|
|
52233
52320
|
var PowerSourceRefusalReasonSchema = _enum([
|
|
52234
52321
|
"no-power-source",
|
|
52235
52322
|
"switch-missing",
|
|
@@ -57880,7 +57967,7 @@ var HeroSceneSchema = object({
|
|
|
57880
57967
|
level: number$1().min(0).max(1).nullable()
|
|
57881
57968
|
});
|
|
57882
57969
|
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
|
|
57883
|
-
DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
|
|
57970
|
+
DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
|
|
57884
57971
|
var HeroRowIdSchema = _enum([
|
|
57885
57972
|
"progress",
|
|
57886
57973
|
"run-for",
|
|
@@ -80985,8 +81072,6 @@ var AccessoryKind = {
|
|
|
80985
81072
|
};
|
|
80986
81073
|
AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
|
|
80987
81074
|
DeviceType.HeatPump;
|
|
80988
|
-
DeviceType.Climate;
|
|
80989
|
-
DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
|
|
80990
81075
|
DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
|
|
80991
81076
|
new Set(Object.values(DeviceType));
|
|
80992
81077
|
/** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
|
|
@@ -83674,7 +83759,7 @@ lookOf({
|
|
|
83674
83759
|
});
|
|
83675
83760
|
DeviceType.Climate;
|
|
83676
83761
|
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
|
|
83677
|
-
DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
|
|
83762
|
+
DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
|
|
83678
83763
|
Object.freeze({
|
|
83679
83764
|
"accessories.getStatus": {
|
|
83680
83765
|
capName: "accessories",
|
|
@@ -148882,7 +148967,8 @@ function errMsg$14(err) {
|
|
|
148882
148967
|
* hands this builder the PARENT accessory + the CHILD's proxy + a
|
|
148883
148968
|
* unique subtype so each service round-trips deterministically through
|
|
148884
148969
|
* HAP serialisation. The builder:
|
|
148885
|
-
* - Maps `switch` cap → `Service.Switch
|
|
148970
|
+
* - Maps `switch` cap → `Service.Switch`, or the service the device's switch
|
|
148971
|
+
* sub-role names (`onOffServiceKind`).
|
|
148886
148972
|
* - Maps `switch` + `brightness` cap → `Service.Lightbulb` with
|
|
148887
148973
|
* Brightness characteristic (lighting devices only — see below).
|
|
148888
148974
|
* - Hydrates initial state from `getStatus({})`.
|
|
@@ -148904,7 +148990,21 @@ function errMsg$14(err) {
|
|
|
148904
148990
|
* Child devices without `switch` / `brightness` cap (status sensors,
|
|
148905
148991
|
* IR LED, etc.) return a no-op handle.
|
|
148906
148992
|
*/
|
|
148907
|
-
|
|
148993
|
+
function onOffServiceKind(deviceType, role, hasBrightness) {
|
|
148994
|
+
const isLightingDevice = deviceType === DeviceType.Light || deviceType === DeviceType.Generic;
|
|
148995
|
+
if (hasBrightness && isLightingDevice) return "dimmable-lightbulb";
|
|
148996
|
+
if (isSwitchLight(deviceType, role)) return "lightbulb";
|
|
148997
|
+
if (isOutlet(deviceType, role)) return "outlet";
|
|
148998
|
+
if (isSwitchFan(deviceType, role)) return "fan";
|
|
148999
|
+
return "switch";
|
|
149000
|
+
}
|
|
149001
|
+
function addOnOffService(accessory, kind, displayName, subtype) {
|
|
149002
|
+
if (kind === "dimmable-lightbulb" || kind === "lightbulb") return accessory.addService(import_dist.Service.Lightbulb, displayName, subtype);
|
|
149003
|
+
if (kind === "outlet") return accessory.addService(import_dist.Service.Outlet, displayName, subtype);
|
|
149004
|
+
if (kind === "fan") return accessory.addService(import_dist.Service.Fan, displayName, subtype);
|
|
149005
|
+
return accessory.addService(import_dist.Service.Switch, displayName, subtype);
|
|
149006
|
+
}
|
|
149007
|
+
async function buildChildSwitch(bctx, subtype, deviceType, role = null) {
|
|
148908
149008
|
const { ctx, accessory, proxy, numericDeviceId, displayName } = bctx;
|
|
148909
149009
|
const log = ctx.logger.withTags({ deviceId: numericDeviceId });
|
|
148910
149010
|
const hasSwitch = !!proxy.switch;
|
|
@@ -148913,17 +149013,21 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
|
|
|
148913
149013
|
log.debug("export-hap: child has no switch/brightness cap — skipping");
|
|
148914
149014
|
return { async dispose() {} };
|
|
148915
149015
|
}
|
|
148916
|
-
const
|
|
148917
|
-
const
|
|
148918
|
-
const service =
|
|
149016
|
+
const kind = onOffServiceKind(deviceType, role, hasBrightness);
|
|
149017
|
+
const dimmable = kind === "dimmable-lightbulb";
|
|
149018
|
+
const service = addOnOffService(accessory, kind, displayName, subtype);
|
|
148919
149019
|
applyServiceLabel(service, displayName);
|
|
149020
|
+
const setOn = (on) => {
|
|
149021
|
+
service.updateCharacteristic(import_dist.Characteristic.On, on);
|
|
149022
|
+
if (kind === "outlet") service.updateCharacteristic(import_dist.Characteristic.OutletInUse, on);
|
|
149023
|
+
};
|
|
148920
149024
|
try {
|
|
148921
149025
|
const switchStatus = await proxy.switch?.getStatus({});
|
|
148922
|
-
if (switchStatus && typeof switchStatus.on === "boolean")
|
|
149026
|
+
if (switchStatus && typeof switchStatus.on === "boolean") setOn(switchStatus.on);
|
|
148923
149027
|
} catch (err) {
|
|
148924
149028
|
log.debug("export-hap: child switch.getStatus failed (non-fatal)", { meta: { error: errMsg$13(err) } });
|
|
148925
149029
|
}
|
|
148926
|
-
if (
|
|
149030
|
+
if (dimmable) try {
|
|
148927
149031
|
const status = await proxy.brightness?.getStatus({});
|
|
148928
149032
|
if (status && typeof status.level === "number") service.updateCharacteristic(import_dist.Characteristic.Brightness, status.level);
|
|
148929
149033
|
} catch (err) {
|
|
@@ -148940,7 +149044,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
|
|
|
148940
149044
|
} });
|
|
148941
149045
|
}
|
|
148942
149046
|
});
|
|
148943
|
-
if (
|
|
149047
|
+
if (dimmable) service.getCharacteristic(import_dist.Characteristic.Brightness).onSet(async (value) => {
|
|
148944
149048
|
const percentage = typeof value === "number" ? value : Number(value);
|
|
148945
149049
|
if (!Number.isFinite(percentage)) return;
|
|
148946
149050
|
try {
|
|
@@ -148955,11 +149059,11 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
|
|
|
148955
149059
|
const unsubscribes = [];
|
|
148956
149060
|
if (proxy.state.switch) {
|
|
148957
149061
|
const unsubSwitch = proxy.state.switch.subscribe((value) => {
|
|
148958
|
-
if (value && typeof value.on === "boolean")
|
|
149062
|
+
if (value && typeof value.on === "boolean") setOn(value.on);
|
|
148959
149063
|
});
|
|
148960
149064
|
unsubscribes.push(unsubSwitch);
|
|
148961
149065
|
}
|
|
148962
|
-
if (
|
|
149066
|
+
if (dimmable && proxy.state.brightness) {
|
|
148963
149067
|
const unsubBrightness = proxy.state.brightness.subscribe((value) => {
|
|
148964
149068
|
if (value && typeof value.level === "number") service.updateCharacteristic(import_dist.Characteristic.Brightness, value.level);
|
|
148965
149069
|
});
|
|
@@ -149567,10 +149671,10 @@ var HAP_CAP_SERVICES = [
|
|
|
149567
149671
|
{
|
|
149568
149672
|
caps: ["switch", "brightness"],
|
|
149569
149673
|
label: "Power",
|
|
149570
|
-
build: ({ bctx, name, deviceType }) => buildChildSwitch({
|
|
149674
|
+
build: ({ bctx, name, deviceType, role }) => buildChildSwitch({
|
|
149571
149675
|
...bctx,
|
|
149572
149676
|
displayName: name
|
|
149573
|
-
}, "switch", deviceType)
|
|
149677
|
+
}, "switch", deviceType, role)
|
|
149574
149678
|
},
|
|
149575
149679
|
{
|
|
149576
149680
|
caps: ["lock-control"],
|
|
@@ -149628,7 +149732,17 @@ var ACCESSORY_CATEGORY_BY_TYPE = {
|
|
|
149628
149732
|
[DeviceType.Presence]: import_dist.Categories.SENSOR,
|
|
149629
149733
|
[DeviceType.AlarmPanel]: import_dist.Categories.SECURITY_SYSTEM
|
|
149630
149734
|
};
|
|
149631
|
-
|
|
149735
|
+
/**
|
|
149736
|
+
* The category, by type and then by the switch's sub-role (read only through
|
|
149737
|
+
* the `@camstack/types` accessors). A heater keeps a Switch service (see
|
|
149738
|
+
* `onOffServiceKind`) and takes HomeKit's heater category, which is an icon
|
|
149739
|
+
* and promises no characteristic. A helper boolean stays a SWITCH.
|
|
149740
|
+
*/
|
|
149741
|
+
function accessoryCategoryFor(deviceType, role) {
|
|
149742
|
+
if (isSwitchLight(deviceType, role)) return import_dist.Categories.LIGHTBULB;
|
|
149743
|
+
if (isOutlet(deviceType, role)) return import_dist.Categories.OUTLET;
|
|
149744
|
+
if (isSwitchFan(deviceType, role)) return import_dist.Categories.FAN;
|
|
149745
|
+
if (isSwitchHeater(deviceType, role)) return import_dist.Categories.AIR_HEATER;
|
|
149632
149746
|
return ACCESSORY_CATEGORY_BY_TYPE[deviceType] ?? import_dist.Categories.OTHER;
|
|
149633
149747
|
}
|
|
149634
149748
|
//#endregion
|
|
@@ -164615,7 +164729,7 @@ async function buildChildServicesFor(input) {
|
|
|
164615
164729
|
options
|
|
164616
164730
|
};
|
|
164617
164731
|
const subtype = `child-${child.id}`;
|
|
164618
|
-
handles.push(await buildChildSwitch(childCtx, subtype, asDeviceType(child.type)));
|
|
164732
|
+
handles.push(await buildChildSwitch(childCtx, subtype, asDeviceType(child.type), child.role ?? null));
|
|
164619
164733
|
}
|
|
164620
164734
|
return { async dispose() {
|
|
164621
164735
|
for (const h of handles) try {
|
|
@@ -165593,9 +165707,9 @@ async function buildGenericAccessory(input) {
|
|
|
165593
165707
|
const capNames = new Set(proxy.binding?.entries.map((e) => e.capName) ?? []);
|
|
165594
165708
|
const rows = rowsForCaps(capNames);
|
|
165595
165709
|
if (rows.length === 0) throw new Error(`export-hap: device ${numericId} carries no capability HomeKit can export (bound: ${[...capNames].toSorted().join(", ") || "none"})`);
|
|
165596
|
-
const deviceType = await
|
|
165710
|
+
const { type: deviceType, role } = await resolveDeviceKind(proxy);
|
|
165597
165711
|
const accessory = new import_dist.Accessory(displayName, accessoryUuidFor("generic", numericId, options.instanceId));
|
|
165598
|
-
accessory.category = accessoryCategoryFor(deviceType);
|
|
165712
|
+
accessory.category = accessoryCategoryFor(deviceType, role);
|
|
165599
165713
|
await populateAccessoryInfo(accessory, proxy, displayName, "Accessory");
|
|
165600
165714
|
const bctx = {
|
|
165601
165715
|
ctx,
|
|
@@ -165611,11 +165725,13 @@ async function buildGenericAccessory(input) {
|
|
|
165611
165725
|
handles.push(await row.build({
|
|
165612
165726
|
bctx,
|
|
165613
165727
|
name,
|
|
165614
|
-
deviceType
|
|
165728
|
+
deviceType,
|
|
165729
|
+
role
|
|
165615
165730
|
}));
|
|
165616
165731
|
}
|
|
165617
165732
|
log.info("export-hap: built generic accessory", { meta: {
|
|
165618
165733
|
deviceType,
|
|
165734
|
+
role,
|
|
165619
165735
|
services: rows.map((row) => row.caps[0]).join(",")
|
|
165620
165736
|
} });
|
|
165621
165737
|
return {
|
|
@@ -165631,20 +165747,27 @@ async function buildGenericAccessory(input) {
|
|
|
165631
165747
|
};
|
|
165632
165748
|
}
|
|
165633
165749
|
/**
|
|
165634
|
-
* The device's own type, or `Generic
|
|
165750
|
+
* The device's own type, or `Generic`, and its role (null when unread).
|
|
165635
165751
|
*
|
|
165636
165752
|
* Used ONLY where one capability has two HomeKit shapes — a siren's
|
|
165637
|
-
* `brightness` is alarm volume, not luminosity
|
|
165753
|
+
* `brightness` is alarm volume, not luminosity; a `switch-light` relay is a
|
|
165754
|
+
* Lightbulb, not a Switch — and for the accessory's icon.
|
|
165638
165755
|
* `Generic` is the safe reading: it is the shape `child-switch.ts` already
|
|
165639
165756
|
* treats as "a lamp if it dims, a switch otherwise".
|
|
165640
165757
|
*/
|
|
165641
|
-
async function
|
|
165758
|
+
async function resolveDeviceKind(proxy) {
|
|
165642
165759
|
try {
|
|
165643
165760
|
const device = await proxy.deviceManager?.getDevice({});
|
|
165644
165761
|
const raw = typeof device?.type === "string" ? device.type.toLowerCase() : "";
|
|
165645
|
-
return
|
|
165762
|
+
return {
|
|
165763
|
+
type: Object.values(DeviceType).find((value) => value === raw) ?? DeviceType.Generic,
|
|
165764
|
+
role: typeof device?.role === "string" ? device.role : null
|
|
165765
|
+
};
|
|
165646
165766
|
} catch {
|
|
165647
|
-
return
|
|
165767
|
+
return {
|
|
165768
|
+
type: DeviceType.Generic,
|
|
165769
|
+
role: null
|
|
165770
|
+
};
|
|
165648
165771
|
}
|
|
165649
165772
|
}
|
|
165650
165773
|
function errMsg$1(err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-export-hap",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.201",
|
|
4
4
|
"description": "HomeKit (HAP) exporter for CamStack devices. Publishes each exposed device as its own HomeKit accessory: cameras and doorbells with SRTP streaming, HomeKit Secure Video, motion, two-way audio, PTZ and battery; switches, lights, locks and sensors through a capability→service table.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
}
|
|
68
68
|
],
|
|
69
69
|
"requires": {
|
|
70
|
-
"server": ">=1.2.
|
|
70
|
+
"server": ">=1.2.852"
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"files": [
|