@camstack/types 1.2.547 → 1.2.549

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.
Files changed (84) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/addon.js +5 -5
  3. package/dist/addon.mjs +5 -5
  4. package/dist/automation/condition-eval.d.ts +24 -0
  5. package/dist/automation/hold.d.ts +11 -0
  6. package/dist/automation/index.d.ts +6 -4
  7. package/dist/automation/recipe.d.ts +5 -0
  8. package/dist/automation/step-condition.d.ts +7 -2
  9. package/dist/automation/trace.d.ts +6 -0
  10. package/dist/automation/trigger-variables.d.ts +3 -1
  11. package/dist/automation/when-site.d.ts +27 -0
  12. package/dist/automation/when.d.ts +107 -1
  13. package/dist/capabilities/accessories.cap.d.ts +1 -1
  14. package/dist/capabilities/actions.cap.d.ts +2 -0
  15. package/dist/capabilities/battery.cap.d.ts +2 -2
  16. package/dist/capabilities/capability-definition.d.ts +47 -1
  17. package/dist/capabilities/climate-control.cap.d.ts +8 -1
  18. package/dist/capabilities/core-blocks.cap.d.ts +8 -0
  19. package/dist/capabilities/customize-catalog.d.ts +3 -1
  20. package/dist/capabilities/customize-spec.d.ts +26 -2
  21. package/dist/capabilities/device-manager.cap.d.ts +6 -0
  22. package/dist/capabilities/fan-control.cap.d.ts +248 -0
  23. package/dist/capabilities/fan-presets.cap.d.ts +172 -536
  24. package/dist/capabilities/group-active.cap.d.ts +1 -1
  25. package/dist/capabilities/group-commands.cap.d.ts +1 -1
  26. package/dist/capabilities/group-status.cap.d.ts +1 -1
  27. package/dist/capabilities/heating-valve.cap.d.ts +1 -1
  28. package/dist/capabilities/hero-layout.cap.d.ts +2 -0
  29. package/dist/capabilities/humidifier.cap.d.ts +5 -0
  30. package/dist/capabilities/humidity-sensor.cap.d.ts +1 -1
  31. package/dist/capabilities/index.d.ts +4 -4
  32. package/dist/capabilities/media-player.cap.d.ts +7 -0
  33. package/dist/capabilities/pet-fountain.cap.d.ts +5 -0
  34. package/dist/capabilities/power-meter.cap.d.ts +5 -5
  35. package/dist/capabilities/power-source.cap.d.ts +5 -0
  36. package/dist/capabilities/running-state.cap.d.ts +2 -2
  37. package/dist/capabilities/schedulers.cap.d.ts +2 -0
  38. package/dist/capabilities/switch.cap.d.ts +1 -1
  39. package/dist/capabilities/temperature-sensor.cap.d.ts +1 -1
  40. package/dist/capabilities/timed-run.cap.d.ts +19 -5
  41. package/dist/capabilities/water-heater.cap.d.ts +7 -0
  42. package/dist/client.js +7 -11
  43. package/dist/client.mjs +7 -11
  44. package/dist/{composed-stable-id-DrGLxjVF.js → composed-stable-id-CDNLq7Y8.js} +27 -10
  45. package/dist/{composed-stable-id-DFNyOFzz.mjs → composed-stable-id-CPp3votu.mjs} +27 -10
  46. package/dist/composition/composition-report.d.ts +6 -0
  47. package/dist/composition/evaluate-field.d.ts +7 -0
  48. package/dist/composition/field-kinds.d.ts +12 -1
  49. package/dist/composition/helpers/index.d.ts +1 -1
  50. package/dist/composition/helpers/source-pick.d.ts +0 -5
  51. package/dist/composition/power-source-link.d.ts +15 -0
  52. package/dist/composition/state-fields.d.ts +2 -0
  53. package/dist/composition/validate-composition.d.ts +15 -1
  54. package/dist/device/base-device-provider.d.ts +13 -0
  55. package/dist/device/device-control-resolution.d.ts +1 -33
  56. package/dist/device/device-kind.d.ts +36 -0
  57. package/dist/device/device-management.d.ts +3 -0
  58. package/dist/device/device-type.d.ts +27 -10
  59. package/dist/device/hero/hero-fragment.d.ts +2 -0
  60. package/dist/device/hero/hero-layout.d.ts +1 -3
  61. package/dist/device/hero/hero-look.d.ts +18 -12
  62. package/dist/device/hero/hero-scene.d.ts +9 -3
  63. package/dist/device/index.d.ts +2 -1
  64. package/dist/device/power-switch.d.ts +82 -0
  65. package/dist/device/schema-fields.d.ts +10 -1
  66. package/dist/generated/addon-api.d.ts +27 -0
  67. package/dist/generated/cap-input-defaults.d.ts +1 -1
  68. package/dist/generated/collection-array-methods.d.ts +1 -1
  69. package/dist/generated/customize-catalog.d.ts +257 -8
  70. package/dist/generated/method-access-map.d.ts +1 -1
  71. package/dist/generated/method-device-selectors.d.ts +1 -1
  72. package/dist/{implemented-methods-M5aguGon.mjs → implemented-methods-5YMDeE3f.mjs} +1 -1
  73. package/dist/{implemented-methods-8AU92riC.js → implemented-methods-Cj65uy2F.js} +1 -1
  74. package/dist/index.d.ts +9 -6
  75. package/dist/index.js +1783 -451
  76. package/dist/index.mjs +1740 -445
  77. package/dist/node.js +2 -2
  78. package/dist/node.mjs +2 -2
  79. package/dist/{sleep-D_NpiLFP.mjs → sleep-Bn346wCJ.mjs} +46 -1
  80. package/dist/{sleep-vzHEmsrO.js → sleep-LFKpQ2_f.js} +46 -1
  81. package/dist/time/index.d.ts +1 -0
  82. package/dist/time/time-spec.d.ts +5 -0
  83. package/dist/time/time-window.d.ts +33 -0
  84. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import type { ExpressionValue } from '../expression/ast.js';
2
2
  import { type DwellTransition, type StatefulExpressionMemory } from '../expression/expression-source.js';
3
3
  import { type CompositionFieldRead, type CompositionFieldSource } from './composition.js';
4
+ import type { CompositionFieldKind } from './composition-report.js';
4
5
  export interface SourceFreshReading {
5
6
  readonly state: 'fresh';
6
7
  readonly value: ExpressionValue;
@@ -61,6 +62,12 @@ export interface EvaluateCompositionFieldInput {
61
62
  readonly source: CompositionFieldSource;
62
63
  readonly read: SourceReader;
63
64
  readonly now: number;
65
+ /**
66
+ * The kind of the field written (the plan's `kind`). A direct read whose
67
+ * value is of another kind (a union source such as `control.value` whose
68
+ * device changed kind) is UNAVAILABLE, never coerced (D1034, D393).
69
+ */
70
+ readonly targetKind?: CompositionFieldKind;
64
71
  readonly stateful?: {
65
72
  readonly currentOutput: unknown;
66
73
  readonly expressionMemory: StatefulExpressionMemory;
@@ -1,6 +1,6 @@
1
1
  import { type CompositionFieldSource } from './composition.js';
2
2
  import type { CompositionFeatureMode, CompositionFieldRole, CompositionProblem, CompositionProblemCode, CompositionUnavailableMode } from './composition-report.js';
3
- import { type ExpressionKindSet } from './expression-kinds.js';
3
+ import { type ExpressionKindSet, type ExpressionValueKind } from './expression-kinds.js';
4
4
  import { type StateFieldDescription } from './state-fields.js';
5
5
  import type { CapabilityLookup } from './validate-composition.js';
6
6
  interface KindsFound {
@@ -13,6 +13,17 @@ interface KindsRefused {
13
13
  readonly message: string;
14
14
  }
15
15
  type KindsResult = KindsFound | KindsRefused;
16
+ /** A union field is read as a source (D1034), never written: no single kind to check a source against. */
17
+ export declare function unionTargetProblem(cap: string, path: string, at: string): CompositionProblem;
18
+ /** The one value kind a target field accepts. */
19
+ export declare function acceptedKind(target: StateFieldDescription): ExpressionValueKind | null;
20
+ /**
21
+ * A direct read of a UNION source field (D1034) is judged by the member that
22
+ * fits the target: when one does, the read produces that kind only (a reading
23
+ * of another kind is UNAVAILABLE at read time, never a coerced value); when
24
+ * none does, the kinds stay as they are and `compatibility` names the mismatch.
25
+ */
26
+ export declare function narrowUnionRead(source: CompositionFieldSource, target: StateFieldDescription, kinds: ExpressionKindSet, lookupCap: CapabilityLookup): ExpressionKindSet;
16
27
  export declare function sourceKinds(source: CompositionFieldSource, lookupCap: CapabilityLookup): KindsResult;
17
28
  export declare function compatibility(cap: string, target: StateFieldDescription, kinds: ExpressionKindSet, at: string): readonly CompositionProblem[];
18
29
  /**
@@ -9,5 +9,5 @@ export { KWH_PER_WATT_MS, wattMillisecondsToKwh } from './energy.js';
9
9
  export { type HistoryValue, type IntegralScale, type SeriesBefore, type SeriesKind, type SeriesPoint, type SeriesRead, STATISTIC_STATS, SERIES_KINDS, evaluateDerivative, evaluateStatistic, integrateReading, } from './history-math.js';
10
10
  export { type CalendarPeriod, type CalendarWindow, type HistoryRetention, type HistoryTier, type HistoryTierPlan, type OpenRange, type ResetPeriod, type RollingSpan, type RollingWindow, type StatisticWindow, CALENDAR_PERIODS, CalendarWindowSchema, DAY_MS, DEFAULT_HISTORY_RETENTION, historyRetentionFromSettings, HISTORY_FAST_MS, HISTORY_SLOW_MS, HISTORY_TIERS, HOUR_MS, MINUTE_MS, MIN_CUSTOM_MINUTES, RESET_PERIODS, ROLLING_SPANS, RollingWindowSchema, StatisticWindowSchema, integralCadenceMs, maxDurationMs, nextLocalMidnight, openReset, openStatistic, planResetTier, planStatisticTier, rollingDurationMs, statisticCadenceMs, } from './history-window.js';
11
11
  export { type HelperMemberFact, helperSaveProblems, } from './save.js';
12
- export { type SourcePick, type SourcePickAccept, type SourcePickFieldChoice, type SourcePickHistory, type SourcePickRequest, type MathSourceKind, sourcePickForHeaterPlug, sourcePickForHistory, sourcePickForMath, sourcePickForTemplate, } from './source-pick.js';
12
+ export { type SourcePick, type SourcePickAccept, type SourcePickFieldChoice, type SourcePickHistory, type SourcePickRequest, type MathSourceKind, sourcePickForHistory, sourcePickForMath, sourcePickForTemplate, } from './source-pick.js';
13
13
  export { ACTIVE_CRITERIA, AGGREGATE_REDUCERS, ActiveCriterionSchema, AggregateReducerSchema, BINARY_AGGREGATES, GROUP_TEMPLATE_IDS, ARITHMETIC_OPS, ArithmeticHelperSpecSchema, DERIVATIVE_UNITS, DerivativeHelperSpecSchema, EXPRESSION_OUTPUTS, ExpressionHelperSpecSchema, ThresholdHelperSpecSchema, GroupHelperSpecSchema, GroupTemplateIdSchema, HelperMemberSchema, HelperSpecSchema, INTEGRAL_OUTPUTS, IntegralHelperSpecSchema, MAX_HELPER_MEMBERS, helperMembers, isHistoryHelper, NUMERIC_AGGREGATES, StatisticHelperSpecSchema, type ActiveCriterion, type AggregateReducer, type BinaryAggregate, type ArithmeticHelperSpec, type ArithmeticOp, type DerivativeHelperSpec, type DerivativeUnit, type ExpressionHelperSpec, type ExpressionInput, type ExpressionOutput, type ThresholdHelperSpec, type GroupHelperSpec, type GroupTemplateId, type HelperMember, type HelperSpec, type HistoryHelperSpec, type IntegralHelperSpec, type IntegralOutput, type NumericAggregate, type StatisticHelperSpec, type StatisticStat, } from './spec.js';
@@ -54,8 +54,3 @@ export type MathSourceKind = 'threshold' | 'sum' | 'difference' | 'ratio' | 'exp
54
54
  * A derivative reads one historised number.
55
55
  */
56
56
  export declare function sourcePickForMath(kind: MathSourceKind): SourcePickRequest;
57
- /**
58
- * The one thing a naked heater needs at creation (D1004 point 5): the plug it
59
- * switches. On and off forward to that plug; no other facet is attached.
60
- */
61
- export declare function sourcePickForHeaterPlug(): SourcePickRequest;
@@ -20,3 +20,18 @@ export declare function normalizeOffSeconds(value: unknown): number;
20
20
  * passes the block id and a new-target composition without one has no link.
21
21
  */
22
22
  export declare function powerSourceLinkOfComposition(composition: Composition | null, blockId?: string): PowerSourceLink | null;
23
+ /** A power-source link that names one of the device's own actuators: the field, and the switch it names. */
24
+ export interface PowerSourceActuatorConflict {
25
+ /** Where the link sits: `features[N].fields.switchOn`. */
26
+ readonly path: string;
27
+ /** The switch that is both the supply and an actuator (or the device itself). */
28
+ readonly switch: CompositionSourceRef;
29
+ }
30
+ /**
31
+ * The supply plug is never one of the device's own actuators (#462): cutting
32
+ * power through the switch that IS the device's on/off leaves nothing to
33
+ * restart, and makes "power off" and "turn off" the same press. Refused at save
34
+ * time (`power-source-is-actuator`) and again by the power-source provider for a
35
+ * link stored before this check existed (`switch-is-actuator`).
36
+ */
37
+ export declare function powerSourceActuatorConflicts(composition: Composition): readonly PowerSourceActuatorConflict[];
@@ -12,6 +12,8 @@ export interface StateFieldDescription {
12
12
  readonly required: boolean;
13
13
  /** Present only when `kind === 'enum'` — the closed set of strings the field accepts. */
14
14
  readonly enumValues?: readonly string[];
15
+ /** Present only when `kind === 'union'` — the scalar kinds the field may carry (D1034). */
16
+ readonly unionMembers?: WireableField['unionMembers'];
15
17
  }
16
18
  export declare function describeStateField(schema: z.ZodType, path: string): StateFieldDescription | null;
17
19
  export declare function describeTopLevelStateFields(schema: z.ZodType): ReadonlyMap<string, StateFieldDescription>;
@@ -11,7 +11,8 @@
11
11
  import type { CapabilityDefinition } from '../capabilities/capability-definition.js';
12
12
  import type { DeviceType } from '../device/device-type.js';
13
13
  import type { ReadingQuantity } from '../units/quantity.js';
14
- import { type Composition, type CompositionSourceRef } from './composition.js';
14
+ import type { WireableScalarKind } from '../device/schema-fields.js';
15
+ import { type Composition, type CompositionFieldRead, type CompositionSourceRef } from './composition.js';
15
16
  import { type CompositionPlanResult } from './plan-result.js';
16
17
  import { type CompositionPeer } from './composition-graph.js';
17
18
  import { type CompositionValidation } from './composition-report.js';
@@ -27,6 +28,13 @@ export interface CompositionSourceFound {
27
28
  readonly deviceType?: DeviceType;
28
29
  /** Present when the device declares one. Mixed quantities are refused. */
29
30
  readonly quantity?: ReadingQuantity;
31
+ /**
32
+ * The LIVE kind of each union field the composition reads from this device,
33
+ * keyed `<cap>.<fieldPath>` (D1034): a numeric control's `control.value` is a
34
+ * number, a select's a string. Absent when the slice was not known at save
35
+ * time; the read-time guard still applies.
36
+ */
37
+ readonly liveKinds?: ReadonlyMap<string, WireableScalarKind>;
30
38
  }
31
39
  export interface CompositionSourceAbsent {
32
40
  readonly kind: 'absent';
@@ -78,6 +86,12 @@ export declare const PENDING_BLOCK_ID = "(unsaved)";
78
86
  */
79
87
  export declare function planComposition(composition: Composition, lookupCap: CapabilityLookup, target?: CompositionTargetDescription): CompositionPlanResult;
80
88
  export declare function compositionSourceRefs(composition: Composition): readonly CompositionSourceRef[];
89
+ /**
90
+ * Every DIRECT read (`from`) of a union source field (D1034): the reads whose
91
+ * source's live kind a save looks up, so a numeric control is never linked to
92
+ * a string field. A read inside an expression is judged by the expression.
93
+ */
94
+ export declare function compositionUnionReads(composition: Composition, lookupCap: CapabilityLookup): readonly CompositionFieldRead[];
81
95
  /**
82
96
  * `compositionFieldKey` of every field a REPLACE feature of `plan` owns — the
83
97
  * candidate's own, and a stored peer's `CompositionPeer.replaced` (D663): one
@@ -99,6 +99,12 @@ export interface FieldProbeResult {
99
99
  * device-provider cap router. Shared across all providers.
100
100
  */
101
101
  export declare function toDeviceSummary(device: IDevice, addonId: string): DeviceSummary;
102
+ /** What `deviceClassForRow` sees of a persisted row. */
103
+ export interface DeviceClassRow {
104
+ readonly type: string;
105
+ readonly stableId: string;
106
+ readonly config?: Record<string, unknown>;
107
+ }
102
108
  /**
103
109
  * Base class for device-provider addons (rtsp, onvif).
104
110
  *
@@ -307,6 +313,13 @@ export declare abstract class BaseDeviceProvider<TConfig extends object = Record
307
313
  * top-level type → class map only handles parent devices.
308
314
  */
309
315
  protected abstract readonly deviceClasses: Partial<Record<DeviceType, DeviceConstructor<IDevice>>>;
316
+ /**
317
+ * The class a PERSISTED row is rebuilt with. Default: by type, from
318
+ * `deviceClasses`. A provider whose distinct devices share one type (D1033:
319
+ * a radiator valve and a room climate are both `climate`) overrides this
320
+ * and tells them apart by the row's stable id or config.
321
+ */
322
+ protected deviceClassForRow(row: DeviceClassRow): DeviceConstructor<IDevice> | undefined;
310
323
  /** Return the creation form schema for a given device type, or null if unsupported. */
311
324
  protected abstract onGetCreationSchema(type: DeviceType, context?: CreationSchemaContext): Promise<ConfigUISchema | null>;
312
325
  /**
@@ -1,35 +1,3 @@
1
- /**
2
- * Device-control RESOLUTION LOGIC — the single, presentation-free source of
3
- * truth for "given a device's `type` (+ its cap `features`), which control
4
- * should render?".
5
- *
6
- * This module is deliberately framework-free: NO react / react-native / lucide
7
- * imports, no JSX, no platform widgets. It encodes only the DECISION; each
8
- * client (admin-ui's `@camstack/ui-library` web registry, the RN viewer's
9
- * accessory registry) maps the returned control-KIND onto its own
10
- * platform-specific components. That's the one duplication we remove — the
11
- * presentational components stay platform-specific by necessity.
12
- *
13
- * Two decision surfaces live here, at two granularities:
14
- *
15
- * 1. `resolveDeviceControlKind(type)` — the BASE type → control-kind decision
16
- * used by the admin-ui device list / device-detail hero. Exhaustive over
17
- * every `DeviceType`; a light is a single `'light'` kind (dim-vs-plain is
18
- * refined inside the light component).
19
- *
20
- * 2. `pickAccessoryControl({ type, features })` — the FINER accessory-row
21
- * decision used by the viewer's per-camera accessory list. It refines a
22
- * `light` into `'brightness'` vs `'switch'` and a `sensor`/`presence` into
23
- * a specific sensor cap, because an accessory row renders ONE compact
24
- * control chosen by priority.
25
- *
26
- * The two agree on every overlapping type EXCEPT `light` (see the notes on
27
- * `pickAccessoryControl`): the base decision keeps a dedicated `'light'`
28
- * control; the accessory decision collapses a non-dimmable light onto the
29
- * generic `'switch'` control. That is a deliberate granularity difference, not
30
- * a contradiction — the base kind is what the admin-ui renders, the accessory
31
- * pick is what a compact camera-accessory row renders.
32
- */
33
1
  import { DeviceType } from './device-type.js';
34
2
  /**
35
3
  * The abstract control-kind a `DeviceType` resolves to. Each client binds
@@ -52,7 +20,7 @@ export declare const DEVICE_TYPE_CONTROL_KIND: Record<DeviceType, DeviceControlK
52
20
  * narrows the string to a `DeviceType` before indexing (documented enum-string
53
21
  * boundary).
54
22
  */
55
- export declare function resolveDeviceControlKind(type: string): DeviceControlKind | null;
23
+ export declare function resolveDeviceControlKind(type: string, role?: string | null): DeviceControlKind | null;
56
24
  /** Identifier of the control kind an accessory row should render. `'none'` = no
57
25
  * control. A subset of the surfaces the base decision covers, PLUS
58
26
  * `'brightness'` (a dimmable light refined at the decision layer). */
@@ -0,0 +1,36 @@
1
+ /**
2
+ * A device's KIND is its type plus its role (D1033): the type is the set of
3
+ * controls it has, the role says which thing it is among the devices that
4
+ * share those controls. A plug-in heater is a `switch` with role
5
+ * `switch-heater`; an air conditioner and a radiator valve are both `climate`,
6
+ * told apart by their `climate-*` role.
7
+ */
8
+ import { DeviceRole, DeviceType } from './device-type.js';
9
+ /** The live type a stored `type` value stands for (itself unless retired). */
10
+ export declare function canonicalStoredDeviceType(stored: string): string;
11
+ /** The `climate-*` roles, in the order the role picker lists them. */
12
+ export declare const CLIMATE_ROLES: readonly DeviceRole[];
13
+ export type ClimateRole = DeviceRole.ClimateThermostat | DeviceRole.ClimateAc | DeviceRole.ClimateRadiator | DeviceRole.ClimateFloor | DeviceRole.ClimateHeater | DeviceRole.ClimateHeatPumpCircuit;
14
+ /**
15
+ * Which climate device this is. A climate device with no role, or a role that
16
+ * is not a climate one, is a room thermostat: that is what most of them are,
17
+ * and it is the presentation a thermostat had before the types were folded.
18
+ */
19
+ export declare function climateRoleOf(role: string | null | undefined): ClimateRole;
20
+ /** An air conditioner: exports present it as an AC unit, not a thermostat. */
21
+ export declare function isAirConditioner(type: string, role: string | null | undefined): boolean;
22
+ /** The part of a capability definition that says which devices it is offered on. */
23
+ export interface DeviceKindGate {
24
+ readonly deviceTypes?: readonly DeviceType[];
25
+ readonly deviceRoles?: Readonly<Partial<Record<DeviceType, readonly DeviceRole[]>>>;
26
+ }
27
+ /**
28
+ * Is a capability offered on a device of this type and role?
29
+ *
30
+ * Fails open where the old type-only gate did: no `deviceTypes` (or an empty
31
+ * list) applies to every device, and an unknown type never filters (a failed
32
+ * meta read must not destroy work, D49). A type the cap's `deviceRoles` names
33
+ * is offered only to the roles listed there; an unknown role is NOT one of
34
+ * them, so a `switch` whose role could not be read is not a heater.
35
+ */
36
+ export declare function capAppliesToDeviceKind(gate: DeviceKindGate | undefined, deviceType: string | undefined, role: string | null | undefined): boolean;
@@ -190,6 +190,9 @@ export interface DeviceMeta {
190
190
  * → canonical unit. Applied at RENDER time only — storage stays in source
191
191
  * units. */
192
192
  readonly display?: DeviceDisplayOverride;
193
+ /** Semantic role string (`DeviceRole`): with the type, which thing the device
194
+ * is (D1033). Absent / null ⇒ no role. */
195
+ readonly role?: string | null;
193
196
  }
194
197
  /**
195
198
  * Initial meta a provider supplies on `onCreateDevice`. Differs
@@ -6,12 +6,12 @@ export declare enum DeviceType {
6
6
  Siren = "siren",
7
7
  Switch = "switch",
8
8
  Sensor = "sensor",
9
- Thermostat = "thermostat",
10
- /** Air-conditioner / heat-pump climate device (HVAC) — shares the
11
- * `climate-control` cap surface with `Thermostat` but renders a
12
- * dedicated AC-appropriate control UI (mode chips, fan speed,
13
- * independent vertical/horizontal swing). Sources: native Gree, and
14
- * reusable by other AC integrations. */
9
+ /** Every climate device: an air conditioner, a room thermostat, a radiator
10
+ * valve, a floor-heating zone, a heat-pump circuit. They share one set of
11
+ * controls (`climate-control`), so they are one type; WHICH kind of climate
12
+ * device it is is its {@link DeviceRole} (`climate-*`), which the UI and the
13
+ * exports branch on. The retired `thermostat` type is read as this one
14
+ * (`canonicalStoredDeviceType`). */
15
15
  Climate = "climate",
16
16
  Button = "button",
17
17
  /** Generic stateless event emitter — carries a device's EXACT declared
@@ -102,10 +102,6 @@ export declare enum DeviceType {
102
102
  /** Washing machine. A plug-built one is running while its power stays
103
103
  * above a threshold. No program cap — that surface is the dishwasher's. */
104
104
  Washer = "washer",
105
- /** A dumb plug-in stove or heater: a switch (and, with a meter, a power
106
- * reading) that only runs while the plug is on. Built from a smart plug;
107
- * the `timed-run` cap switches it off again after a chosen time. */
108
- Heater = "heater",
109
105
  /** Tumble dryer. Same plug-built running surface as {@link Washer}. */
110
106
  Dryer = "dryer",
111
107
  /** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
@@ -335,6 +331,27 @@ export declare enum DeviceRole {
335
331
  /** A smart plug: a `switch` whose source says it is an outlet (HA
336
332
  * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
337
333
  Outlet = "outlet",
334
+ /** A dumb plug-in stove or heater behind a switch: it runs only while the
335
+ * switch is on. Offered `timed-run`, which switches it off again after a
336
+ * chosen time. */
337
+ SwitchHeater = "switch-heater",
338
+ /** A plain fan behind a switch (a smart plug powering it): drawn as a fan,
339
+ * with the switch's on/off only. Speed or oscillation appear only when the
340
+ * device also has a fan cap (D1033). */
341
+ SwitchFan = "switch-fan",
342
+ /** Air conditioner / split unit: cooling, fan speed, louvres. */
343
+ ClimateAc = "climate-ac",
344
+ /** Room thermostat: a setpoint and a room temperature. The default. */
345
+ ClimateThermostat = "climate-thermostat",
346
+ /** Floor-heating zone actuator. */
347
+ ClimateFloor = "climate-floor",
348
+ /** Radiator valve (thermostatic radiator head). */
349
+ ClimateRadiator = "climate-radiator",
350
+ /** A heater with its own thermostat (stove, convector). */
351
+ ClimateHeater = "climate-heater",
352
+ /** One heating/cooling circuit of a heat pump: a water loop with comfort /
353
+ * eco setpoints and a heat/cool mode, no room sensor. */
354
+ ClimateHeatPumpCircuit = "climate-heat-pump-circuit",
338
355
  /** Generic motion / occupancy / moving event source. Distinct from
339
356
  * the camera accessory PirSensor role: that one is a camera child;
340
357
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -22,6 +22,8 @@ export interface StateReading {
22
22
  export interface HeroContext {
23
23
  readonly deviceId: number;
24
24
  readonly type: string;
25
+ /** The device's role: with the type, which thing it is (D1033). */
26
+ readonly role: string | null;
25
27
  readonly features: readonly string[];
26
28
  readonly now: number;
27
29
  /** The `running-state` reading: `undefined` = not bound or not answered, `null` = unknown. */
@@ -11,7 +11,6 @@ export declare const HERO_LAYOUT_BY_TYPE: {
11
11
  readonly siren: HeroLayout;
12
12
  readonly switch: HeroLayout;
13
13
  readonly sensor: HeroLayout;
14
- readonly thermostat: HeroLayout;
15
14
  readonly climate: HeroLayout;
16
15
  readonly button: HeroLayout;
17
16
  readonly "event-emitter": HeroLayout;
@@ -40,9 +39,8 @@ export declare const HERO_LAYOUT_BY_TYPE: {
40
39
  readonly "pet-fountain": HeroLayout;
41
40
  readonly dishwasher: HeroLayout;
42
41
  readonly washer: HeroLayout;
43
- readonly heater: HeroLayout;
44
42
  readonly dryer: HeroLayout;
45
43
  readonly gateway: HeroLayout;
46
44
  };
47
45
  /** The layout of a type; a type this build does not know gets the default. */
48
- export declare function resolveHeroLayout(type: string): HeroLayout;
46
+ export declare function resolveHeroLayout(type: string, role?: string | null): HeroLayout;