@camstack/types 1.2.425 → 1.2.427

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.
@@ -29,7 +29,7 @@ export declare const batteryCapability: {
29
29
  readonly scope: 'device';
30
30
  readonly deviceNative: true;
31
31
  readonly mode: 'singleton';
32
- readonly deviceTypes: readonly [DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat];
32
+ readonly deviceTypes: readonly [DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter];
33
33
  readonly methods: {
34
34
  /**
35
35
  * Explicitly wake the camera from low-power sleep ahead of a
@@ -177,7 +177,7 @@ export declare const batteryCapability: {
177
177
  readonly cap: 'battery';
178
178
  readonly stateField: 'percentage';
179
179
  };
180
- readonly deviceTypes: readonly [DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat];
180
+ readonly deviceTypes: readonly [DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter];
181
181
  readonly apply: 'add';
182
182
  readonly path: 'percentage';
183
183
  readonly sources: readonly [{
@@ -31,7 +31,7 @@ export declare const powerMeterCapability: {
31
31
  readonly scope: 'device';
32
32
  readonly deviceNative: true;
33
33
  readonly mode: 'singleton';
34
- readonly deviceTypes: readonly [DeviceType.Sensor, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher];
34
+ readonly deviceTypes: readonly [DeviceType.Sensor, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder];
35
35
  readonly methods: {};
36
36
  readonly status: {
37
37
  readonly schema: z.ZodObject<{
@@ -107,5 +107,113 @@ export declare const powerMeterCapability: {
107
107
  /** Clock fields: written, but excluded from the compare that decides
108
108
  * whether persisting is worth a SQLite commit. */
109
109
  readonly volatileStateFields: readonly ["lastFetchedAt"];
110
+ readonly customize: {
111
+ readonly version: 1;
112
+ readonly targets: readonly [{
113
+ readonly id: string;
114
+ readonly cardinality: 'scalar';
115
+ readonly vocabulary: {
116
+ readonly cap: 'power-meter';
117
+ readonly stateField: string;
118
+ };
119
+ readonly deviceTypes: (DeviceType.Light | DeviceType.Switch | DeviceType.Thermostat | DeviceType.Climate | DeviceType.Humidifier | DeviceType.WaterHeater | DeviceType.Fan | DeviceType.MediaPlayer | DeviceType.Vacuum | DeviceType.LawnMower | DeviceType.PetFeeder | DeviceType.Dishwasher | DeviceType.Washer | DeviceType.Dryer)[];
120
+ readonly apply: 'add';
121
+ readonly path: string;
122
+ readonly sources: readonly [{
123
+ readonly kind: 'numeric';
124
+ readonly requiredUnit: string;
125
+ readonly transforms: readonly [{
126
+ readonly kind: 'identity';
127
+ }];
128
+ }];
129
+ readonly companions: readonly [{
130
+ readonly kind: 'clock';
131
+ readonly path: 'lastFetchedAt';
132
+ readonly when: 'always';
133
+ }];
134
+ readonly sourceReport: {
135
+ readonly status: 'assignment-status';
136
+ };
137
+ readonly advancedExpression: true;
138
+ }, {
139
+ readonly id: string;
140
+ readonly cardinality: 'scalar';
141
+ readonly vocabulary: {
142
+ readonly cap: 'power-meter';
143
+ readonly stateField: string;
144
+ };
145
+ readonly deviceTypes: (DeviceType.Light | DeviceType.Switch | DeviceType.Thermostat | DeviceType.Climate | DeviceType.Humidifier | DeviceType.WaterHeater | DeviceType.Fan | DeviceType.MediaPlayer | DeviceType.Vacuum | DeviceType.LawnMower | DeviceType.PetFeeder | DeviceType.Dishwasher | DeviceType.Washer | DeviceType.Dryer)[];
146
+ readonly apply: 'add';
147
+ readonly path: string;
148
+ readonly sources: readonly [{
149
+ readonly kind: 'numeric';
150
+ readonly requiredUnit: string;
151
+ readonly transforms: readonly [{
152
+ readonly kind: 'identity';
153
+ }];
154
+ }];
155
+ readonly companions: readonly [{
156
+ readonly kind: 'clock';
157
+ readonly path: 'lastFetchedAt';
158
+ readonly when: 'always';
159
+ }];
160
+ readonly sourceReport: {
161
+ readonly status: 'assignment-status';
162
+ };
163
+ readonly advancedExpression: true;
164
+ }, {
165
+ readonly id: string;
166
+ readonly cardinality: 'scalar';
167
+ readonly vocabulary: {
168
+ readonly cap: 'power-meter';
169
+ readonly stateField: string;
170
+ };
171
+ readonly deviceTypes: (DeviceType.Light | DeviceType.Switch | DeviceType.Thermostat | DeviceType.Climate | DeviceType.Humidifier | DeviceType.WaterHeater | DeviceType.Fan | DeviceType.MediaPlayer | DeviceType.Vacuum | DeviceType.LawnMower | DeviceType.PetFeeder | DeviceType.Dishwasher | DeviceType.Washer | DeviceType.Dryer)[];
172
+ readonly apply: 'add';
173
+ readonly path: string;
174
+ readonly sources: readonly [{
175
+ readonly kind: 'numeric';
176
+ readonly requiredUnit: string;
177
+ readonly transforms: readonly [{
178
+ readonly kind: 'identity';
179
+ }];
180
+ }];
181
+ readonly companions: readonly [{
182
+ readonly kind: 'clock';
183
+ readonly path: 'lastFetchedAt';
184
+ readonly when: 'always';
185
+ }];
186
+ readonly sourceReport: {
187
+ readonly status: 'assignment-status';
188
+ };
189
+ readonly advancedExpression: true;
190
+ }, {
191
+ readonly id: string;
192
+ readonly cardinality: 'scalar';
193
+ readonly vocabulary: {
194
+ readonly cap: 'power-meter';
195
+ readonly stateField: string;
196
+ };
197
+ readonly deviceTypes: (DeviceType.Light | DeviceType.Switch | DeviceType.Thermostat | DeviceType.Climate | DeviceType.Humidifier | DeviceType.WaterHeater | DeviceType.Fan | DeviceType.MediaPlayer | DeviceType.Vacuum | DeviceType.LawnMower | DeviceType.PetFeeder | DeviceType.Dishwasher | DeviceType.Washer | DeviceType.Dryer)[];
198
+ readonly apply: 'add';
199
+ readonly path: string;
200
+ readonly sources: readonly [{
201
+ readonly kind: 'numeric';
202
+ readonly requiredUnit: string;
203
+ readonly transforms: readonly [{
204
+ readonly kind: 'identity';
205
+ }];
206
+ }];
207
+ readonly companions: readonly [{
208
+ readonly kind: 'clock';
209
+ readonly path: 'lastFetchedAt';
210
+ readonly when: 'always';
211
+ }];
212
+ readonly sourceReport: {
213
+ readonly status: 'assignment-status';
214
+ };
215
+ readonly advancedExpression: true;
216
+ }];
217
+ };
110
218
  };
111
219
  export type IPowerMeterProvider = InferProvider<typeof powerMeterCapability>;
@@ -0,0 +1,21 @@
1
+ import type { CompositionFieldsFeature } from '../composition.js';
2
+ /** How many scalar targets the cap declares: above one, the cap's feature is shared. */
3
+ export declare function scalarTargetCount(cap: string): number;
4
+ /**
5
+ * The cap's feature with `compiled` (one target's own feature) merged in. A cap
6
+ * with one scalar target is replaced whole, as before.
7
+ */
8
+ export declare function mergeScalarTarget(current: CompositionFieldsFeature | null, compiled: CompositionFieldsFeature, cap: string, targetId: string): CompositionFieldsFeature;
9
+ /** The cap's feature without `targetId`'s paths; null when no target value is left. */
10
+ export declare function removeScalarTarget(current: CompositionFieldsFeature | null, cap: string, targetId: string): CompositionFieldsFeature | null;
11
+ /**
12
+ * The part of a stored feature one target owns — what a decode compares with
13
+ * its recompiled feature. A cap with one target compares the whole feature.
14
+ */
15
+ export declare function ownedSlice(stored: CompositionFieldsFeature, cap: string, targetId: string): CompositionFieldsFeature;
16
+ /**
17
+ * The stored feature as ONE target sees it: null when the cap's feature holds
18
+ * only its neighbours' readings (no assignment of this target), else the whole
19
+ * feature. A cap with one target sees what is stored.
20
+ */
21
+ export declare function targetFeature(stored: CompositionFieldsFeature | null, cap: string, targetId: string): CompositionFieldsFeature | null;
@@ -1,7 +1,7 @@
1
1
  import { DeviceType } from '../device/device-type.js';
2
2
  /**
3
3
  * Customize catalog, projected from every `*.cap.ts` `customize` block.
4
- * 5 caps. Field keys are `runtimeState` paths. No Zod.
4
+ * 6 caps. Field keys are `runtimeState` paths. No Zod.
5
5
  */
6
6
  export declare const CAP_CUSTOMIZE_CATALOG: {
7
7
  readonly battery: {
@@ -9,7 +9,7 @@ export declare const CAP_CUSTOMIZE_CATALOG: {
9
9
  readonly targets: readonly [{
10
10
  readonly id: 'percentage';
11
11
  readonly cardinality: 'scalar';
12
- readonly deviceTypes: readonly [DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat];
12
+ readonly deviceTypes: readonly [DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter];
13
13
  readonly apply: 'add';
14
14
  readonly vocabularyCap: 'battery';
15
15
  readonly vocabularyStateField: 'percentage';
@@ -206,6 +206,118 @@ export declare const CAP_CUSTOMIZE_CATALOG: {
206
206
  readonly sourceModes: readonly ["in-addition", "confirm", "replace"];
207
207
  }];
208
208
  };
209
+ readonly 'power-meter': {
210
+ readonly version: 1;
211
+ readonly targets: readonly [{
212
+ readonly id: 'watts';
213
+ readonly cardinality: 'scalar';
214
+ readonly deviceTypes: readonly [DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder];
215
+ readonly apply: 'add';
216
+ readonly vocabularyCap: 'power-meter';
217
+ readonly vocabularyStateField: 'watts';
218
+ readonly sources: readonly [{
219
+ readonly kind: 'numeric';
220
+ readonly requiredUnit: 'W';
221
+ readonly transformKinds: readonly ["identity"];
222
+ readonly transforms: readonly [{
223
+ readonly kind: 'identity';
224
+ }];
225
+ }];
226
+ readonly sourceReport: {
227
+ readonly status: 'assignment-status';
228
+ };
229
+ readonly advancedExpression: true;
230
+ readonly path: 'watts';
231
+ readonly valueKind: 'number';
232
+ readonly nullable: false;
233
+ readonly companions: readonly [{
234
+ readonly kind: 'clock';
235
+ readonly path: 'lastFetchedAt';
236
+ readonly when: 'always';
237
+ }];
238
+ }, {
239
+ readonly id: 'kwhTotal';
240
+ readonly cardinality: 'scalar';
241
+ readonly deviceTypes: readonly [DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder];
242
+ readonly apply: 'add';
243
+ readonly vocabularyCap: 'power-meter';
244
+ readonly vocabularyStateField: 'kwhTotal';
245
+ readonly sources: readonly [{
246
+ readonly kind: 'numeric';
247
+ readonly requiredUnit: 'kWh';
248
+ readonly transformKinds: readonly ["identity"];
249
+ readonly transforms: readonly [{
250
+ readonly kind: 'identity';
251
+ }];
252
+ }];
253
+ readonly sourceReport: {
254
+ readonly status: 'assignment-status';
255
+ };
256
+ readonly advancedExpression: true;
257
+ readonly path: 'kwhTotal';
258
+ readonly valueKind: 'number';
259
+ readonly nullable: false;
260
+ readonly companions: readonly [{
261
+ readonly kind: 'clock';
262
+ readonly path: 'lastFetchedAt';
263
+ readonly when: 'always';
264
+ }];
265
+ }, {
266
+ readonly id: 'volts';
267
+ readonly cardinality: 'scalar';
268
+ readonly deviceTypes: readonly [DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder];
269
+ readonly apply: 'add';
270
+ readonly vocabularyCap: 'power-meter';
271
+ readonly vocabularyStateField: 'volts';
272
+ readonly sources: readonly [{
273
+ readonly kind: 'numeric';
274
+ readonly requiredUnit: 'V';
275
+ readonly transformKinds: readonly ["identity"];
276
+ readonly transforms: readonly [{
277
+ readonly kind: 'identity';
278
+ }];
279
+ }];
280
+ readonly sourceReport: {
281
+ readonly status: 'assignment-status';
282
+ };
283
+ readonly advancedExpression: true;
284
+ readonly path: 'volts';
285
+ readonly valueKind: 'number';
286
+ readonly nullable: false;
287
+ readonly companions: readonly [{
288
+ readonly kind: 'clock';
289
+ readonly path: 'lastFetchedAt';
290
+ readonly when: 'always';
291
+ }];
292
+ }, {
293
+ readonly id: 'amps';
294
+ readonly cardinality: 'scalar';
295
+ readonly deviceTypes: readonly [DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder];
296
+ readonly apply: 'add';
297
+ readonly vocabularyCap: 'power-meter';
298
+ readonly vocabularyStateField: 'amps';
299
+ readonly sources: readonly [{
300
+ readonly kind: 'numeric';
301
+ readonly requiredUnit: 'A';
302
+ readonly transformKinds: readonly ["identity"];
303
+ readonly transforms: readonly [{
304
+ readonly kind: 'identity';
305
+ }];
306
+ }];
307
+ readonly sourceReport: {
308
+ readonly status: 'assignment-status';
309
+ };
310
+ readonly advancedExpression: true;
311
+ readonly path: 'amps';
312
+ readonly valueKind: 'number';
313
+ readonly nullable: false;
314
+ readonly companions: readonly [{
315
+ readonly kind: 'clock';
316
+ readonly path: 'lastFetchedAt';
317
+ readonly when: 'always';
318
+ }];
319
+ }];
320
+ };
209
321
  readonly 'running-state': {
210
322
  readonly version: 1;
211
323
  readonly targets: readonly [{
package/dist/index.d.ts CHANGED
@@ -268,6 +268,7 @@ export type { CapabilityCustomizeSpec, CapabilityCustomizeTarget, CustomizeCardi
268
268
  export { CustomizeAssignmentStatusSchema, OverrideDraftSchema, type CustomizeAssignmentStatus, type OverrideDraft, } from './composition/customize/override-draft.js';
269
269
  export { compileScalarOverride, type ScalarCompileInput, type ScalarValueKind, } from './composition/customize/scalar-compile.js';
270
270
  export { decodeScalarOverride, type ScalarDecoded, type ScalarDecodeInput, } from './composition/customize/scalar-decode.js';
271
+ export { mergeScalarTarget, targetFeature, ownedSlice, removeScalarTarget, scalarTargetCount, } from './composition/customize/scalar-merge.js';
271
272
  export { projectScalarAssignment, type ScalarAssignmentProjection, type ScalarRead, type ScalarSourcePresence, type ScalarStatusInput, } from './composition/customize/scalar-status.js';
272
273
  export { compilePulseOverride, compileSpanOverride, type PulseCompileInput, type SpanCompileInput, type SpanCompiled, } from './composition/customize/event-compile.js';
273
274
  export { decodePulseOverride, type PulseDecodeInput, type PulseDecoded, } from './composition/customize/event-decode.js';