@camstack/addon-export-alexa 1.2.196 → 1.2.197

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 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.197] - 2026-11-13
11
+
12
+ ### Changed
13
+
14
+ - A switch with the role switch-light is discovered by Alexa as a LIGHT with power only
15
+ - A switch-fan is exported as a FAN and an outlet or fan child as SMARTPLUG / FAN; a heater or helper switch stays a SWITCH.
16
+
10
17
  ## [1.2.196] - 2026-11-12
11
18
 
12
19
  ### Changed
@@ -846,7 +846,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
846
846
  return EventCategory;
847
847
  }({});
848
848
  //#endregion
849
- //#region ../types/dist/composed-stable-id-CPp3votu.mjs
849
+ //#region ../types/dist/composed-stable-id-iddnCQ51.mjs
850
850
  /**
851
851
  import { errMsg } from '@camstack/types'
852
852
  * Extract a human-readable message from an unknown error value.
@@ -1188,6 +1188,11 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1188
1188
  * with the switch's on/off only. Speed or oscillation appear only when the
1189
1189
  * device also has a fan cap (D1033). */
1190
1190
  DeviceRole["SwitchFan"] = "switch-fan";
1191
+ /** A relay driving an on/off-only lamp: drawn as a light (bulb and glow, no
1192
+ * slider), presented to the exports as a light with power only. Not a
1193
+ * `light` type: the provider owns the type, and a light implies brightness
1194
+ * or colour this relay lacks. */
1195
+ DeviceRole["SwitchLight"] = "switch-light";
1191
1196
  /** Air conditioner / split unit: cooling, fan speed, louvres. */
1192
1197
  DeviceRole["ClimateAc"] = "climate-ac";
1193
1198
  /** Room thermostat: a setpoint and a room temperature. The default. */
@@ -6088,7 +6093,7 @@ var ZodIssueCode = {
6088
6093
  var ZodFirstPartyTypeKind;
6089
6094
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6090
6095
  //#endregion
6091
- //#region ../types/dist/sleep-DyIxjZZt.mjs
6096
+ //#region ../types/dist/sleep-BvVGLl30.mjs
6092
6097
  /**
6093
6098
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6094
6099
  * window to float samples (D455).
@@ -10801,6 +10806,13 @@ var ACTUATOR_CAP_VOCABULARY = {
10801
10806
  },
10802
10807
  state: { on: { icon: "lightbulb" } }
10803
10808
  },
10809
+ [DeviceRole.SwitchLight]: {
10810
+ actions: {
10811
+ "switch.on": { icon: "lightbulb" },
10812
+ "switch.off": { icon: "lightbulb-off" }
10813
+ },
10814
+ state: { on: { icon: "lightbulb" } }
10815
+ },
10804
10816
  [DeviceRole.Chime]: { actions: {
10805
10817
  "switch.on": {
10806
10818
  label: t("Enable chime", "Attiva il campanello"),
@@ -17521,7 +17533,7 @@ Object.freeze({
17521
17533
  }
17522
17534
  });
17523
17535
  //#endregion
17524
- //#region ../types/dist/implemented-methods-5YMDeE3f.mjs
17536
+ //#region ../types/dist/implemented-methods-CSTk6zYK.mjs
17525
17537
  /**
17526
17538
  * The ffmpeg build every CamStack node downloads, per platform and arch.
17527
17539
  *
@@ -17575,6 +17587,52 @@ function portable(target) {
17575
17587
  }
17576
17588
  portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac64"), `${BASE$1}${FFMPEG_RELEASE}`;
17577
17589
  /**
17590
+ * A device's KIND is its type plus its role (D1033): the type is the set of
17591
+ * controls it has, the role says which thing it is among the devices that
17592
+ * share those controls. A plug-in heater is a `switch` with role
17593
+ * `switch-heater`; an air conditioner and a radiator valve are both `climate`,
17594
+ * told apart by their `climate-*` role.
17595
+ */
17596
+ /**
17597
+ * Type values a persisted row may still carry after the type was retired, and
17598
+ * the type each one is read as. The row is rewritten by the next registration
17599
+ * of the device (its provider stamps the live type), so this is a read alias,
17600
+ * not a migration.
17601
+ *
17602
+ * `heater` is deliberately absent: the only heaters were composed devices the
17603
+ * operator deletes. Such a row stays an unknown type, which every reader
17604
+ * treats as a generic device.
17605
+ */
17606
+ var RETIRED_DEVICE_TYPES = { thermostat: DeviceType.Climate };
17607
+ /** The live type a stored `type` value stands for (itself unless retired). */
17608
+ function canonicalStoredDeviceType(stored) {
17609
+ return RETIRED_DEVICE_TYPES[stored] ?? stored;
17610
+ }
17611
+ preprocess((value) => typeof value === "string" ? canonicalStoredDeviceType(value) : value, _enum(DeviceType));
17612
+ DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
17613
+ /**
17614
+ * A relay driving an on/off-only lamp (a `switch` with role `switch-light`):
17615
+ * drawn and exported as a light, with the switch's power only. The one place
17616
+ * that reads the role for it — a consumer asks this, never the role string.
17617
+ */
17618
+ function isSwitchLight(type, role) {
17619
+ return type === DeviceType.Switch && role === DeviceRole.SwitchLight;
17620
+ }
17621
+ /**
17622
+ * A smart plug (a `switch` with role `outlet`, D875): exported as a plug /
17623
+ * outlet. Exports ask this, never the role string.
17624
+ */
17625
+ function isOutlet(type, role) {
17626
+ return type === DeviceType.Switch && role === DeviceRole.Outlet;
17627
+ }
17628
+ /**
17629
+ * A plain fan behind a switch (a `switch` with role `switch-fan`): exported as
17630
+ * a fan with the switch's on/off only — no speed it does not have.
17631
+ */
17632
+ function isSwitchFan(type, role) {
17633
+ return type === DeviceType.Switch && role === DeviceRole.SwitchFan;
17634
+ }
17635
+ /**
17578
17636
  * THE table "which boolean of this device type counts as HIGH", and the
17579
17637
  * pure evaluator of its EDGE.
17580
17638
  *
@@ -23578,7 +23636,7 @@ var DeviceTokenScopeSchema = object({
23578
23636
  function migrateLegacyTokenScope(raw) {
23579
23637
  if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
23580
23638
  if (Reflect.get(raw, "type") !== "device") return raw;
23581
- if (Reflect.get(raw, "selector") !== void 0) return raw;
23639
+ if (Reflect.get(raw, "selector") !== void 0) return canonicalSelectorTypes(raw);
23582
23640
  const targets = Reflect.get(raw, "targets");
23583
23641
  if (!Array.isArray(targets)) return raw;
23584
23642
  return {
@@ -23590,6 +23648,27 @@ function migrateLegacyTokenScope(raw) {
23590
23648
  access: Reflect.get(raw, "access")
23591
23649
  };
23592
23650
  }
23651
+ /**
23652
+ * A stored `types` selector may name a type D1033 retired (`thermostat`). The
23653
+ * grant is read back through this same preprocess, so the retired name is
23654
+ * rewritten to its canonical type here and {@link DeviceSelectorSchema} itself
23655
+ * stays a strict enum on the wire.
23656
+ */
23657
+ function canonicalSelectorTypes(raw) {
23658
+ const selector = Reflect.get(raw, "selector");
23659
+ if (selector === null || typeof selector !== "object") return raw;
23660
+ if (Reflect.get(selector, "kind") !== "types") return raw;
23661
+ const types = Reflect.get(selector, "types");
23662
+ if (!Array.isArray(types)) return raw;
23663
+ const canonical = types.map((t) => typeof t === "string" ? canonicalStoredDeviceType(t) : t);
23664
+ return {
23665
+ ...raw,
23666
+ selector: {
23667
+ ...selector,
23668
+ types: canonical
23669
+ }
23670
+ };
23671
+ }
23593
23672
  var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
23594
23673
  object({
23595
23674
  type: literal("category"),
@@ -51663,8 +51742,8 @@ function actuator(input) {
51663
51742
  };
51664
51743
  }
51665
51744
  new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
51666
- DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
51667
51745
  DeviceType.Camera;
51746
+ DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
51668
51747
  var PowerSourceRefusalReasonSchema = _enum([
51669
51748
  "no-power-source",
51670
51749
  "switch-missing",
@@ -57259,7 +57338,7 @@ var HeroSceneSchema = object({
57259
57338
  level: number$1().min(0).max(1).nullable()
57260
57339
  });
57261
57340
  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;
57262
- 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;
57341
+ 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;
57263
57342
  var HeroRowIdSchema = _enum([
57264
57343
  "progress",
57265
57344
  "run-for",
@@ -80194,8 +80273,6 @@ var AccessoryKind = {
80194
80273
  };
80195
80274
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
80196
80275
  DeviceType.HeatPump;
80197
- DeviceType.Climate;
80198
- DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
80199
80276
  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;
80200
80277
  new Set(Object.values(DeviceType));
80201
80278
  /** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
@@ -82883,7 +82960,7 @@ lookOf({
82883
82960
  });
82884
82961
  DeviceType.Climate;
82885
82962
  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;
82886
- 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;
82963
+ 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;
82887
82964
  Object.freeze({
82888
82965
  "accessories.getStatus": {
82889
82966
  capName: "accessories",
@@ -101860,10 +101937,24 @@ var BRIGHTNESS_DIRECTIVE = {
101860
101937
  needsReachableDevice: true,
101861
101938
  handle: (c) => handleSetBrightness(c.header, c.endpoint, c.payload, c.deps.brightnessController, c.identity)
101862
101939
  };
101863
- /** An outlet (D875: its source says so, e.g. HA `device_class: outlet`) is a
101864
- * smart plug; every other switch is a SWITCH. */
101940
+ /**
101941
+ * A switch's category comes from its sub-role, read only through the
101942
+ * `@camstack/types` accessors (operator decision 2026-11-12: every switch
101943
+ * sub-role is exported as its own category):
101944
+ * - an outlet (D875, e.g. HA `device_class: outlet`) is a SMARTPLUG;
101945
+ * - a relay driving a lamp (`switch-light`) is a LIGHT with power only;
101946
+ * - a plain fan behind a switch (`switch-fan`) is a FAN with power only;
101947
+ * - a plug-in heater (`switch-heater`) stays a SWITCH: Alexa has no heater
101948
+ * category with power only, and THERMOSTAT would promise a setpoint and a
101949
+ * temperature the device does not have;
101950
+ * - a helper boolean (`binary-helper`) and a role-less switch stay a SWITCH:
101951
+ * a helper is not a physical thing, SWITCH is exactly what it is.
101952
+ */
101865
101953
  function switchCategory(device) {
101866
- return device.role === DeviceRole.Outlet ? "SMARTPLUG" : "SWITCH";
101954
+ if (isSwitchLight(device.type, device.role)) return "LIGHT";
101955
+ if (isOutlet(device.type, device.role)) return "SMARTPLUG";
101956
+ if (isSwitchFan(device.type, device.role)) return "FAN";
101957
+ return "SWITCH";
101867
101958
  }
101868
101959
  //#endregion
101869
101960
  //#region src/endpoints/adapters/index.ts
@@ -103011,6 +103102,29 @@ function alarmArmModeForAlexa(armState, availableModes) {
103011
103102
  }
103012
103103
  //#endregion
103013
103104
  //#region src/endpoints/builder.ts
103105
+ /**
103106
+ * Build the Alexa Smart Home endpoint payload for a single camstack
103107
+ * device. The Discovery handler aggregates these into an
103108
+ * `Alexa.Discovery/Discover.Response`.
103109
+ *
103110
+ * Endpoint topology:
103111
+ * - Each exposed camera produces ONE parent endpoint with
103112
+ * `endpointId = String(deviceId)` carrying the streaming +
103113
+ * directive surfaces (CameraStream, RTCSession, Doorbell when the
103114
+ * camera has a doorbell, ModeController for PTZ presets when the
103115
+ * camera reports them).
103116
+ * - Each child accessory of the camera (siren / floodlight / PIR /
103117
+ * etc.) becomes a SEPARATE endpoint with
103118
+ * `endpointId = ${parentId}__${childId}` carrying PowerController +
103119
+ * BrightnessController (when applicable). The `__` separator lets
103120
+ * directive handlers decode the routing target cheaply.
103121
+ * - PTZ autotrack — when the parent camera exposes the
103122
+ * `ptz-autotrack` cap — becomes a synthetic child endpoint
103123
+ * `${parentId}__autotrack` with PowerController. We don't model it
103124
+ * as a true child device on the camstack side; the autotrack toggle
103125
+ * lives on the camera's own cap, so the Alexa endpoint id encodes
103126
+ * the routing.
103127
+ */
103014
103128
  var DEFAULT_RESOLUTIONS = [{
103015
103129
  width: 1920,
103016
103130
  height: 1080
@@ -103382,6 +103496,28 @@ function buildParentCameraEndpoint(input) {
103382
103496
  };
103383
103497
  }
103384
103498
  /**
103499
+ * Which endpoint a child switch becomes, from its type and role. A switch
103500
+ * sub-role is read only through the `@camstack/types` accessors; a heater
103501
+ * (`switch-heater`) and a helper boolean stay a plain switch for the reasons
103502
+ * written on `switchCategory` (`adapters/switch.ts`).
103503
+ */
103504
+ function classifyChildKind(deviceType, role) {
103505
+ if (role === "floodlight" || role === "spotlight" || role === "nightvision") return "light";
103506
+ if (role === "siren") return "siren";
103507
+ if (deviceType === "light" || isSwitchLight(deviceType, role)) return "light";
103508
+ if (deviceType === "siren") return "siren";
103509
+ if (isOutlet(deviceType, role)) return "outlet";
103510
+ if (isSwitchFan(deviceType, role)) return "fan";
103511
+ return "switch";
103512
+ }
103513
+ var CHILD_CATEGORY = {
103514
+ light: "LIGHT",
103515
+ switch: "SWITCH",
103516
+ siren: "SWITCH",
103517
+ outlet: "SMARTPLUG",
103518
+ fan: "FAN"
103519
+ };
103520
+ /**
103385
103521
  * Compose a child accessory's Alexa friendly name. camstack child devices
103386
103522
  * are usually already named with their parent prefix (e.g. parent
103387
103523
  * "Camera hall" → child "Camera hall Siren"), so blindly
@@ -103397,7 +103533,7 @@ function composeChildFriendlyName(parentName, childName, childDeviceId) {
103397
103533
  return `${parent} — ${child}`;
103398
103534
  }
103399
103535
  function buildChildAccessoryEndpoint(input) {
103400
- const displayCategories = input.kind === "light" ? ["LIGHT"] : ["SWITCH"];
103536
+ const displayCategories = [CHILD_CATEGORY[input.kind]];
103401
103537
  const capabilities = [ALEXA_BASE_CAPABILITY, POWER_CONTROLLER];
103402
103538
  if (input.hasBrightness) capabilities.push(BRIGHTNESS_CONTROLLER);
103403
103539
  const friendlyName = composeChildFriendlyName(input.parentName, input.childName, input.childDeviceId);
@@ -104300,13 +104436,6 @@ async function loadBoundDeviceInfo(device, api) {
104300
104436
  async function fetchPtzPresetNames(deviceId, api) {
104301
104437
  return (await api.ptz.getPresets.query({ deviceId })).filter(isAlexaRecallablePreset).map((p) => p.name).filter((n) => n.length > 0);
104302
104438
  }
104303
- function classifyChildKind(deviceType, role) {
104304
- if (role === "floodlight" || role === "spotlight" || role === "nightvision") return "light";
104305
- if (role === "siren") return "siren";
104306
- if (deviceType === "light") return "light";
104307
- if (deviceType === "siren") return "siren";
104308
- return "switch";
104309
- }
104310
104439
  function discoveryResponse(header, endpoints) {
104311
104440
  return { event: {
104312
104441
  header: {
@@ -817,7 +817,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
817
817
  return EventCategory;
818
818
  }({});
819
819
  //#endregion
820
- //#region ../types/dist/composed-stable-id-CPp3votu.mjs
820
+ //#region ../types/dist/composed-stable-id-iddnCQ51.mjs
821
821
  /**
822
822
  import { errMsg } from '@camstack/types'
823
823
  * Extract a human-readable message from an unknown error value.
@@ -1159,6 +1159,11 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1159
1159
  * with the switch's on/off only. Speed or oscillation appear only when the
1160
1160
  * device also has a fan cap (D1033). */
1161
1161
  DeviceRole["SwitchFan"] = "switch-fan";
1162
+ /** A relay driving an on/off-only lamp: drawn as a light (bulb and glow, no
1163
+ * slider), presented to the exports as a light with power only. Not a
1164
+ * `light` type: the provider owns the type, and a light implies brightness
1165
+ * or colour this relay lacks. */
1166
+ DeviceRole["SwitchLight"] = "switch-light";
1162
1167
  /** Air conditioner / split unit: cooling, fan speed, louvres. */
1163
1168
  DeviceRole["ClimateAc"] = "climate-ac";
1164
1169
  /** Room thermostat: a setpoint and a room temperature. The default. */
@@ -6059,7 +6064,7 @@ var ZodIssueCode = {
6059
6064
  var ZodFirstPartyTypeKind;
6060
6065
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6061
6066
  //#endregion
6062
- //#region ../types/dist/sleep-DyIxjZZt.mjs
6067
+ //#region ../types/dist/sleep-BvVGLl30.mjs
6063
6068
  /**
6064
6069
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6065
6070
  * window to float samples (D455).
@@ -10772,6 +10777,13 @@ var ACTUATOR_CAP_VOCABULARY = {
10772
10777
  },
10773
10778
  state: { on: { icon: "lightbulb" } }
10774
10779
  },
10780
+ [DeviceRole.SwitchLight]: {
10781
+ actions: {
10782
+ "switch.on": { icon: "lightbulb" },
10783
+ "switch.off": { icon: "lightbulb-off" }
10784
+ },
10785
+ state: { on: { icon: "lightbulb" } }
10786
+ },
10775
10787
  [DeviceRole.Chime]: { actions: {
10776
10788
  "switch.on": {
10777
10789
  label: t("Enable chime", "Attiva il campanello"),
@@ -17492,7 +17504,7 @@ Object.freeze({
17492
17504
  }
17493
17505
  });
17494
17506
  //#endregion
17495
- //#region ../types/dist/implemented-methods-5YMDeE3f.mjs
17507
+ //#region ../types/dist/implemented-methods-CSTk6zYK.mjs
17496
17508
  /**
17497
17509
  * The ffmpeg build every CamStack node downloads, per platform and arch.
17498
17510
  *
@@ -17546,6 +17558,52 @@ function portable(target) {
17546
17558
  }
17547
17559
  portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac64"), `${BASE$1}${FFMPEG_RELEASE}`;
17548
17560
  /**
17561
+ * A device's KIND is its type plus its role (D1033): the type is the set of
17562
+ * controls it has, the role says which thing it is among the devices that
17563
+ * share those controls. A plug-in heater is a `switch` with role
17564
+ * `switch-heater`; an air conditioner and a radiator valve are both `climate`,
17565
+ * told apart by their `climate-*` role.
17566
+ */
17567
+ /**
17568
+ * Type values a persisted row may still carry after the type was retired, and
17569
+ * the type each one is read as. The row is rewritten by the next registration
17570
+ * of the device (its provider stamps the live type), so this is a read alias,
17571
+ * not a migration.
17572
+ *
17573
+ * `heater` is deliberately absent: the only heaters were composed devices the
17574
+ * operator deletes. Such a row stays an unknown type, which every reader
17575
+ * treats as a generic device.
17576
+ */
17577
+ var RETIRED_DEVICE_TYPES = { thermostat: DeviceType.Climate };
17578
+ /** The live type a stored `type` value stands for (itself unless retired). */
17579
+ function canonicalStoredDeviceType(stored) {
17580
+ return RETIRED_DEVICE_TYPES[stored] ?? stored;
17581
+ }
17582
+ preprocess((value) => typeof value === "string" ? canonicalStoredDeviceType(value) : value, _enum(DeviceType));
17583
+ DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
17584
+ /**
17585
+ * A relay driving an on/off-only lamp (a `switch` with role `switch-light`):
17586
+ * drawn and exported as a light, with the switch's power only. The one place
17587
+ * that reads the role for it — a consumer asks this, never the role string.
17588
+ */
17589
+ function isSwitchLight(type, role) {
17590
+ return type === DeviceType.Switch && role === DeviceRole.SwitchLight;
17591
+ }
17592
+ /**
17593
+ * A smart plug (a `switch` with role `outlet`, D875): exported as a plug /
17594
+ * outlet. Exports ask this, never the role string.
17595
+ */
17596
+ function isOutlet(type, role) {
17597
+ return type === DeviceType.Switch && role === DeviceRole.Outlet;
17598
+ }
17599
+ /**
17600
+ * A plain fan behind a switch (a `switch` with role `switch-fan`): exported as
17601
+ * a fan with the switch's on/off only — no speed it does not have.
17602
+ */
17603
+ function isSwitchFan(type, role) {
17604
+ return type === DeviceType.Switch && role === DeviceRole.SwitchFan;
17605
+ }
17606
+ /**
17549
17607
  * THE table "which boolean of this device type counts as HIGH", and the
17550
17608
  * pure evaluator of its EDGE.
17551
17609
  *
@@ -23549,7 +23607,7 @@ var DeviceTokenScopeSchema = object({
23549
23607
  function migrateLegacyTokenScope(raw) {
23550
23608
  if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
23551
23609
  if (Reflect.get(raw, "type") !== "device") return raw;
23552
- if (Reflect.get(raw, "selector") !== void 0) return raw;
23610
+ if (Reflect.get(raw, "selector") !== void 0) return canonicalSelectorTypes(raw);
23553
23611
  const targets = Reflect.get(raw, "targets");
23554
23612
  if (!Array.isArray(targets)) return raw;
23555
23613
  return {
@@ -23561,6 +23619,27 @@ function migrateLegacyTokenScope(raw) {
23561
23619
  access: Reflect.get(raw, "access")
23562
23620
  };
23563
23621
  }
23622
+ /**
23623
+ * A stored `types` selector may name a type D1033 retired (`thermostat`). The
23624
+ * grant is read back through this same preprocess, so the retired name is
23625
+ * rewritten to its canonical type here and {@link DeviceSelectorSchema} itself
23626
+ * stays a strict enum on the wire.
23627
+ */
23628
+ function canonicalSelectorTypes(raw) {
23629
+ const selector = Reflect.get(raw, "selector");
23630
+ if (selector === null || typeof selector !== "object") return raw;
23631
+ if (Reflect.get(selector, "kind") !== "types") return raw;
23632
+ const types = Reflect.get(selector, "types");
23633
+ if (!Array.isArray(types)) return raw;
23634
+ const canonical = types.map((t) => typeof t === "string" ? canonicalStoredDeviceType(t) : t);
23635
+ return {
23636
+ ...raw,
23637
+ selector: {
23638
+ ...selector,
23639
+ types: canonical
23640
+ }
23641
+ };
23642
+ }
23564
23643
  var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
23565
23644
  object({
23566
23645
  type: literal("category"),
@@ -51634,8 +51713,8 @@ function actuator(input) {
51634
51713
  };
51635
51714
  }
51636
51715
  new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
51637
- DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
51638
51716
  DeviceType.Camera;
51717
+ DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
51639
51718
  var PowerSourceRefusalReasonSchema = _enum([
51640
51719
  "no-power-source",
51641
51720
  "switch-missing",
@@ -57230,7 +57309,7 @@ var HeroSceneSchema = object({
57230
57309
  level: number$1().min(0).max(1).nullable()
57231
57310
  });
57232
57311
  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;
57233
- 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;
57312
+ 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;
57234
57313
  var HeroRowIdSchema = _enum([
57235
57314
  "progress",
57236
57315
  "run-for",
@@ -80165,8 +80244,6 @@ var AccessoryKind = {
80165
80244
  };
80166
80245
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
80167
80246
  DeviceType.HeatPump;
80168
- DeviceType.Climate;
80169
- DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
80170
80247
  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;
80171
80248
  new Set(Object.values(DeviceType));
80172
80249
  /** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
@@ -82854,7 +82931,7 @@ lookOf({
82854
82931
  });
82855
82932
  DeviceType.Climate;
82856
82933
  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;
82857
- 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;
82934
+ 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;
82858
82935
  Object.freeze({
82859
82936
  "accessories.getStatus": {
82860
82937
  capName: "accessories",
@@ -101831,10 +101908,24 @@ var BRIGHTNESS_DIRECTIVE = {
101831
101908
  needsReachableDevice: true,
101832
101909
  handle: (c) => handleSetBrightness(c.header, c.endpoint, c.payload, c.deps.brightnessController, c.identity)
101833
101910
  };
101834
- /** An outlet (D875: its source says so, e.g. HA `device_class: outlet`) is a
101835
- * smart plug; every other switch is a SWITCH. */
101911
+ /**
101912
+ * A switch's category comes from its sub-role, read only through the
101913
+ * `@camstack/types` accessors (operator decision 2026-11-12: every switch
101914
+ * sub-role is exported as its own category):
101915
+ * - an outlet (D875, e.g. HA `device_class: outlet`) is a SMARTPLUG;
101916
+ * - a relay driving a lamp (`switch-light`) is a LIGHT with power only;
101917
+ * - a plain fan behind a switch (`switch-fan`) is a FAN with power only;
101918
+ * - a plug-in heater (`switch-heater`) stays a SWITCH: Alexa has no heater
101919
+ * category with power only, and THERMOSTAT would promise a setpoint and a
101920
+ * temperature the device does not have;
101921
+ * - a helper boolean (`binary-helper`) and a role-less switch stay a SWITCH:
101922
+ * a helper is not a physical thing, SWITCH is exactly what it is.
101923
+ */
101836
101924
  function switchCategory(device) {
101837
- return device.role === DeviceRole.Outlet ? "SMARTPLUG" : "SWITCH";
101925
+ if (isSwitchLight(device.type, device.role)) return "LIGHT";
101926
+ if (isOutlet(device.type, device.role)) return "SMARTPLUG";
101927
+ if (isSwitchFan(device.type, device.role)) return "FAN";
101928
+ return "SWITCH";
101838
101929
  }
101839
101930
  //#endregion
101840
101931
  //#region src/endpoints/adapters/index.ts
@@ -102982,6 +103073,29 @@ function alarmArmModeForAlexa(armState, availableModes) {
102982
103073
  }
102983
103074
  //#endregion
102984
103075
  //#region src/endpoints/builder.ts
103076
+ /**
103077
+ * Build the Alexa Smart Home endpoint payload for a single camstack
103078
+ * device. The Discovery handler aggregates these into an
103079
+ * `Alexa.Discovery/Discover.Response`.
103080
+ *
103081
+ * Endpoint topology:
103082
+ * - Each exposed camera produces ONE parent endpoint with
103083
+ * `endpointId = String(deviceId)` carrying the streaming +
103084
+ * directive surfaces (CameraStream, RTCSession, Doorbell when the
103085
+ * camera has a doorbell, ModeController for PTZ presets when the
103086
+ * camera reports them).
103087
+ * - Each child accessory of the camera (siren / floodlight / PIR /
103088
+ * etc.) becomes a SEPARATE endpoint with
103089
+ * `endpointId = ${parentId}__${childId}` carrying PowerController +
103090
+ * BrightnessController (when applicable). The `__` separator lets
103091
+ * directive handlers decode the routing target cheaply.
103092
+ * - PTZ autotrack — when the parent camera exposes the
103093
+ * `ptz-autotrack` cap — becomes a synthetic child endpoint
103094
+ * `${parentId}__autotrack` with PowerController. We don't model it
103095
+ * as a true child device on the camstack side; the autotrack toggle
103096
+ * lives on the camera's own cap, so the Alexa endpoint id encodes
103097
+ * the routing.
103098
+ */
102985
103099
  var DEFAULT_RESOLUTIONS = [{
102986
103100
  width: 1920,
102987
103101
  height: 1080
@@ -103353,6 +103467,28 @@ function buildParentCameraEndpoint(input) {
103353
103467
  };
103354
103468
  }
103355
103469
  /**
103470
+ * Which endpoint a child switch becomes, from its type and role. A switch
103471
+ * sub-role is read only through the `@camstack/types` accessors; a heater
103472
+ * (`switch-heater`) and a helper boolean stay a plain switch for the reasons
103473
+ * written on `switchCategory` (`adapters/switch.ts`).
103474
+ */
103475
+ function classifyChildKind(deviceType, role) {
103476
+ if (role === "floodlight" || role === "spotlight" || role === "nightvision") return "light";
103477
+ if (role === "siren") return "siren";
103478
+ if (deviceType === "light" || isSwitchLight(deviceType, role)) return "light";
103479
+ if (deviceType === "siren") return "siren";
103480
+ if (isOutlet(deviceType, role)) return "outlet";
103481
+ if (isSwitchFan(deviceType, role)) return "fan";
103482
+ return "switch";
103483
+ }
103484
+ var CHILD_CATEGORY = {
103485
+ light: "LIGHT",
103486
+ switch: "SWITCH",
103487
+ siren: "SWITCH",
103488
+ outlet: "SMARTPLUG",
103489
+ fan: "FAN"
103490
+ };
103491
+ /**
103356
103492
  * Compose a child accessory's Alexa friendly name. camstack child devices
103357
103493
  * are usually already named with their parent prefix (e.g. parent
103358
103494
  * "Camera hall" → child "Camera hall Siren"), so blindly
@@ -103368,7 +103504,7 @@ function composeChildFriendlyName(parentName, childName, childDeviceId) {
103368
103504
  return `${parent} — ${child}`;
103369
103505
  }
103370
103506
  function buildChildAccessoryEndpoint(input) {
103371
- const displayCategories = input.kind === "light" ? ["LIGHT"] : ["SWITCH"];
103507
+ const displayCategories = [CHILD_CATEGORY[input.kind]];
103372
103508
  const capabilities = [ALEXA_BASE_CAPABILITY, POWER_CONTROLLER];
103373
103509
  if (input.hasBrightness) capabilities.push(BRIGHTNESS_CONTROLLER);
103374
103510
  const friendlyName = composeChildFriendlyName(input.parentName, input.childName, input.childDeviceId);
@@ -104271,13 +104407,6 @@ async function loadBoundDeviceInfo(device, api) {
104271
104407
  async function fetchPtzPresetNames(deviceId, api) {
104272
104408
  return (await api.ptz.getPresets.query({ deviceId })).filter(isAlexaRecallablePreset).map((p) => p.name).filter((n) => n.length > 0);
104273
104409
  }
104274
- function classifyChildKind(deviceType, role) {
104275
- if (role === "floodlight" || role === "spotlight" || role === "nightvision") return "light";
104276
- if (role === "siren") return "siren";
104277
- if (deviceType === "light") return "light";
104278
- if (deviceType === "siren") return "siren";
104279
- return "switch";
104280
- }
104281
104410
  function discoveryResponse(header, endpoints) {
104282
104411
  return { event: {
104283
104412
  header: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-alexa",
3
- "version": "1.2.196",
3
+ "version": "1.2.197",
4
4
  "description": "Alexa Smart Home Skill export — hub-side OAuth provider + directive handler. The companion AWS Lambda forwards Alexa directives to this addon's /addon/export-alexa/directive endpoint.",
5
5
  "keywords": [
6
6
  "camstack",
@@ -59,7 +59,7 @@
59
59
  }
60
60
  ],
61
61
  "requires": {
62
- "server": ">=1.2.850"
62
+ "server": ">=1.2.852"
63
63
  }
64
64
  },
65
65
  "files": [