@camstack/types 1.2.419 → 1.2.421

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.
@@ -1,4 +1,4 @@
1
- const require_err_msg = require("./err-msg-BhVbr0NX.js");
1
+ const require_err_msg = require("./err-msg-U7lLUMNz.js");
2
2
  let zod = require("zod");
3
3
  let node_crypto = require("node:crypto");
4
4
  //#region src/ffmpeg/invocation.ts
@@ -2160,6 +2160,78 @@ function evaluateExpressionSource(expr, bindingValues, now, opts) {
2160
2160
  }
2161
2161
  }
2162
2162
  //#endregion
2163
+ //#region src/composition/helpers/appliance.ts
2164
+ /**
2165
+ * One power reading becomes a washer, dryer or dishwasher (D944 helper).
2166
+ *
2167
+ * Standby of the control board is under 5 W; a motor or a heater is far
2168
+ * above that, so 5 W is the line. A door lock or a short pump spike is not
2169
+ * a cycle, so running starts only after 30 s above the line.
2170
+ *
2171
+ * A wash, dry or dishwasher pause (soak, heat-wait, heater off between
2172
+ * bursts) lasts several minutes. Ending the cycle on the first dip would
2173
+ * report "finished" in the middle of the program, so the stop dwell is
2174
+ * 10 minutes on every type. The number is stored per type so one machine
2175
+ * can move later without moving the others.
2176
+ */
2177
+ var APPLIANCE_TEMPLATE_ID = "appliance";
2178
+ var APPLIANCE_KINDS = [
2179
+ "washer",
2180
+ "dryer",
2181
+ "dishwasher"
2182
+ ];
2183
+ var START_DWELL_MS = 3e4;
2184
+ var STOP_DWELL_MS = 6e5;
2185
+ var THRESHOLD_WATTS = 5;
2186
+ var APPLIANCE_DEFAULTS = {
2187
+ washer: {
2188
+ thresholdWatts: THRESHOLD_WATTS,
2189
+ startDwellMs: START_DWELL_MS,
2190
+ stopDwellMs: STOP_DWELL_MS
2191
+ },
2192
+ dryer: {
2193
+ thresholdWatts: THRESHOLD_WATTS,
2194
+ startDwellMs: START_DWELL_MS,
2195
+ stopDwellMs: STOP_DWELL_MS
2196
+ },
2197
+ dishwasher: {
2198
+ thresholdWatts: THRESHOLD_WATTS,
2199
+ startDwellMs: START_DWELL_MS,
2200
+ stopDwellMs: STOP_DWELL_MS
2201
+ }
2202
+ };
2203
+ var DEVICE_TYPE = {
2204
+ washer: require_err_msg.DeviceType.Washer,
2205
+ dryer: require_err_msg.DeviceType.Dryer,
2206
+ dishwasher: require_err_msg.DeviceType.Dishwasher
2207
+ };
2208
+ function applianceDeviceType(kind) {
2209
+ return DEVICE_TYPE[kind];
2210
+ }
2211
+ function isApplianceKind(value) {
2212
+ return APPLIANCE_KINDS.some((kind) => kind === value);
2213
+ }
2214
+ /** The member step: one watts reading, from a sensor or from the plug itself. */
2215
+ function sourcePickForAppliance() {
2216
+ return {
2217
+ purpose: "reading",
2218
+ multiple: false,
2219
+ max: 1,
2220
+ deviceTypes: [require_err_msg.DeviceType.Sensor, require_err_msg.DeviceType.Switch],
2221
+ accept: [{
2222
+ cap: "power-meter",
2223
+ fieldPath: "watts",
2224
+ valueKind: "number"
2225
+ }],
2226
+ history: {
2227
+ required: false,
2228
+ minRetentionMs: null
2229
+ },
2230
+ mustBindCaps: [],
2231
+ exclude: []
2232
+ };
2233
+ }
2234
+ //#endregion
2163
2235
  //#region src/composition/source-ref.ts
2164
2236
  /**
2165
2237
  * A composition source identity: `(addonId, stableId)`, never a numeric device
@@ -2237,7 +2309,20 @@ var GroupHelperSpecSchema = zod.z.object({
2237
2309
  /** Actuator groups only. Readings leave this unset. */
2238
2310
  active: ActiveCriterionSchema.optional()
2239
2311
  });
2240
- var HelperSpecSchema = zod.z.discriminatedUnion("kind", [GroupHelperSpecSchema]);
2312
+ var ApplianceHelperSpecSchema = zod.z.object({
2313
+ kind: zod.z.literal("appliance"),
2314
+ templateId: zod.z.literal(APPLIANCE_TEMPLATE_ID),
2315
+ appliance: zod.z.enum(APPLIANCE_KINDS),
2316
+ thresholdWatts: zod.z.number().positive(),
2317
+ startDwellMs: zod.z.number().int().nonnegative(),
2318
+ stopDwellMs: zod.z.number().int().nonnegative(),
2319
+ member: HelperMemberSchema
2320
+ });
2321
+ var HelperSpecSchema = zod.z.discriminatedUnion("kind", [GroupHelperSpecSchema, ApplianceHelperSpecSchema]);
2322
+ /** Every member a helper reads. An appliance has one. */
2323
+ function helperMembers(spec) {
2324
+ return spec.kind === "group" ? spec.members : [spec.member];
2325
+ }
2241
2326
  //#endregion
2242
2327
  //#region src/composition/composition.ts
2243
2328
  /**
@@ -2509,6 +2594,24 @@ Object.defineProperty(exports, "AGGREGATE_REDUCERS", {
2509
2594
  return AGGREGATE_REDUCERS;
2510
2595
  }
2511
2596
  });
2597
+ Object.defineProperty(exports, "APPLIANCE_DEFAULTS", {
2598
+ enumerable: true,
2599
+ get: function() {
2600
+ return APPLIANCE_DEFAULTS;
2601
+ }
2602
+ });
2603
+ Object.defineProperty(exports, "APPLIANCE_KINDS", {
2604
+ enumerable: true,
2605
+ get: function() {
2606
+ return APPLIANCE_KINDS;
2607
+ }
2608
+ });
2609
+ Object.defineProperty(exports, "APPLIANCE_TEMPLATE_ID", {
2610
+ enumerable: true,
2611
+ get: function() {
2612
+ return APPLIANCE_TEMPLATE_ID;
2613
+ }
2614
+ });
2512
2615
  Object.defineProperty(exports, "AUDIO_PRESETS", {
2513
2616
  enumerable: true,
2514
2617
  get: function() {
@@ -2527,6 +2630,12 @@ Object.defineProperty(exports, "AggregateReducerSchema", {
2527
2630
  return AggregateReducerSchema;
2528
2631
  }
2529
2632
  });
2633
+ Object.defineProperty(exports, "ApplianceHelperSpecSchema", {
2634
+ enumerable: true,
2635
+ get: function() {
2636
+ return ApplianceHelperSpecSchema;
2637
+ }
2638
+ });
2530
2639
  Object.defineProperty(exports, "BINARY_AGGREGATES", {
2531
2640
  enumerable: true,
2532
2641
  get: function() {
@@ -2869,6 +2978,12 @@ Object.defineProperty(exports, "SOURCE_DEVICE_TYPES", {
2869
2978
  return SOURCE_DEVICE_TYPES;
2870
2979
  }
2871
2980
  });
2981
+ Object.defineProperty(exports, "applianceDeviceType", {
2982
+ enumerable: true,
2983
+ get: function() {
2984
+ return applianceDeviceType;
2985
+ }
2986
+ });
2872
2987
  Object.defineProperty(exports, "audioPlanFromEncodeProfile", {
2873
2988
  enumerable: true,
2874
2989
  get: function() {
@@ -3067,12 +3182,24 @@ Object.defineProperty(exports, "getFfmpegDownloadUrl", {
3067
3182
  return getFfmpegDownloadUrl;
3068
3183
  }
3069
3184
  });
3185
+ Object.defineProperty(exports, "helperMembers", {
3186
+ enumerable: true,
3187
+ get: function() {
3188
+ return helperMembers;
3189
+ }
3190
+ });
3070
3191
  Object.defineProperty(exports, "invocationFromEncodeProfile", {
3071
3192
  enumerable: true,
3072
3193
  get: function() {
3073
3194
  return invocationFromEncodeProfile;
3074
3195
  }
3075
3196
  });
3197
+ Object.defineProperty(exports, "isApplianceKind", {
3198
+ enumerable: true,
3199
+ get: function() {
3200
+ return isApplianceKind;
3201
+ }
3202
+ });
3076
3203
  Object.defineProperty(exports, "isSoftwareDecode", {
3077
3204
  enumerable: true,
3078
3205
  get: function() {
@@ -3127,6 +3254,12 @@ Object.defineProperty(exports, "sliceChangedAt", {
3127
3254
  return sliceChangedAt;
3128
3255
  }
3129
3256
  });
3257
+ Object.defineProperty(exports, "sourcePickForAppliance", {
3258
+ enumerable: true,
3259
+ get: function() {
3260
+ return sourcePickForAppliance;
3261
+ }
3262
+ });
3130
3263
  Object.defineProperty(exports, "toExpressionValue", {
3131
3264
  enumerable: true,
3132
3265
  get: function() {
@@ -0,0 +1,25 @@
1
+ /**
2
+ * How a washer, dryer or dishwasher leaves CamStack.
3
+ *
4
+ * Home Assistant has no laundry domain: the device is offered, and what
5
+ * travels is its power reading. The others have a laundry type that this
6
+ * export cannot honour yet, so they are named and withheld.
7
+ */
8
+ import { DeviceType } from './device-type.js';
9
+ export type PlugApplianceType = DeviceType.Washer | DeviceType.Dryer | DeviceType.Dishwasher;
10
+ export declare const PLUG_APPLIANCE_TYPES: readonly PlugApplianceType[];
11
+ export interface ApplianceExported {
12
+ readonly exported: true;
13
+ /** What the other ecosystem actually receives. */
14
+ readonly as: string;
15
+ }
16
+ export interface ApplianceNotExported {
17
+ readonly exported: false;
18
+ readonly reason: string;
19
+ }
20
+ export type ApplianceExportDecision = ApplianceExported | ApplianceNotExported;
21
+ export type ApplianceExportEcosystem = 'ha' | 'homekit' | 'alexa' | 'google' | 'matter';
22
+ export declare const APPLIANCE_EXPORT: Readonly<Record<ApplianceExportEcosystem, Readonly<Record<PlugApplianceType, ApplianceExportDecision>>>>;
23
+ export declare function isPlugApplianceType(deviceType: string): deviceType is PlugApplianceType;
24
+ /** The decision for this ecosystem, or null when the type is not an appliance. */
25
+ export declare function applianceExport(ecosystem: ApplianceExportEcosystem, deviceType: string): ApplianceExportDecision | null;
@@ -238,6 +238,12 @@ export interface VocabStateWording {
238
238
  readonly quantity?: L10n;
239
239
  readonly icon?: VocabIcon;
240
240
  }
241
+ /** Re-wording of one declared event for a kind of device. */
242
+ export interface VocabEventWording {
243
+ readonly label?: L10n;
244
+ readonly phrase?: L10n;
245
+ readonly icon?: VocabIcon;
246
+ }
241
247
  /** Wording that differs for a device type or role (a switch that is a siren). */
242
248
  export interface VocabWording<C extends VocabCapName> {
243
249
  /** Keyed by action id. */
@@ -245,6 +251,9 @@ export interface VocabWording<C extends VocabCapName> {
245
251
  readonly state?: {
246
252
  readonly [F in CapStatusField<C>]?: VocabStateWording;
247
253
  };
254
+ readonly events?: {
255
+ readonly [E in CapEventName<C>]?: VocabEventWording;
256
+ };
248
257
  }
249
258
  /** Overrides, keyed in the same map: a role beats a type. */
250
259
  export interface VocabOverrides<C extends VocabCapName> {
@@ -378,6 +387,7 @@ export type LooseVocabStateTrigger = LooseBooleanStateTrigger | LooseNumericStat
378
387
  export interface LooseVocabWording {
379
388
  readonly actions?: Readonly<Record<string, VocabActionWording>>;
380
389
  readonly state?: Readonly<Record<string, VocabStateWording | undefined>>;
390
+ readonly events?: Readonly<Record<string, VocabEventWording | undefined>>;
381
391
  }
382
392
  /** Overrides as a consumer reads them. */
383
393
  export interface LooseVocabOverrides {
@@ -91,8 +91,14 @@ export declare enum DeviceType {
91
91
  PetFeeder = "pet-feeder",
92
92
  /** Built-in dishwasher — program lifecycle, door / remote-start gates,
93
93
  * salt and rinse-aid levels. Installed with the `dishwasher` cap.
94
- * Sources: native Bosch Home Connect, reusable by similar integrations. */
95
- Dishwasher = "dishwasher"
94
+ * Sources: native Bosch Home Connect, reusable by similar integrations.
95
+ * A plug-built dishwasher carries running-state and power instead. */
96
+ Dishwasher = "dishwasher",
97
+ /** Washing machine. A plug-built one is running while its power stays
98
+ * above a threshold. No program cap — that surface is the dishwasher's. */
99
+ Washer = "washer",
100
+ /** Tumble dryer. Same plug-built running surface as {@link Washer}. */
101
+ Dryer = "dryer"
96
102
  }
97
103
  export declare enum DeviceFeature {
98
104
  BatteryOperated = "battery-operated",
@@ -92,8 +92,14 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
92
92
  DeviceType["PetFeeder"] = "pet-feeder";
93
93
  /** Built-in dishwasher — program lifecycle, door / remote-start gates,
94
94
  * salt and rinse-aid levels. Installed with the `dishwasher` cap.
95
- * Sources: native Bosch Home Connect, reusable by similar integrations. */
95
+ * Sources: native Bosch Home Connect, reusable by similar integrations.
96
+ * A plug-built dishwasher carries running-state and power instead. */
96
97
  DeviceType["Dishwasher"] = "dishwasher";
98
+ /** Washing machine. A plug-built one is running while its power stays
99
+ * above a threshold. No program cap — that surface is the dishwasher's. */
100
+ DeviceType["Washer"] = "washer";
101
+ /** Tumble dryer. Same plug-built running surface as {@link Washer}. */
102
+ DeviceType["Dryer"] = "dryer";
97
103
  return DeviceType;
98
104
  }({});
99
105
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -92,8 +92,14 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
92
92
  DeviceType["PetFeeder"] = "pet-feeder";
93
93
  /** Built-in dishwasher — program lifecycle, door / remote-start gates,
94
94
  * salt and rinse-aid levels. Installed with the `dishwasher` cap.
95
- * Sources: native Bosch Home Connect, reusable by similar integrations. */
95
+ * Sources: native Bosch Home Connect, reusable by similar integrations.
96
+ * A plug-built dishwasher carries running-state and power instead. */
96
97
  DeviceType["Dishwasher"] = "dishwasher";
98
+ /** Washing machine. A plug-built one is running while its power stays
99
+ * above a threshold. No program cap — that surface is the dishwasher's. */
100
+ DeviceType["Washer"] = "washer";
101
+ /** Tumble dryer. Same plug-built running surface as {@link Washer}. */
102
+ DeviceType["Dryer"] = "dryer";
97
103
  return DeviceType;
98
104
  }({});
99
105
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -56,7 +56,7 @@ export declare const CAP_CUSTOMIZE_CATALOG: {
56
56
  readonly targets: readonly [{
57
57
  readonly id: 'items';
58
58
  readonly cardinality: 'keyedArray';
59
- readonly deviceTypes: readonly [DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher];
59
+ readonly deviceTypes: readonly [DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer];
60
60
  readonly apply: 'add';
61
61
  readonly vocabularyCap: 'consumables';
62
62
  readonly sources: readonly [];
@@ -211,7 +211,7 @@ export declare const CAP_CUSTOMIZE_CATALOG: {
211
211
  readonly targets: readonly [{
212
212
  readonly id: 'running';
213
213
  readonly cardinality: 'scalar';
214
- readonly deviceTypes: readonly [DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder];
214
+ readonly deviceTypes: readonly [DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder];
215
215
  readonly apply: 'add';
216
216
  readonly vocabularyCap: 'running-state';
217
217
  readonly vocabularyStateField: 'running';
package/dist/index.d.ts CHANGED
@@ -217,6 +217,7 @@ export { DeviceRuntimeState } from './device/device-runtime-state.js';
217
217
  export type { SliceEventBus, SliceHandle, SliceHandleApi, SliceHandleSource, } from './device/device-state-handle.js';
218
218
  export { createEventBusSliceSource, createLazyTrpcSource, createMirrorSource, createSliceHandle, } from './device/device-state-handle.js';
219
219
  export { ChargingStatus, DeviceFeature, DeviceRole, DeviceType } from './device/device-type.js';
220
+ export { APPLIANCE_EXPORT, type ApplianceExportDecision, type ApplianceExportEcosystem, type ApplianceExported, type ApplianceNotExported, type PlugApplianceType, PLUG_APPLIANCE_TYPES, applianceExport, isPlugApplianceType, } from './device/appliance-export.js';
220
221
  export type { IBatteryOperated, IDoorbellButton, INativeSnapshot, IPanTiltZoom, IRebootable, ITwoWayAudio, } from './device/features.js';
221
222
  export type { IconCategoryId, IconEntry, IconHit, IconKey, } from './device/icon-catalog.js';
222
223
  export { ICON_CATALOG_SOURCE, ICON_CATEGORIES, ICON_ENTRIES, ICON_KEYS, ICON_VIEWER_MODULES, IconKeySchema, canonicalIconKey, iconCategoryLabel, iconEntry, iconsInCategory, isIconKey, resolveIconKey, searchIcons, } from './device/icon-catalog.js';