@camstack/addon-model-studio 1.1.322 → 1.1.323
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 +6 -0
- package/dist/{MotionZonesSettings-DIoKHy61.mjs → MotionZonesSettings-CBVJdmZ_.mjs} +2 -2
- package/dist/{PrivacyMaskSettings-SkRUYyni.mjs → PrivacyMaskSettings-CFuZa1xW.mjs} +4 -4
- package/dist/{SceneMonitorEditor-CB_GHDb6.mjs → SceneMonitorEditor-DHYl0WUF.mjs} +3 -3
- package/dist/_stub.js +1297 -1263
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_model_studio_page-onE-V79z.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_model_studio_page-DiTB72W6.mjs} +3 -3
- package/dist/{_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Dt_IlI_h.mjs → _virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-B3TmOWWR.mjs} +1 -1
- package/dist/{hostInit-DvZygcN-.mjs → hostInit-BL6ZxXXr.mjs} +2 -2
- package/dist/model-studio.addon.js +518 -61
- package/dist/model-studio.addon.mjs +518 -61
- package/dist/{player-overlays-_zERIZfO.mjs → player-overlays-CDEmtjZg.mjs} +1 -1
- package/dist/remoteEntry.js +1 -1
- package/dist/{responsive-CFFPG77U.mjs → responsive-B_pKmFhb.mjs} +1 -1
- package/dist/{scene-monitor-copy-DEJ23ZZg.mjs → scene-monitor-copy-KV9Ti6_0.mjs} +1 -1
- package/dist/{square-Prn9rHwz.mjs → square-ByW1TPIi.mjs} +1 -1
- package/dist/{trash-2-Ddf3KFsK.mjs → trash-2-9gFkA-Zu.mjs} +1 -1
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_model_studio_page__remoteEntry_js-DDvX_rph.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_model_studio_page__remoteEntry_js-B880BvK0.mjs} +1 -1
- package/package.json +1 -1
|
@@ -16068,6 +16068,478 @@ object({
|
|
|
16068
16068
|
path: ["expr"]
|
|
16069
16069
|
});
|
|
16070
16070
|
});
|
|
16071
|
+
/**
|
|
16072
|
+
* Identity envelope for a device's upstream-system metadata.
|
|
16073
|
+
*
|
|
16074
|
+
* Two jobs:
|
|
16075
|
+
*
|
|
16076
|
+
* 1. **Dispatch key.** `id` is the natural identifier the SOURCE system
|
|
16077
|
+
* uses to address this device (HA `entity_id`, Reolink MAC, ONVIF
|
|
16078
|
+
* WS-Discovery endpoint UUID, …). Provider code keeps a
|
|
16079
|
+
* `Map<sourceInfo.id, IDevice>` to route inbound push events in O(1)
|
|
16080
|
+
* without round-tripping through `stableId` / `id` mappings.
|
|
16081
|
+
*
|
|
16082
|
+
* 2. **Stability bridge.** `uniqueId` is the *immutable* upstream id when
|
|
16083
|
+
* one exists (HA `entity.unique_id`, Reolink MAC again — same as `id`
|
|
16084
|
+
* for vendors where MAC is the natural key). For systems where the
|
|
16085
|
+
* live dispatch key can be renamed (HA `entity_id` can be edited),
|
|
16086
|
+
* providers detect renames by matching `uniqueId` and patch `id`
|
|
16087
|
+
* in-place so dispatch keeps working.
|
|
16088
|
+
*
|
|
16089
|
+
* **Display unit and precision are NOT stored here.** They are a read-time
|
|
16090
|
+
* preference (D944). A polymorphic reading stores its `quantity` here once,
|
|
16091
|
+
* at adopt, and a date/time value stores `dateTimeShape` the same way —
|
|
16092
|
+
* neither is repeated on each sample. The `device_class` tag is an
|
|
16093
|
+
* HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
|
|
16094
|
+
* to derive the CamStack `DeviceRole`; it is never stored after that point.
|
|
16095
|
+
*
|
|
16096
|
+
* The `raw` escape hatch carries provider-specific attributes that don't
|
|
16097
|
+
* fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
|
|
16098
|
+
* details, …). Providers control what lands here.
|
|
16099
|
+
*/
|
|
16100
|
+
var SourceInfoSchema = object({
|
|
16101
|
+
/** Live dispatch key — mutable when the source system allows rename. */
|
|
16102
|
+
id: string(),
|
|
16103
|
+
/** Source system tag — e.g. 'homeassistant' | 'reolink' | 'onvif'. */
|
|
16104
|
+
system: string(),
|
|
16105
|
+
/** Immutable upstream identifier when available (HA `unique_id`, … ).
|
|
16106
|
+
* Used to detect rename when `id` changes. */
|
|
16107
|
+
uniqueId: string().optional(),
|
|
16108
|
+
/** Quantity of a polymorphic reading, written once at adopt (D944). */
|
|
16109
|
+
quantity: ReadingQuantitySchema.optional(),
|
|
16110
|
+
/** Date / time / datetime shape of a string reading, written once at adopt. */
|
|
16111
|
+
dateTimeShape: _enum([
|
|
16112
|
+
"date",
|
|
16113
|
+
"time",
|
|
16114
|
+
"datetime"
|
|
16115
|
+
]).optional(),
|
|
16116
|
+
/** Provider-specific extras that don't fit the structured slots.
|
|
16117
|
+
* Whitelist what goes here per provider — do NOT dump entire HA
|
|
16118
|
+
* attribute blobs (would explode the meta JSON column). */
|
|
16119
|
+
raw: record(string(), unknown()).optional()
|
|
16120
|
+
});
|
|
16121
|
+
/**
|
|
16122
|
+
* Frozen unit → spec table. `•` in the doc marks each dimension's canonical
|
|
16123
|
+
* unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
|
|
16124
|
+
* `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
|
|
16125
|
+
* decimals). K derives from `°C = K − 273.15`.
|
|
16126
|
+
*/
|
|
16127
|
+
var UNIT_TABLE = {
|
|
16128
|
+
"°C": {
|
|
16129
|
+
dimension: "temperature",
|
|
16130
|
+
factor: 1,
|
|
16131
|
+
offset: 0
|
|
16132
|
+
},
|
|
16133
|
+
"°F": {
|
|
16134
|
+
dimension: "temperature",
|
|
16135
|
+
factor: 5 / 9,
|
|
16136
|
+
offset: -160 / 9
|
|
16137
|
+
},
|
|
16138
|
+
K: {
|
|
16139
|
+
dimension: "temperature",
|
|
16140
|
+
factor: 1,
|
|
16141
|
+
offset: -273.15
|
|
16142
|
+
},
|
|
16143
|
+
hPa: {
|
|
16144
|
+
dimension: "pressure",
|
|
16145
|
+
factor: 1,
|
|
16146
|
+
offset: 0
|
|
16147
|
+
},
|
|
16148
|
+
kPa: {
|
|
16149
|
+
dimension: "pressure",
|
|
16150
|
+
factor: 10,
|
|
16151
|
+
offset: 0
|
|
16152
|
+
},
|
|
16153
|
+
Pa: {
|
|
16154
|
+
dimension: "pressure",
|
|
16155
|
+
factor: .01,
|
|
16156
|
+
offset: 0
|
|
16157
|
+
},
|
|
16158
|
+
mbar: {
|
|
16159
|
+
dimension: "pressure",
|
|
16160
|
+
factor: 1,
|
|
16161
|
+
offset: 0
|
|
16162
|
+
},
|
|
16163
|
+
bar: {
|
|
16164
|
+
dimension: "pressure",
|
|
16165
|
+
factor: 1e3,
|
|
16166
|
+
offset: 0
|
|
16167
|
+
},
|
|
16168
|
+
inHg: {
|
|
16169
|
+
dimension: "pressure",
|
|
16170
|
+
factor: 33.8639,
|
|
16171
|
+
offset: 0
|
|
16172
|
+
},
|
|
16173
|
+
mmHg: {
|
|
16174
|
+
dimension: "pressure",
|
|
16175
|
+
factor: 1.33322,
|
|
16176
|
+
offset: 0
|
|
16177
|
+
},
|
|
16178
|
+
psi: {
|
|
16179
|
+
dimension: "pressure",
|
|
16180
|
+
factor: 68.9476,
|
|
16181
|
+
offset: 0
|
|
16182
|
+
},
|
|
16183
|
+
"m/s": {
|
|
16184
|
+
dimension: "speed",
|
|
16185
|
+
factor: 1,
|
|
16186
|
+
offset: 0
|
|
16187
|
+
},
|
|
16188
|
+
"km/h": {
|
|
16189
|
+
dimension: "speed",
|
|
16190
|
+
factor: 1 / 3.6,
|
|
16191
|
+
offset: 0
|
|
16192
|
+
},
|
|
16193
|
+
mph: {
|
|
16194
|
+
dimension: "speed",
|
|
16195
|
+
factor: .44704,
|
|
16196
|
+
offset: 0
|
|
16197
|
+
},
|
|
16198
|
+
kn: {
|
|
16199
|
+
dimension: "speed",
|
|
16200
|
+
factor: .514444,
|
|
16201
|
+
offset: 0
|
|
16202
|
+
},
|
|
16203
|
+
"mm/h": {
|
|
16204
|
+
dimension: "precipitation-rate",
|
|
16205
|
+
factor: 1,
|
|
16206
|
+
offset: 0
|
|
16207
|
+
},
|
|
16208
|
+
"in/h": {
|
|
16209
|
+
dimension: "precipitation-rate",
|
|
16210
|
+
factor: 25.4,
|
|
16211
|
+
offset: 0
|
|
16212
|
+
},
|
|
16213
|
+
m: {
|
|
16214
|
+
dimension: "length",
|
|
16215
|
+
factor: 1,
|
|
16216
|
+
offset: 0
|
|
16217
|
+
},
|
|
16218
|
+
mm: {
|
|
16219
|
+
dimension: "length",
|
|
16220
|
+
factor: .001,
|
|
16221
|
+
offset: 0
|
|
16222
|
+
},
|
|
16223
|
+
cm: {
|
|
16224
|
+
dimension: "length",
|
|
16225
|
+
factor: .01,
|
|
16226
|
+
offset: 0
|
|
16227
|
+
},
|
|
16228
|
+
km: {
|
|
16229
|
+
dimension: "length",
|
|
16230
|
+
factor: 1e3,
|
|
16231
|
+
offset: 0
|
|
16232
|
+
},
|
|
16233
|
+
in: {
|
|
16234
|
+
dimension: "length",
|
|
16235
|
+
factor: .0254,
|
|
16236
|
+
offset: 0
|
|
16237
|
+
},
|
|
16238
|
+
ft: {
|
|
16239
|
+
dimension: "length",
|
|
16240
|
+
factor: .3048,
|
|
16241
|
+
offset: 0
|
|
16242
|
+
},
|
|
16243
|
+
mi: {
|
|
16244
|
+
dimension: "length",
|
|
16245
|
+
factor: 1609.344,
|
|
16246
|
+
offset: 0
|
|
16247
|
+
},
|
|
16248
|
+
"m²": {
|
|
16249
|
+
dimension: "area",
|
|
16250
|
+
factor: 1,
|
|
16251
|
+
offset: 0
|
|
16252
|
+
},
|
|
16253
|
+
lx: {
|
|
16254
|
+
dimension: "illuminance",
|
|
16255
|
+
factor: 1,
|
|
16256
|
+
offset: 0
|
|
16257
|
+
},
|
|
16258
|
+
"W/m²": {
|
|
16259
|
+
dimension: "irradiance",
|
|
16260
|
+
factor: 1,
|
|
16261
|
+
offset: 0
|
|
16262
|
+
},
|
|
16263
|
+
W: {
|
|
16264
|
+
dimension: "power",
|
|
16265
|
+
factor: 1,
|
|
16266
|
+
offset: 0
|
|
16267
|
+
},
|
|
16268
|
+
kW: {
|
|
16269
|
+
dimension: "power",
|
|
16270
|
+
factor: 1e3,
|
|
16271
|
+
offset: 0
|
|
16272
|
+
},
|
|
16273
|
+
VA: {
|
|
16274
|
+
dimension: "apparent-power",
|
|
16275
|
+
factor: 1,
|
|
16276
|
+
offset: 0
|
|
16277
|
+
},
|
|
16278
|
+
Wh: {
|
|
16279
|
+
dimension: "energy",
|
|
16280
|
+
factor: 1,
|
|
16281
|
+
offset: 0
|
|
16282
|
+
},
|
|
16283
|
+
kWh: {
|
|
16284
|
+
dimension: "energy",
|
|
16285
|
+
factor: 1e3,
|
|
16286
|
+
offset: 0
|
|
16287
|
+
},
|
|
16288
|
+
MWh: {
|
|
16289
|
+
dimension: "energy",
|
|
16290
|
+
factor: 1e6,
|
|
16291
|
+
offset: 0
|
|
16292
|
+
},
|
|
16293
|
+
V: {
|
|
16294
|
+
dimension: "voltage",
|
|
16295
|
+
factor: 1,
|
|
16296
|
+
offset: 0
|
|
16297
|
+
},
|
|
16298
|
+
mV: {
|
|
16299
|
+
dimension: "voltage",
|
|
16300
|
+
factor: .001,
|
|
16301
|
+
offset: 0
|
|
16302
|
+
},
|
|
16303
|
+
A: {
|
|
16304
|
+
dimension: "current",
|
|
16305
|
+
factor: 1,
|
|
16306
|
+
offset: 0
|
|
16307
|
+
},
|
|
16308
|
+
mA: {
|
|
16309
|
+
dimension: "current",
|
|
16310
|
+
factor: .001,
|
|
16311
|
+
offset: 0
|
|
16312
|
+
},
|
|
16313
|
+
ppm: {
|
|
16314
|
+
dimension: "concentration-volume",
|
|
16315
|
+
factor: 1,
|
|
16316
|
+
offset: 0
|
|
16317
|
+
},
|
|
16318
|
+
ppb: {
|
|
16319
|
+
dimension: "concentration-volume",
|
|
16320
|
+
factor: .001,
|
|
16321
|
+
offset: 0
|
|
16322
|
+
},
|
|
16323
|
+
"µg/m³": {
|
|
16324
|
+
dimension: "concentration-mass",
|
|
16325
|
+
factor: 1,
|
|
16326
|
+
offset: 0
|
|
16327
|
+
},
|
|
16328
|
+
"mg/m³": {
|
|
16329
|
+
dimension: "concentration-mass",
|
|
16330
|
+
factor: 1e3,
|
|
16331
|
+
offset: 0
|
|
16332
|
+
},
|
|
16333
|
+
kg: {
|
|
16334
|
+
dimension: "mass",
|
|
16335
|
+
factor: 1,
|
|
16336
|
+
offset: 0
|
|
16337
|
+
},
|
|
16338
|
+
g: {
|
|
16339
|
+
dimension: "mass",
|
|
16340
|
+
factor: .001,
|
|
16341
|
+
offset: 0
|
|
16342
|
+
},
|
|
16343
|
+
lb: {
|
|
16344
|
+
dimension: "mass",
|
|
16345
|
+
factor: .453592,
|
|
16346
|
+
offset: 0
|
|
16347
|
+
},
|
|
16348
|
+
oz: {
|
|
16349
|
+
dimension: "mass",
|
|
16350
|
+
factor: .0283495,
|
|
16351
|
+
offset: 0
|
|
16352
|
+
},
|
|
16353
|
+
"%": {
|
|
16354
|
+
dimension: "percentage",
|
|
16355
|
+
factor: 1,
|
|
16356
|
+
offset: 0
|
|
16357
|
+
},
|
|
16358
|
+
L: {
|
|
16359
|
+
dimension: "volume",
|
|
16360
|
+
factor: 1,
|
|
16361
|
+
offset: 0
|
|
16362
|
+
},
|
|
16363
|
+
mL: {
|
|
16364
|
+
dimension: "volume",
|
|
16365
|
+
factor: .001,
|
|
16366
|
+
offset: 0
|
|
16367
|
+
},
|
|
16368
|
+
gal: {
|
|
16369
|
+
dimension: "volume",
|
|
16370
|
+
factor: 3.785411784,
|
|
16371
|
+
offset: 0
|
|
16372
|
+
},
|
|
16373
|
+
s: {
|
|
16374
|
+
dimension: "duration",
|
|
16375
|
+
factor: 1,
|
|
16376
|
+
offset: 0
|
|
16377
|
+
},
|
|
16378
|
+
ms: {
|
|
16379
|
+
dimension: "duration",
|
|
16380
|
+
factor: .001,
|
|
16381
|
+
offset: 0
|
|
16382
|
+
},
|
|
16383
|
+
min: {
|
|
16384
|
+
dimension: "duration",
|
|
16385
|
+
factor: 60,
|
|
16386
|
+
offset: 0
|
|
16387
|
+
},
|
|
16388
|
+
h: {
|
|
16389
|
+
dimension: "duration",
|
|
16390
|
+
factor: 3600,
|
|
16391
|
+
offset: 0
|
|
16392
|
+
},
|
|
16393
|
+
d: {
|
|
16394
|
+
dimension: "duration",
|
|
16395
|
+
factor: 86400,
|
|
16396
|
+
offset: 0
|
|
16397
|
+
},
|
|
16398
|
+
B: {
|
|
16399
|
+
dimension: "information",
|
|
16400
|
+
factor: 1,
|
|
16401
|
+
offset: 0
|
|
16402
|
+
},
|
|
16403
|
+
KiB: {
|
|
16404
|
+
dimension: "information",
|
|
16405
|
+
factor: 1024,
|
|
16406
|
+
offset: 0
|
|
16407
|
+
},
|
|
16408
|
+
MiB: {
|
|
16409
|
+
dimension: "information",
|
|
16410
|
+
factor: 1024 ** 2,
|
|
16411
|
+
offset: 0
|
|
16412
|
+
},
|
|
16413
|
+
GiB: {
|
|
16414
|
+
dimension: "information",
|
|
16415
|
+
factor: 1024 ** 3,
|
|
16416
|
+
offset: 0
|
|
16417
|
+
},
|
|
16418
|
+
TiB: {
|
|
16419
|
+
dimension: "information",
|
|
16420
|
+
factor: 1024 ** 4,
|
|
16421
|
+
offset: 0
|
|
16422
|
+
},
|
|
16423
|
+
kB: {
|
|
16424
|
+
dimension: "information",
|
|
16425
|
+
factor: 1e3,
|
|
16426
|
+
offset: 0
|
|
16427
|
+
},
|
|
16428
|
+
MB: {
|
|
16429
|
+
dimension: "information",
|
|
16430
|
+
factor: 1e6,
|
|
16431
|
+
offset: 0
|
|
16432
|
+
},
|
|
16433
|
+
GB: {
|
|
16434
|
+
dimension: "information",
|
|
16435
|
+
factor: 1e9,
|
|
16436
|
+
offset: 0
|
|
16437
|
+
},
|
|
16438
|
+
"°": {
|
|
16439
|
+
dimension: "angle",
|
|
16440
|
+
factor: 1,
|
|
16441
|
+
offset: 0
|
|
16442
|
+
},
|
|
16443
|
+
dBFS: {
|
|
16444
|
+
dimension: "sound-level",
|
|
16445
|
+
factor: 1,
|
|
16446
|
+
offset: 0
|
|
16447
|
+
},
|
|
16448
|
+
dBm: {
|
|
16449
|
+
dimension: "signal-level",
|
|
16450
|
+
factor: 1,
|
|
16451
|
+
offset: 0
|
|
16452
|
+
},
|
|
16453
|
+
mired: {
|
|
16454
|
+
dimension: "colour-temperature",
|
|
16455
|
+
factor: 1,
|
|
16456
|
+
offset: 0
|
|
16457
|
+
},
|
|
16458
|
+
kbps: {
|
|
16459
|
+
dimension: "bitrate",
|
|
16460
|
+
factor: 1,
|
|
16461
|
+
offset: 0
|
|
16462
|
+
},
|
|
16463
|
+
Mbps: {
|
|
16464
|
+
dimension: "bitrate",
|
|
16465
|
+
factor: 1e3,
|
|
16466
|
+
offset: 0
|
|
16467
|
+
},
|
|
16468
|
+
fps: {
|
|
16469
|
+
dimension: "rate",
|
|
16470
|
+
factor: 1,
|
|
16471
|
+
offset: 0
|
|
16472
|
+
}
|
|
16473
|
+
};
|
|
16474
|
+
/** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
|
|
16475
|
+
function specFor(unit) {
|
|
16476
|
+
return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
|
|
16477
|
+
}
|
|
16478
|
+
/** Value in `spec`'s unit → its dimension's canonical unit. */
|
|
16479
|
+
function toCanonical(value, spec) {
|
|
16480
|
+
return value * spec.factor + spec.offset;
|
|
16481
|
+
}
|
|
16482
|
+
/** Canonical-unit value → the unit described by `spec`. */
|
|
16483
|
+
function fromCanonical(canonical, spec) {
|
|
16484
|
+
return (canonical - spec.offset) / spec.factor;
|
|
16485
|
+
}
|
|
16486
|
+
/**
|
|
16487
|
+
* Graceful variant for the render path: returns the converted value, or
|
|
16488
|
+
* `undefined` when the conversion is refused (unknown unit / cross-dimension).
|
|
16489
|
+
* Never throws — a render caller falls back to the raw value + source unit.
|
|
16490
|
+
*/
|
|
16491
|
+
function tryConvertUnit(value, from, to) {
|
|
16492
|
+
if (from === to) return value;
|
|
16493
|
+
const fromSpec = specFor(from);
|
|
16494
|
+
if (!fromSpec) return void 0;
|
|
16495
|
+
const toSpec = specFor(to);
|
|
16496
|
+
if (!toSpec) return void 0;
|
|
16497
|
+
if (fromSpec.dimension !== toSpec.dimension) return void 0;
|
|
16498
|
+
return fromCanonical(toCanonical(value, fromSpec), toSpec);
|
|
16499
|
+
}
|
|
16500
|
+
/**
|
|
16501
|
+
* A number a person types for a physical quantity — the input side of the
|
|
16502
|
+
* value + unit contract (D972).
|
|
16503
|
+
*
|
|
16504
|
+
* Readings are stored in the base unit of their quantity (D944); a cap method
|
|
16505
|
+
* param is stored in the unit its input schema DECLARES (`paramMeta`). The
|
|
16506
|
+
* wire pair {@link QuantityValue} says "this number is expressed in this
|
|
16507
|
+
* unit"; {@link convertQuantityInput} brings it to the stored unit and refuses,
|
|
16508
|
+
* with a typed {@link QuantityUnitError}, a unit that cannot be that quantity.
|
|
16509
|
+
*/
|
|
16510
|
+
/** A unit that cannot be applied to the number it was given with. */
|
|
16511
|
+
var QuantityUnitError = class extends Error {
|
|
16512
|
+
code;
|
|
16513
|
+
constructor(code, message) {
|
|
16514
|
+
super(`[${code}] ${message}`);
|
|
16515
|
+
this.name = "QuantityUnitError";
|
|
16516
|
+
this.code = code;
|
|
16517
|
+
}
|
|
16518
|
+
};
|
|
16519
|
+
/** The wire pair: `value` is expressed in `unit`. */
|
|
16520
|
+
var QuantityValueSchema = object({
|
|
16521
|
+
value: number(),
|
|
16522
|
+
unit: string().min(1)
|
|
16523
|
+
});
|
|
16524
|
+
/**
|
|
16525
|
+
* Zod `.meta()` bag for a cap METHOD param that is a physical quantity — the
|
|
16526
|
+
* input-side twin of `readingMeta`. The value is carried in `unit` (a gram
|
|
16527
|
+
* portion stays in grams); the unit must belong to the quantity, checked once
|
|
16528
|
+
* when the cap is declared.
|
|
16529
|
+
*/
|
|
16530
|
+
function paramMeta(declared) {
|
|
16531
|
+
const base = baseUnitOf(declared.quantity);
|
|
16532
|
+
if (base === void 0) throw new QuantityUnitError("unknown-unit", `quantity "${declared.quantity}" has no unit`);
|
|
16533
|
+
if (tryConvertUnit(1, declared.unit, base) === void 0) throw new QuantityUnitError("cross-dimension", `"${declared.unit}" is not a unit of ${declared.quantity}`);
|
|
16534
|
+
return {
|
|
16535
|
+
quantity: declared.quantity,
|
|
16536
|
+
unit: declared.unit
|
|
16537
|
+
};
|
|
16538
|
+
}
|
|
16539
|
+
object({
|
|
16540
|
+
quantity: ReadingQuantitySchema,
|
|
16541
|
+
unit: string().min(1)
|
|
16542
|
+
});
|
|
16071
16543
|
/** How a leaf compares a device field to a value. Derived from the field's
|
|
16072
16544
|
* `kind` in `deviceManager.getWireableFields`, never hand-maintained. */
|
|
16073
16545
|
var AutomationConditionOperatorSchema = _enum([
|
|
@@ -16090,8 +16562,10 @@ var AutomationConditionLeafSchema = object({
|
|
|
16090
16562
|
string(),
|
|
16091
16563
|
number(),
|
|
16092
16564
|
boolean(),
|
|
16093
|
-
array(union([string(), number()]))
|
|
16094
|
-
|
|
16565
|
+
array(union([string(), number()])),
|
|
16566
|
+
QuantityValueSchema
|
|
16567
|
+
]),
|
|
16568
|
+
unit: string().min(1).optional()
|
|
16095
16569
|
});
|
|
16096
16570
|
var AutomationConditionStationaryPresentSchema = object({
|
|
16097
16571
|
kind: literal("stationary-present"),
|
|
@@ -16244,7 +16718,13 @@ var AutomationCapStepSchema = object({
|
|
|
16244
16718
|
/** Values may carry `{{vars.x}}` slots, or be exactly `{ $var: 'name' }`, which
|
|
16245
16719
|
* SUBSTITUTE and do not evaluate (§3.2.3). Anything beyond substitution is
|
|
16246
16720
|
* the expression leaf. */
|
|
16247
|
-
args: record(string(), unknown()).optional()
|
|
16721
|
+
args: record(string(), unknown()).optional(),
|
|
16722
|
+
/**
|
|
16723
|
+
* The unit the person picked per arg (display only). `args` always hold the
|
|
16724
|
+
* value in the unit the method's input DECLARES (`paramMeta`); on a write an
|
|
16725
|
+
* arg may be a {@link QuantityValue}, which the save boundary converts.
|
|
16726
|
+
*/
|
|
16727
|
+
argUnits: record(string(), string().min(1)).optional()
|
|
16248
16728
|
});
|
|
16249
16729
|
/**
|
|
16250
16730
|
* The steps an internal Action may contain: cap and wait, and nothing that can
|
|
@@ -16624,6 +17104,16 @@ object({
|
|
|
16624
17104
|
lastRunAt: number().nullable(),
|
|
16625
17105
|
lastError: string().nullable()
|
|
16626
17106
|
});
|
|
17107
|
+
/** A bare number accepted as a base unit — the save succeeded, say so. */
|
|
17108
|
+
var UnitWarningSchema = object({
|
|
17109
|
+
/** Where in the saved record, e.g. `conditions.children.0` or `steps.2.args.grams`. */
|
|
17110
|
+
path: string(),
|
|
17111
|
+
deviceId: number().int().optional(),
|
|
17112
|
+
field: string(),
|
|
17113
|
+
value: number(),
|
|
17114
|
+
assumedUnit: string(),
|
|
17115
|
+
message: string()
|
|
17116
|
+
});
|
|
16627
17117
|
/**
|
|
16628
17118
|
* notification-output — canonical, capability-gated notification delivery.
|
|
16629
17119
|
*
|
|
@@ -21996,56 +22486,6 @@ var DeviceAdminLinkSchema = object({
|
|
|
21996
22486
|
});
|
|
21997
22487
|
method(object({ deviceId: number().int().nonnegative() }), DeviceAdminLinkSchema.nullable(), { auth: "admin" });
|
|
21998
22488
|
/**
|
|
21999
|
-
* Identity envelope for a device's upstream-system metadata.
|
|
22000
|
-
*
|
|
22001
|
-
* Two jobs:
|
|
22002
|
-
*
|
|
22003
|
-
* 1. **Dispatch key.** `id` is the natural identifier the SOURCE system
|
|
22004
|
-
* uses to address this device (HA `entity_id`, Reolink MAC, ONVIF
|
|
22005
|
-
* WS-Discovery endpoint UUID, …). Provider code keeps a
|
|
22006
|
-
* `Map<sourceInfo.id, IDevice>` to route inbound push events in O(1)
|
|
22007
|
-
* without round-tripping through `stableId` / `id` mappings.
|
|
22008
|
-
*
|
|
22009
|
-
* 2. **Stability bridge.** `uniqueId` is the *immutable* upstream id when
|
|
22010
|
-
* one exists (HA `entity.unique_id`, Reolink MAC again — same as `id`
|
|
22011
|
-
* for vendors where MAC is the natural key). For systems where the
|
|
22012
|
-
* live dispatch key can be renamed (HA `entity_id` can be edited),
|
|
22013
|
-
* providers detect renames by matching `uniqueId` and patch `id`
|
|
22014
|
-
* in-place so dispatch keeps working.
|
|
22015
|
-
*
|
|
22016
|
-
* **Display unit and precision are NOT stored here.** They are a read-time
|
|
22017
|
-
* preference (D944). A polymorphic reading stores its `quantity` here once,
|
|
22018
|
-
* at adopt, and a date/time value stores `dateTimeShape` the same way —
|
|
22019
|
-
* neither is repeated on each sample. The `device_class` tag is an
|
|
22020
|
-
* HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
|
|
22021
|
-
* to derive the CamStack `DeviceRole`; it is never stored after that point.
|
|
22022
|
-
*
|
|
22023
|
-
* The `raw` escape hatch carries provider-specific attributes that don't
|
|
22024
|
-
* fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
|
|
22025
|
-
* details, …). Providers control what lands here.
|
|
22026
|
-
*/
|
|
22027
|
-
var SourceInfoSchema = object({
|
|
22028
|
-
/** Live dispatch key — mutable when the source system allows rename. */
|
|
22029
|
-
id: string(),
|
|
22030
|
-
/** Source system tag — e.g. 'homeassistant' | 'reolink' | 'onvif'. */
|
|
22031
|
-
system: string(),
|
|
22032
|
-
/** Immutable upstream identifier when available (HA `unique_id`, … ).
|
|
22033
|
-
* Used to detect rename when `id` changes. */
|
|
22034
|
-
uniqueId: string().optional(),
|
|
22035
|
-
/** Quantity of a polymorphic reading, written once at adopt (D944). */
|
|
22036
|
-
quantity: ReadingQuantitySchema.optional(),
|
|
22037
|
-
/** Date / time / datetime shape of a string reading, written once at adopt. */
|
|
22038
|
-
dateTimeShape: _enum([
|
|
22039
|
-
"date",
|
|
22040
|
-
"time",
|
|
22041
|
-
"datetime"
|
|
22042
|
-
]).optional(),
|
|
22043
|
-
/** Provider-specific extras that don't fit the structured slots.
|
|
22044
|
-
* Whitelist what goes here per provider — do NOT dump entire HA
|
|
22045
|
-
* attribute blobs (would explode the meta JSON column). */
|
|
22046
|
-
raw: record(string(), unknown()).optional()
|
|
22047
|
-
});
|
|
22048
|
-
/**
|
|
22049
22489
|
* device-discovery — device-scoped capability for parents that host /
|
|
22050
22490
|
* enumerate child devices (Reolink Hub / NVR, ONVIF gateway, future
|
|
22051
22491
|
* integrations). The parent advertises a list of discoverable children,
|
|
@@ -58058,13 +58498,19 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
58058
58498
|
}), method(ActionIdInput, _void(), {
|
|
58059
58499
|
kind: "mutation",
|
|
58060
58500
|
auth: "admin"
|
|
58061
|
-
}), method(ActionIdInput, object({ traces: array(AutomationRunTraceSchema) }), { auth: "admin" }), method(object({ action: ActionInputSchema }), object({
|
|
58501
|
+
}), method(ActionIdInput, object({ traces: array(AutomationRunTraceSchema) }), { auth: "admin" }), method(object({ action: ActionInputSchema }), object({
|
|
58502
|
+
action: ActionEntrySchema,
|
|
58503
|
+
warnings: array(UnitWarningSchema).optional()
|
|
58504
|
+
}), {
|
|
58062
58505
|
kind: "mutation",
|
|
58063
58506
|
auth: "admin"
|
|
58064
58507
|
}), method(object({
|
|
58065
58508
|
actionId: string().min(1),
|
|
58066
58509
|
action: ActionInputSchema.partial()
|
|
58067
|
-
}), object({
|
|
58510
|
+
}), object({
|
|
58511
|
+
action: ActionEntrySchema,
|
|
58512
|
+
warnings: array(UnitWarningSchema).optional()
|
|
58513
|
+
}), {
|
|
58068
58514
|
kind: "mutation",
|
|
58069
58515
|
auth: "admin"
|
|
58070
58516
|
}), method(ActionIdInput, _void(), {
|
|
@@ -62711,6 +63157,14 @@ var PetFeederDeviceStatusSchema = _enum([
|
|
|
62711
63157
|
"on_batteries"
|
|
62712
63158
|
]);
|
|
62713
63159
|
var gramsPortion = number().int().min(4).max(200);
|
|
63160
|
+
/** A portion REQUESTED of the feeder is a mass the method takes in GRAMS (the
|
|
63161
|
+
* hardware's own unit). The bounds are grams; a caller entering another unit
|
|
63162
|
+
* converts to grams first (`paramMeta`, D972). The STATUS fields above stay
|
|
63163
|
+
* plain grams — they are not readings in the kilogram base. */
|
|
63164
|
+
var gramsParam = gramsPortion.meta(paramMeta({
|
|
63165
|
+
quantity: "mass",
|
|
63166
|
+
unit: "g"
|
|
63167
|
+
}));
|
|
62714
63168
|
object({
|
|
62715
63169
|
/** Food in the TANK (hopper), as the feeder's own sensor reports it
|
|
62716
63170
|
* (`state.food`). A coarse level code, not grams — `0` is empty. The
|
|
@@ -62785,9 +63239,9 @@ object({
|
|
|
62785
63239
|
});
|
|
62786
63240
|
DeviceType.PetFeeder, method(object({
|
|
62787
63241
|
deviceId: number().int().nonnegative(),
|
|
62788
|
-
grams:
|
|
62789
|
-
hopper1:
|
|
62790
|
-
hopper2:
|
|
63242
|
+
grams: gramsParam.optional(),
|
|
63243
|
+
hopper1: gramsParam.optional(),
|
|
63244
|
+
hopper2: gramsParam.optional()
|
|
62791
63245
|
}), _void(), {
|
|
62792
63246
|
kind: "mutation",
|
|
62793
63247
|
auth: "protected"
|
|
@@ -79484,7 +79938,8 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
79484
79938
|
min: 4,
|
|
79485
79939
|
max: 200,
|
|
79486
79940
|
step: 1,
|
|
79487
|
-
unit: "g"
|
|
79941
|
+
unit: "g",
|
|
79942
|
+
quantity: "mass"
|
|
79488
79943
|
},
|
|
79489
79944
|
optional: true
|
|
79490
79945
|
}]
|
|
@@ -79503,7 +79958,8 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
79503
79958
|
min: 4,
|
|
79504
79959
|
max: 200,
|
|
79505
79960
|
step: 1,
|
|
79506
|
-
unit: "g"
|
|
79961
|
+
unit: "g",
|
|
79962
|
+
quantity: "mass"
|
|
79507
79963
|
},
|
|
79508
79964
|
optional: true
|
|
79509
79965
|
}, {
|
|
@@ -79514,7 +79970,8 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
79514
79970
|
min: 4,
|
|
79515
79971
|
max: 200,
|
|
79516
79972
|
step: 1,
|
|
79517
|
-
unit: "g"
|
|
79973
|
+
unit: "g",
|
|
79974
|
+
quantity: "mass"
|
|
79518
79975
|
},
|
|
79519
79976
|
optional: true
|
|
79520
79977
|
}]
|