@camstack/addon-export-google 0.1.133 → 0.1.134

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,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.134] - 2026-11-13
11
+
12
+ ### Changed
13
+
14
+ - A switch is exported by its sub-role: outlet as OUTLET, switch-light as LIGHT, switch-fan as FAN, switch-heater as HEATER (on/off only).
15
+
10
16
  ## [0.1.133] - 2026-11-12
11
17
 
12
18
  ### Changed
@@ -69,6 +69,7 @@ function createApiDeviceGateway(deps) {
69
69
  deviceId: device.id,
70
70
  name: device.name,
71
71
  deviceType: device.type,
72
+ role: device.role ?? null,
72
73
  features: device.features,
73
74
  capNames: entries.map((entry) => entry.capName)
74
75
  };
@@ -890,7 +891,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
890
891
  return EventCategory;
891
892
  }({});
892
893
  //#endregion
893
- //#region ../types/dist/composed-stable-id-CPp3votu.mjs
894
+ //#region ../types/dist/composed-stable-id-iddnCQ51.mjs
894
895
  /**
895
896
  import { errMsg } from '@camstack/types'
896
897
  * Extract a human-readable message from an unknown error value.
@@ -1232,6 +1233,11 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1232
1233
  * with the switch's on/off only. Speed or oscillation appear only when the
1233
1234
  * device also has a fan cap (D1033). */
1234
1235
  DeviceRole["SwitchFan"] = "switch-fan";
1236
+ /** A relay driving an on/off-only lamp: drawn as a light (bulb and glow, no
1237
+ * slider), presented to the exports as a light with power only. Not a
1238
+ * `light` type: the provider owns the type, and a light implies brightness
1239
+ * or colour this relay lacks. */
1240
+ DeviceRole["SwitchLight"] = "switch-light";
1235
1241
  /** Air conditioner / split unit: cooling, fan speed, louvres. */
1236
1242
  DeviceRole["ClimateAc"] = "climate-ac";
1237
1243
  /** Room thermostat: a setpoint and a room temperature. The default. */
@@ -6132,7 +6138,7 @@ var ZodIssueCode = {
6132
6138
  var ZodFirstPartyTypeKind;
6133
6139
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6134
6140
  //#endregion
6135
- //#region ../types/dist/sleep-DyIxjZZt.mjs
6141
+ //#region ../types/dist/sleep-BvVGLl30.mjs
6136
6142
  /**
6137
6143
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6138
6144
  * window to float samples (D455).
@@ -10845,6 +10851,13 @@ var ACTUATOR_CAP_VOCABULARY = {
10845
10851
  },
10846
10852
  state: { on: { icon: "lightbulb" } }
10847
10853
  },
10854
+ [DeviceRole.SwitchLight]: {
10855
+ actions: {
10856
+ "switch.on": { icon: "lightbulb" },
10857
+ "switch.off": { icon: "lightbulb-off" }
10858
+ },
10859
+ state: { on: { icon: "lightbulb" } }
10860
+ },
10848
10861
  [DeviceRole.Chime]: { actions: {
10849
10862
  "switch.on": {
10850
10863
  label: t("Enable chime", "Attiva il campanello"),
@@ -17543,7 +17556,7 @@ Object.freeze({
17543
17556
  }
17544
17557
  });
17545
17558
  //#endregion
17546
- //#region ../types/dist/implemented-methods-5YMDeE3f.mjs
17559
+ //#region ../types/dist/implemented-methods-CSTk6zYK.mjs
17547
17560
  /**
17548
17561
  * The ffmpeg build every CamStack node downloads, per platform and arch.
17549
17562
  *
@@ -17597,6 +17610,60 @@ function portable(target) {
17597
17610
  }
17598
17611
  portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac64"), `${BASE}${FFMPEG_RELEASE}`;
17599
17612
  /**
17613
+ * A device's KIND is its type plus its role (D1033): the type is the set of
17614
+ * controls it has, the role says which thing it is among the devices that
17615
+ * share those controls. A plug-in heater is a `switch` with role
17616
+ * `switch-heater`; an air conditioner and a radiator valve are both `climate`,
17617
+ * told apart by their `climate-*` role.
17618
+ */
17619
+ /**
17620
+ * Type values a persisted row may still carry after the type was retired, and
17621
+ * the type each one is read as. The row is rewritten by the next registration
17622
+ * of the device (its provider stamps the live type), so this is a read alias,
17623
+ * not a migration.
17624
+ *
17625
+ * `heater` is deliberately absent: the only heaters were composed devices the
17626
+ * operator deletes. Such a row stays an unknown type, which every reader
17627
+ * treats as a generic device.
17628
+ */
17629
+ var RETIRED_DEVICE_TYPES = { thermostat: DeviceType.Climate };
17630
+ /** The live type a stored `type` value stands for (itself unless retired). */
17631
+ function canonicalStoredDeviceType(stored) {
17632
+ return RETIRED_DEVICE_TYPES[stored] ?? stored;
17633
+ }
17634
+ preprocess((value) => typeof value === "string" ? canonicalStoredDeviceType(value) : value, _enum(DeviceType));
17635
+ DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
17636
+ /**
17637
+ * A relay driving an on/off-only lamp (a `switch` with role `switch-light`):
17638
+ * drawn and exported as a light, with the switch's power only. The one place
17639
+ * that reads the role for it — a consumer asks this, never the role string.
17640
+ */
17641
+ function isSwitchLight(type, role) {
17642
+ return type === DeviceType.Switch && role === DeviceRole.SwitchLight;
17643
+ }
17644
+ /**
17645
+ * A smart plug (a `switch` with role `outlet`, D875): exported as a plug /
17646
+ * outlet. Exports ask this, never the role string.
17647
+ */
17648
+ function isOutlet(type, role) {
17649
+ return type === DeviceType.Switch && role === DeviceRole.Outlet;
17650
+ }
17651
+ /**
17652
+ * A plain fan behind a switch (a `switch` with role `switch-fan`): exported as
17653
+ * a fan with the switch's on/off only — no speed it does not have.
17654
+ */
17655
+ function isSwitchFan(type, role) {
17656
+ return type === DeviceType.Switch && role === DeviceRole.SwitchFan;
17657
+ }
17658
+ /**
17659
+ * A plug-in heater behind a switch (a `switch` with role `switch-heater`): it
17660
+ * has power only, no setpoint and no room temperature, so an export never
17661
+ * presents it as a thermostat.
17662
+ */
17663
+ function isSwitchHeater(type, role) {
17664
+ return type === DeviceType.Switch && role === DeviceRole.SwitchHeater;
17665
+ }
17666
+ /**
17600
17667
  * THE table "which boolean of this device type counts as HIGH", and the
17601
17668
  * pure evaluator of its EDGE.
17602
17669
  *
@@ -23425,7 +23492,7 @@ var DeviceTokenScopeSchema = object({
23425
23492
  function migrateLegacyTokenScope(raw) {
23426
23493
  if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
23427
23494
  if (Reflect.get(raw, "type") !== "device") return raw;
23428
- if (Reflect.get(raw, "selector") !== void 0) return raw;
23495
+ if (Reflect.get(raw, "selector") !== void 0) return canonicalSelectorTypes(raw);
23429
23496
  const targets = Reflect.get(raw, "targets");
23430
23497
  if (!Array.isArray(targets)) return raw;
23431
23498
  return {
@@ -23437,6 +23504,27 @@ function migrateLegacyTokenScope(raw) {
23437
23504
  access: Reflect.get(raw, "access")
23438
23505
  };
23439
23506
  }
23507
+ /**
23508
+ * A stored `types` selector may name a type D1033 retired (`thermostat`). The
23509
+ * grant is read back through this same preprocess, so the retired name is
23510
+ * rewritten to its canonical type here and {@link DeviceSelectorSchema} itself
23511
+ * stays a strict enum on the wire.
23512
+ */
23513
+ function canonicalSelectorTypes(raw) {
23514
+ const selector = Reflect.get(raw, "selector");
23515
+ if (selector === null || typeof selector !== "object") return raw;
23516
+ if (Reflect.get(selector, "kind") !== "types") return raw;
23517
+ const types = Reflect.get(selector, "types");
23518
+ if (!Array.isArray(types)) return raw;
23519
+ const canonical = types.map((t) => typeof t === "string" ? canonicalStoredDeviceType(t) : t);
23520
+ return {
23521
+ ...raw,
23522
+ selector: {
23523
+ ...selector,
23524
+ types: canonical
23525
+ }
23526
+ };
23527
+ }
23440
23528
  var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
23441
23529
  object({
23442
23530
  type: literal("category"),
@@ -51515,8 +51603,8 @@ function actuator(input) {
51515
51603
  };
51516
51604
  }
51517
51605
  new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
51518
- DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
51519
51606
  DeviceType.Camera;
51607
+ DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
51520
51608
  var PowerSourceRefusalReasonSchema = _enum([
51521
51609
  "no-power-source",
51522
51610
  "switch-missing",
@@ -57111,7 +57199,7 @@ var HeroSceneSchema = object({
57111
57199
  level: number$1().min(0).max(1).nullable()
57112
57200
  });
57113
57201
  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;
57114
- 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;
57202
+ 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;
57115
57203
  var HeroRowIdSchema = _enum([
57116
57204
  "progress",
57117
57205
  "run-for",
@@ -80046,8 +80134,6 @@ var AccessoryKind = {
80046
80134
  };
80047
80135
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
80048
80136
  DeviceType.HeatPump;
80049
- DeviceType.Climate;
80050
- DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
80051
80137
  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;
80052
80138
  new Set(Object.values(DeviceType));
80053
80139
  /** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
@@ -82735,7 +82821,7 @@ lookOf({
82735
82821
  });
82736
82822
  DeviceType.Climate;
82737
82823
  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;
82738
- 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;
82824
+ 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;
82739
82825
  Object.freeze({
82740
82826
  "accessories.getStatus": {
82741
82827
  capName: "accessories",
@@ -98374,20 +98460,33 @@ var MANUFACTURER = "CamStack";
98374
98460
  *
98375
98461
  * - a lock is a LOCK and a cover is a SHUTTER regardless of anything else —
98376
98462
  * the trait fully determines the affordance Google renders;
98377
- * - otherwise the device is an on/off actuator, and only then does
98378
- * `DeviceType` choose between LIGHT and SWITCH.
98463
+ * - otherwise the device is an on/off actuator, and only then do
98464
+ * `DeviceType` and the switch's sub-role choose its type (operator decision
98465
+ * 2026-11-12: every switch sub-role is exported as its own type, OnOff only).
98466
+ * The role is read only through the `@camstack/types` accessors:
98467
+ * an outlet is an OUTLET, a `switch-light` relay a LIGHT, a `switch-fan` a
98468
+ * FAN, a `switch-heater` a HEATER (Google requires no trait of a heater, so
98469
+ * OnOff alone is honest — no TemperatureSetting is declared). A helper
98470
+ * boolean (`binary-helper`) stays a SWITCH: it is not a physical thing.
98379
98471
  *
98380
98472
  * `Siren` deliberately lands on SWITCH: Google has no siren type, and SWITCH
98381
98473
  * is the only type whose single trait (OnOff) the device actually implements.
98382
98474
  * A SECURITYSYSTEM would promise `ArmDisarm`, which nothing here answers.
98383
98475
  */
98384
- function resolveGoogleDeviceType(deviceType, traits) {
98476
+ function resolveGoogleDeviceType(deviceType, traits, role) {
98385
98477
  const withheld = applianceExport("google", deviceType);
98386
98478
  if (withheld !== null && !withheld.exported) return null;
98387
98479
  if (traits.includes("action.devices.traits.LockUnlock")) return "action.devices.types.LOCK";
98388
98480
  if (traits.includes("action.devices.traits.OpenClose")) return "action.devices.types.SHUTTER";
98389
98481
  if (!traits.includes("action.devices.traits.OnOff") && !traits.includes("action.devices.traits.Brightness")) return null;
98390
98482
  if (deviceType === DeviceType.Light) return "action.devices.types.LIGHT";
98483
+ return switchSubRoleType(deviceType, role);
98484
+ }
98485
+ function switchSubRoleType(deviceType, role) {
98486
+ if (isSwitchLight(deviceType, role)) return "action.devices.types.LIGHT";
98487
+ if (isOutlet(deviceType, role)) return "action.devices.types.OUTLET";
98488
+ if (isSwitchFan(deviceType, role)) return "action.devices.types.FAN";
98489
+ if (isSwitchHeater(deviceType, role)) return "action.devices.types.HEATER";
98391
98490
  return "action.devices.types.SWITCH";
98392
98491
  }
98393
98492
  /**
@@ -98404,7 +98503,7 @@ function buildSyncDevice(facts) {
98404
98503
  const descriptors = traitsForCaps(facts.capNames);
98405
98504
  if (descriptors.length === 0) return null;
98406
98505
  const traits = descriptors.map((d) => d.trait);
98407
- const type = resolveGoogleDeviceType(facts.deviceType, traits);
98506
+ const type = resolveGoogleDeviceType(facts.deviceType, traits, facts.role);
98408
98507
  if (type === null) return null;
98409
98508
  const attributes = {};
98410
98509
  for (const descriptor of descriptors) Object.assign(attributes, descriptor.attributes(facts.features));
@@ -65,6 +65,7 @@ function createApiDeviceGateway(deps) {
65
65
  deviceId: device.id,
66
66
  name: device.name,
67
67
  deviceType: device.type,
68
+ role: device.role ?? null,
68
69
  features: device.features,
69
70
  capNames: entries.map((entry) => entry.capName)
70
71
  };
@@ -886,7 +887,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
886
887
  return EventCategory;
887
888
  }({});
888
889
  //#endregion
889
- //#region ../types/dist/composed-stable-id-CPp3votu.mjs
890
+ //#region ../types/dist/composed-stable-id-iddnCQ51.mjs
890
891
  /**
891
892
  import { errMsg } from '@camstack/types'
892
893
  * Extract a human-readable message from an unknown error value.
@@ -1228,6 +1229,11 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1228
1229
  * with the switch's on/off only. Speed or oscillation appear only when the
1229
1230
  * device also has a fan cap (D1033). */
1230
1231
  DeviceRole["SwitchFan"] = "switch-fan";
1232
+ /** A relay driving an on/off-only lamp: drawn as a light (bulb and glow, no
1233
+ * slider), presented to the exports as a light with power only. Not a
1234
+ * `light` type: the provider owns the type, and a light implies brightness
1235
+ * or colour this relay lacks. */
1236
+ DeviceRole["SwitchLight"] = "switch-light";
1231
1237
  /** Air conditioner / split unit: cooling, fan speed, louvres. */
1232
1238
  DeviceRole["ClimateAc"] = "climate-ac";
1233
1239
  /** Room thermostat: a setpoint and a room temperature. The default. */
@@ -6128,7 +6134,7 @@ var ZodIssueCode = {
6128
6134
  var ZodFirstPartyTypeKind;
6129
6135
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6130
6136
  //#endregion
6131
- //#region ../types/dist/sleep-DyIxjZZt.mjs
6137
+ //#region ../types/dist/sleep-BvVGLl30.mjs
6132
6138
  /**
6133
6139
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6134
6140
  * window to float samples (D455).
@@ -10841,6 +10847,13 @@ var ACTUATOR_CAP_VOCABULARY = {
10841
10847
  },
10842
10848
  state: { on: { icon: "lightbulb" } }
10843
10849
  },
10850
+ [DeviceRole.SwitchLight]: {
10851
+ actions: {
10852
+ "switch.on": { icon: "lightbulb" },
10853
+ "switch.off": { icon: "lightbulb-off" }
10854
+ },
10855
+ state: { on: { icon: "lightbulb" } }
10856
+ },
10844
10857
  [DeviceRole.Chime]: { actions: {
10845
10858
  "switch.on": {
10846
10859
  label: t("Enable chime", "Attiva il campanello"),
@@ -17539,7 +17552,7 @@ Object.freeze({
17539
17552
  }
17540
17553
  });
17541
17554
  //#endregion
17542
- //#region ../types/dist/implemented-methods-5YMDeE3f.mjs
17555
+ //#region ../types/dist/implemented-methods-CSTk6zYK.mjs
17543
17556
  /**
17544
17557
  * The ffmpeg build every CamStack node downloads, per platform and arch.
17545
17558
  *
@@ -17593,6 +17606,60 @@ function portable(target) {
17593
17606
  }
17594
17607
  portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac64"), `${BASE}${FFMPEG_RELEASE}`;
17595
17608
  /**
17609
+ * A device's KIND is its type plus its role (D1033): the type is the set of
17610
+ * controls it has, the role says which thing it is among the devices that
17611
+ * share those controls. A plug-in heater is a `switch` with role
17612
+ * `switch-heater`; an air conditioner and a radiator valve are both `climate`,
17613
+ * told apart by their `climate-*` role.
17614
+ */
17615
+ /**
17616
+ * Type values a persisted row may still carry after the type was retired, and
17617
+ * the type each one is read as. The row is rewritten by the next registration
17618
+ * of the device (its provider stamps the live type), so this is a read alias,
17619
+ * not a migration.
17620
+ *
17621
+ * `heater` is deliberately absent: the only heaters were composed devices the
17622
+ * operator deletes. Such a row stays an unknown type, which every reader
17623
+ * treats as a generic device.
17624
+ */
17625
+ var RETIRED_DEVICE_TYPES = { thermostat: DeviceType.Climate };
17626
+ /** The live type a stored `type` value stands for (itself unless retired). */
17627
+ function canonicalStoredDeviceType(stored) {
17628
+ return RETIRED_DEVICE_TYPES[stored] ?? stored;
17629
+ }
17630
+ preprocess((value) => typeof value === "string" ? canonicalStoredDeviceType(value) : value, _enum(DeviceType));
17631
+ DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
17632
+ /**
17633
+ * A relay driving an on/off-only lamp (a `switch` with role `switch-light`):
17634
+ * drawn and exported as a light, with the switch's power only. The one place
17635
+ * that reads the role for it — a consumer asks this, never the role string.
17636
+ */
17637
+ function isSwitchLight(type, role) {
17638
+ return type === DeviceType.Switch && role === DeviceRole.SwitchLight;
17639
+ }
17640
+ /**
17641
+ * A smart plug (a `switch` with role `outlet`, D875): exported as a plug /
17642
+ * outlet. Exports ask this, never the role string.
17643
+ */
17644
+ function isOutlet(type, role) {
17645
+ return type === DeviceType.Switch && role === DeviceRole.Outlet;
17646
+ }
17647
+ /**
17648
+ * A plain fan behind a switch (a `switch` with role `switch-fan`): exported as
17649
+ * a fan with the switch's on/off only — no speed it does not have.
17650
+ */
17651
+ function isSwitchFan(type, role) {
17652
+ return type === DeviceType.Switch && role === DeviceRole.SwitchFan;
17653
+ }
17654
+ /**
17655
+ * A plug-in heater behind a switch (a `switch` with role `switch-heater`): it
17656
+ * has power only, no setpoint and no room temperature, so an export never
17657
+ * presents it as a thermostat.
17658
+ */
17659
+ function isSwitchHeater(type, role) {
17660
+ return type === DeviceType.Switch && role === DeviceRole.SwitchHeater;
17661
+ }
17662
+ /**
17596
17663
  * THE table "which boolean of this device type counts as HIGH", and the
17597
17664
  * pure evaluator of its EDGE.
17598
17665
  *
@@ -23421,7 +23488,7 @@ var DeviceTokenScopeSchema = object({
23421
23488
  function migrateLegacyTokenScope(raw) {
23422
23489
  if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
23423
23490
  if (Reflect.get(raw, "type") !== "device") return raw;
23424
- if (Reflect.get(raw, "selector") !== void 0) return raw;
23491
+ if (Reflect.get(raw, "selector") !== void 0) return canonicalSelectorTypes(raw);
23425
23492
  const targets = Reflect.get(raw, "targets");
23426
23493
  if (!Array.isArray(targets)) return raw;
23427
23494
  return {
@@ -23433,6 +23500,27 @@ function migrateLegacyTokenScope(raw) {
23433
23500
  access: Reflect.get(raw, "access")
23434
23501
  };
23435
23502
  }
23503
+ /**
23504
+ * A stored `types` selector may name a type D1033 retired (`thermostat`). The
23505
+ * grant is read back through this same preprocess, so the retired name is
23506
+ * rewritten to its canonical type here and {@link DeviceSelectorSchema} itself
23507
+ * stays a strict enum on the wire.
23508
+ */
23509
+ function canonicalSelectorTypes(raw) {
23510
+ const selector = Reflect.get(raw, "selector");
23511
+ if (selector === null || typeof selector !== "object") return raw;
23512
+ if (Reflect.get(selector, "kind") !== "types") return raw;
23513
+ const types = Reflect.get(selector, "types");
23514
+ if (!Array.isArray(types)) return raw;
23515
+ const canonical = types.map((t) => typeof t === "string" ? canonicalStoredDeviceType(t) : t);
23516
+ return {
23517
+ ...raw,
23518
+ selector: {
23519
+ ...selector,
23520
+ types: canonical
23521
+ }
23522
+ };
23523
+ }
23436
23524
  var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
23437
23525
  object({
23438
23526
  type: literal("category"),
@@ -51511,8 +51599,8 @@ function actuator(input) {
51511
51599
  };
51512
51600
  }
51513
51601
  new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
51514
- DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
51515
51602
  DeviceType.Camera;
51603
+ DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
51516
51604
  var PowerSourceRefusalReasonSchema = _enum([
51517
51605
  "no-power-source",
51518
51606
  "switch-missing",
@@ -57107,7 +57195,7 @@ var HeroSceneSchema = object({
57107
57195
  level: number$1().min(0).max(1).nullable()
57108
57196
  });
57109
57197
  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;
57110
- 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;
57198
+ 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;
57111
57199
  var HeroRowIdSchema = _enum([
57112
57200
  "progress",
57113
57201
  "run-for",
@@ -80042,8 +80130,6 @@ var AccessoryKind = {
80042
80130
  };
80043
80131
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
80044
80132
  DeviceType.HeatPump;
80045
- DeviceType.Climate;
80046
- DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
80047
80133
  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;
80048
80134
  new Set(Object.values(DeviceType));
80049
80135
  /** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
@@ -82731,7 +82817,7 @@ lookOf({
82731
82817
  });
82732
82818
  DeviceType.Climate;
82733
82819
  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;
82734
- 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;
82820
+ 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;
82735
82821
  Object.freeze({
82736
82822
  "accessories.getStatus": {
82737
82823
  capName: "accessories",
@@ -98370,20 +98456,33 @@ var MANUFACTURER = "CamStack";
98370
98456
  *
98371
98457
  * - a lock is a LOCK and a cover is a SHUTTER regardless of anything else —
98372
98458
  * the trait fully determines the affordance Google renders;
98373
- * - otherwise the device is an on/off actuator, and only then does
98374
- * `DeviceType` choose between LIGHT and SWITCH.
98459
+ * - otherwise the device is an on/off actuator, and only then do
98460
+ * `DeviceType` and the switch's sub-role choose its type (operator decision
98461
+ * 2026-11-12: every switch sub-role is exported as its own type, OnOff only).
98462
+ * The role is read only through the `@camstack/types` accessors:
98463
+ * an outlet is an OUTLET, a `switch-light` relay a LIGHT, a `switch-fan` a
98464
+ * FAN, a `switch-heater` a HEATER (Google requires no trait of a heater, so
98465
+ * OnOff alone is honest — no TemperatureSetting is declared). A helper
98466
+ * boolean (`binary-helper`) stays a SWITCH: it is not a physical thing.
98375
98467
  *
98376
98468
  * `Siren` deliberately lands on SWITCH: Google has no siren type, and SWITCH
98377
98469
  * is the only type whose single trait (OnOff) the device actually implements.
98378
98470
  * A SECURITYSYSTEM would promise `ArmDisarm`, which nothing here answers.
98379
98471
  */
98380
- function resolveGoogleDeviceType(deviceType, traits) {
98472
+ function resolveGoogleDeviceType(deviceType, traits, role) {
98381
98473
  const withheld = applianceExport("google", deviceType);
98382
98474
  if (withheld !== null && !withheld.exported) return null;
98383
98475
  if (traits.includes("action.devices.traits.LockUnlock")) return "action.devices.types.LOCK";
98384
98476
  if (traits.includes("action.devices.traits.OpenClose")) return "action.devices.types.SHUTTER";
98385
98477
  if (!traits.includes("action.devices.traits.OnOff") && !traits.includes("action.devices.traits.Brightness")) return null;
98386
98478
  if (deviceType === DeviceType.Light) return "action.devices.types.LIGHT";
98479
+ return switchSubRoleType(deviceType, role);
98480
+ }
98481
+ function switchSubRoleType(deviceType, role) {
98482
+ if (isSwitchLight(deviceType, role)) return "action.devices.types.LIGHT";
98483
+ if (isOutlet(deviceType, role)) return "action.devices.types.OUTLET";
98484
+ if (isSwitchFan(deviceType, role)) return "action.devices.types.FAN";
98485
+ if (isSwitchHeater(deviceType, role)) return "action.devices.types.HEATER";
98387
98486
  return "action.devices.types.SWITCH";
98388
98487
  }
98389
98488
  /**
@@ -98400,7 +98499,7 @@ function buildSyncDevice(facts) {
98400
98499
  const descriptors = traitsForCaps(facts.capNames);
98401
98500
  if (descriptors.length === 0) return null;
98402
98501
  const traits = descriptors.map((d) => d.trait);
98403
- const type = resolveGoogleDeviceType(facts.deviceType, traits);
98502
+ const type = resolveGoogleDeviceType(facts.deviceType, traits, facts.role);
98404
98503
  if (type === null) return null;
98405
98504
  const attributes = {};
98406
98505
  for (const descriptor of descriptors) Object.assign(attributes, descriptor.attributes(facts.features));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-google",
3
- "version": "0.1.133",
3
+ "version": "0.1.134",
4
4
  "description": "Google Home Export — hub-side smart-home fulfillment (SYNC / QUERY / EXECUTE / DISCONNECT) for the non-camera fleet, served over the hub's own OAuth account link. No Google credential is stored, sent or required.",
5
5
  "keywords": [
6
6
  "camstack",
@@ -61,7 +61,7 @@
61
61
  }
62
62
  ],
63
63
  "requires": {
64
- "server": ">=1.2.850"
64
+ "server": ">=1.2.852"
65
65
  }
66
66
  },
67
67
  "files": [