@camstack/addon-provider-reolink 1.2.220 → 1.2.221

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/dist/addon.mjs CHANGED
@@ -101473,7 +101473,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101473
101473
  return EventCategory;
101474
101474
  }({});
101475
101475
  //#endregion
101476
- //#region ../types/dist/device-type-CfHw_quR.mjs
101476
+ //#region ../types/dist/device-type-D1fH5kaC.mjs
101477
101477
  /**
101478
101478
  import { errMsg } from '@camstack/types'
101479
101479
  * Extract a human-readable message from an unknown error value.
@@ -101704,6 +101704,12 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101704
101704
  DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
101705
101705
  /** Media player exposes stop distinct from pause. */
101706
101706
  DeviceFeature["MediaPlayerStop"] = "media-player-stop";
101707
+ /** Media player exposes volume up / down in steps (an infrared TV has no level). */
101708
+ DeviceFeature["MediaPlayerVolumeStep"] = "media-player-volume-step";
101709
+ /** Media player exposes channel up / down in steps. */
101710
+ DeviceFeature["MediaPlayerChannelStep"] = "media-player-channel-step";
101711
+ /** Media player exposes power on / off. */
101712
+ DeviceFeature["MediaPlayerPower"] = "media-player-power";
101707
101713
  /** Alarm panel requires a PIN code on arm/disarm. */
101708
101714
  DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
101709
101715
  /** Presence device carries GPS coordinates (lat/lng/accuracy) in
@@ -106530,7 +106536,7 @@ var ZodIssueCode = {
106530
106536
  var ZodFirstPartyTypeKind;
106531
106537
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106532
106538
  //#endregion
106533
- //#region ../types/dist/sleep-hmSP-eJt.mjs
106539
+ //#region ../types/dist/sleep-BKClVk0K.mjs
106534
106540
  /**
106535
106541
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106536
106542
  * window to float samples (D455).
@@ -106609,6 +106615,22 @@ function buildAlawTable() {
106609
106615
  }
106610
106616
  buildUlawTable();
106611
106617
  buildAlawTable();
106618
+ /**
106619
+ * An addon whose own migrations did not apply refuses to initialise (D987). The error is typed
106620
+ * so a runner hosting several addons can tell "this addon is blocked" from a crash and keep its
106621
+ * co-located siblings running. Recognised by NAME and shape, never `instanceof`: a forked addon
106622
+ * bundles its own copy of this module, so the class the runner sees is not the one that threw.
106623
+ */
106624
+ var MIGRATIONS_BLOCKED_ERROR_NAME = "AddonMigrationsBlockedError";
106625
+ var AddonMigrationsBlockedError = class extends Error {
106626
+ /** The ledger ids that did not apply and block the owner. */
106627
+ migrationIds;
106628
+ constructor(migrationIds) {
106629
+ super(`migration(s) ${migrationIds.join(", ")} did not apply and block this addon — fix or retry them (migrations.retry), then restart it`);
106630
+ this.name = MIGRATIONS_BLOCKED_ERROR_NAME;
106631
+ this.migrationIds = migrationIds;
106632
+ }
106633
+ };
106612
106634
  /** Is this field's stored value a credential? */
106613
106635
  function isSecretConfigField(field) {
106614
106636
  if (field.type === "password") return true;
@@ -108266,7 +108288,7 @@ var BaseAddon = class {
108266
108288
  startMigration: (input) => api.startMigration.mutate(input),
108267
108289
  finishMigration: (input) => api.finishMigration.mutate(input)
108268
108290
  }, migrations, this.ctx.logger);
108269
- if (report.blockOwner.length > 0) throw new Error(`migration(s) ${report.blockOwner.join(", ")} did not apply and block this addon — fix or retry them (migrations.retry), then restart it`);
108291
+ if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
108270
108292
  return report;
108271
108293
  }
108272
108294
  /**
@@ -112221,7 +112243,7 @@ function sleep(ms) {
112221
112243
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
112222
112244
  }
112223
112245
  //#endregion
112224
- //#region ../types/dist/composition-Dh3RfMx5.mjs
112246
+ //#region ../types/dist/composition-BodkvOV0.mjs
112225
112247
  /**
112226
112248
  * The ffmpeg build every CamStack node downloads, per platform and arch.
112227
112249
  *
@@ -113358,7 +113380,14 @@ var CompositionForwardCommandSchema = object({
113358
113380
  method: string().min(1),
113359
113381
  args: record(string().min(1), CompositionForwardArgSchema).optional()
113360
113382
  });
113361
- var CompositionCommandTargetSchema = discriminatedUnion("kind", [CompositionForwardCommandSchema, CompositionCodeSourceSchema]);
113383
+ var CompositionCommandTargetSchema = discriminatedUnion("kind", [
113384
+ CompositionForwardCommandSchema,
113385
+ CompositionCodeSourceSchema,
113386
+ object({
113387
+ kind: literal("extension"),
113388
+ target: literal("remote")
113389
+ })
113390
+ ]);
113362
113391
  /** An item key inside an item-array cap (`consumables.items[<key>]`). */
113363
113392
  var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
113364
113393
  /**
@@ -120468,6 +120497,48 @@ var APPLIANCE_CAP_VOCABULARY = {
120468
120497
  scope: "device",
120469
120498
  noun: t("Media player", "Lettore multimediale"),
120470
120499
  actions: [
120500
+ {
120501
+ id: "media.turnOn",
120502
+ method: "turnOn",
120503
+ label: t("Turn on", "Accendi"),
120504
+ phrase: t("Turn on {device}", "Accendi {device}"),
120505
+ icon: "power"
120506
+ },
120507
+ {
120508
+ id: "media.turnOff",
120509
+ method: "turnOff",
120510
+ label: t("Turn off", "Spegni"),
120511
+ phrase: t("Turn off {device}", "Spegni {device}"),
120512
+ icon: "power"
120513
+ },
120514
+ {
120515
+ id: "media.volumeUp",
120516
+ method: "volumeUp",
120517
+ label: t("Volume up", "Alza il volume"),
120518
+ phrase: t("Raise the volume of {device}", "Alza il volume di {device}"),
120519
+ icon: "volume-2"
120520
+ },
120521
+ {
120522
+ id: "media.volumeDown",
120523
+ method: "volumeDown",
120524
+ label: t("Volume down", "Abbassa il volume"),
120525
+ phrase: t("Lower the volume of {device}", "Abbassa il volume di {device}"),
120526
+ icon: "volume-2"
120527
+ },
120528
+ {
120529
+ id: "media.channelUp",
120530
+ method: "channelUp",
120531
+ label: t("Channel up", "Canale successivo"),
120532
+ phrase: t("Go to the next channel on {device}", "Passa al canale successivo su {device}"),
120533
+ icon: "skip-forward"
120534
+ },
120535
+ {
120536
+ id: "media.channelDown",
120537
+ method: "channelDown",
120538
+ label: t("Channel down", "Canale precedente"),
120539
+ phrase: t("Go to the previous channel on {device}", "Torna al canale precedente su {device}"),
120540
+ icon: "skip-back"
120541
+ },
120471
120542
  {
120472
120543
  id: "media.play",
120473
120544
  method: "play",
@@ -149988,6 +150059,244 @@ var controlCapability = {
149988
150059
  */
149989
150060
  history: "none"
149990
150061
  };
150062
+ /**
150063
+ * Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
150064
+ * Apple TV, Spotify, Roku, generic OTT receivers, …) on
150065
+ * `DeviceType.MediaPlayer`. Disjoint from the camera streaming
150066
+ * surface — those use `DeviceType.Camera` + the broker pipeline.
150067
+ *
150068
+ * The cap declares a wide method surface; not every backend supports
150069
+ * every method. Drivers signal sub-capability via the
150070
+ * `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
150071
+ * corresponding method) so the UI gates buttons without a slice
150072
+ * fetch — same pattern as `PanTiltZoom` for cameras.
150073
+ */
150074
+ var MediaPlayerStateSchema = _enum([
150075
+ "off",
150076
+ "on",
150077
+ "idle",
150078
+ "playing",
150079
+ "paused",
150080
+ "buffering",
150081
+ "standby"
150082
+ ]);
150083
+ var MediaPlayerRepeatSchema = _enum([
150084
+ "off",
150085
+ "all",
150086
+ "one"
150087
+ ]);
150088
+ var MediaInfoSchema = object({
150089
+ /** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
150090
+ * `podcast`, …). */
150091
+ type: string(),
150092
+ /** Human-readable title. */
150093
+ title: string(),
150094
+ /** Optional artist / channel / station label. */
150095
+ artist: string().optional(),
150096
+ /** Optional album / season / show name. */
150097
+ album: string().optional(),
150098
+ /** Optional cover-art / thumbnail URL. */
150099
+ imageUrl: string().optional()
150100
+ });
150101
+ /**
150102
+ * Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
150103
+ * the device said so. `assumed`: the driver has no feedback (infrared) and
150104
+ * tracks what it last SENT; it moves only after a send was accepted, and a
150105
+ * human at the real remote makes it wrong. A UI shows an assumed value as a
150106
+ * guess, never as a reading.
150107
+ */
150108
+ var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
150109
+ /** The fields of a media-player status a driver can only guess. */
150110
+ var MediaPlayerAssumedFieldSchema = _enum([
150111
+ "state",
150112
+ "volumeLevel",
150113
+ "isMuted",
150114
+ "source"
150115
+ ]);
150116
+ var MediaPlayerStatusSchema = object({
150117
+ /** Playback lifecycle state. */
150118
+ state: MediaPlayerStateSchema,
150119
+ /**
150120
+ * Whether the state fields are readings or the driver's own bookkeeping.
150121
+ * A slice written before this field existed parses as `reported`.
150122
+ */
150123
+ stateSource: MediaPlayerStateSourceSchema.default("reported"),
150124
+ /**
150125
+ * Which fields are the driver's own guess. `stateSource` is `assumed` when
150126
+ * this is not empty; a field not listed here is a reading even then (power
150127
+ * from a running-state source, mute guessed from the last send).
150128
+ */
150129
+ assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
150130
+ /** Volume as 0..100 inclusive. Null when the device has no volume
150131
+ * surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
150132
+ volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
150133
+ /** Mute toggle distinct from volume=0. Null when no mute surface.
150134
+ * Pair with `DeviceFeature.MediaPlayerMute`. */
150135
+ isMuted: boolean().nullable(),
150136
+ /** Active source / input. Empty when no source surface. */
150137
+ source: string(),
150138
+ /** Selectable sources. Empty when no source surface.
150139
+ * Pair with `DeviceFeature.MediaPlayerSelectSource`. */
150140
+ availableSources: array(string()),
150141
+ /** Currently-playing media info. Null when nothing is playing. */
150142
+ currentMedia: MediaInfoSchema.nullable(),
150143
+ /** Current playback position in ms. Null when not seekable or
150144
+ * nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
150145
+ position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
150146
+ /** Total duration of the current media in ms. Null when unknown
150147
+ * (live stream) or nothing is playing. */
150148
+ duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
150149
+ /** Shuffle toggle. Null when no shuffle surface.
150150
+ * Pair with `DeviceFeature.MediaPlayerShuffle`. */
150151
+ shuffle: boolean().nullable(),
150152
+ /** Repeat mode. Null when no repeat surface.
150153
+ * Pair with `DeviceFeature.MediaPlayerRepeat`. */
150154
+ repeat: MediaPlayerRepeatSchema.nullable(),
150155
+ /** Ms epoch when the slice was last updated. */
150156
+ lastChangedAt: number()
150157
+ });
150158
+ var stepInput = object({
150159
+ deviceId: number().int().nonnegative(),
150160
+ /** How many presses: the caller's count (Alexa `volumeSteps`, `channelCount`). */
150161
+ steps: number().int().min(1).max(50).default(1)
150162
+ });
150163
+ var deviceOnly = object({ deviceId: number().int().nonnegative() });
150164
+ var mediaPlayerCapability = {
150165
+ name: "media-player",
150166
+ scope: "device",
150167
+ deviceNative: true,
150168
+ mode: "singleton",
150169
+ deviceTypes: [DeviceType.MediaPlayer],
150170
+ methods: {
150171
+ turnOn: method(deviceOnly, _void(), {
150172
+ kind: "mutation",
150173
+ auth: "protected"
150174
+ }),
150175
+ turnOff: method(deviceOnly, _void(), {
150176
+ kind: "mutation",
150177
+ auth: "protected"
150178
+ }),
150179
+ volumeUp: method(stepInput, _void(), {
150180
+ kind: "mutation",
150181
+ auth: "protected"
150182
+ }),
150183
+ volumeDown: method(stepInput, _void(), {
150184
+ kind: "mutation",
150185
+ auth: "protected"
150186
+ }),
150187
+ channelUp: method(stepInput, _void(), {
150188
+ kind: "mutation",
150189
+ auth: "protected"
150190
+ }),
150191
+ channelDown: method(stepInput, _void(), {
150192
+ kind: "mutation",
150193
+ auth: "protected"
150194
+ }),
150195
+ play: method(object({ deviceId: number().int().nonnegative() }), _void(), {
150196
+ kind: "mutation",
150197
+ auth: "protected"
150198
+ }),
150199
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
150200
+ kind: "mutation",
150201
+ auth: "protected"
150202
+ }),
150203
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
150204
+ kind: "mutation",
150205
+ auth: "protected"
150206
+ }),
150207
+ next: method(object({ deviceId: number().int().nonnegative() }), _void(), {
150208
+ kind: "mutation",
150209
+ auth: "protected"
150210
+ }),
150211
+ previous: method(object({ deviceId: number().int().nonnegative() }), _void(), {
150212
+ kind: "mutation",
150213
+ auth: "protected"
150214
+ }),
150215
+ seek: method(object({
150216
+ deviceId: number().int().nonnegative(),
150217
+ position: number().int().nonnegative()
150218
+ }), _void(), {
150219
+ kind: "mutation",
150220
+ auth: "protected"
150221
+ }),
150222
+ setVolume: method(object({
150223
+ deviceId: number().int().nonnegative(),
150224
+ volumeLevel: number().min(0).max(100)
150225
+ }), _void(), {
150226
+ kind: "mutation",
150227
+ auth: "protected"
150228
+ }),
150229
+ setMute: method(object({
150230
+ deviceId: number().int().nonnegative(),
150231
+ muted: boolean()
150232
+ }), _void(), {
150233
+ kind: "mutation",
150234
+ auth: "protected"
150235
+ }),
150236
+ setShuffle: method(object({
150237
+ deviceId: number().int().nonnegative(),
150238
+ shuffle: boolean()
150239
+ }), _void(), {
150240
+ kind: "mutation",
150241
+ auth: "protected"
150242
+ }),
150243
+ setRepeat: method(object({
150244
+ deviceId: number().int().nonnegative(),
150245
+ repeat: MediaPlayerRepeatSchema
150246
+ }), _void(), {
150247
+ kind: "mutation",
150248
+ auth: "protected"
150249
+ }),
150250
+ selectSource: method(object({
150251
+ deviceId: number().int().nonnegative(),
150252
+ source: string().min(1)
150253
+ }), _void(), {
150254
+ kind: "mutation",
150255
+ auth: "protected"
150256
+ }),
150257
+ playMedia: method(object({
150258
+ deviceId: number().int().nonnegative(),
150259
+ /** Media identifier / URL. */
150260
+ mediaId: string().min(1),
150261
+ /** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
150262
+ * passes it through to the upstream service. */
150263
+ mediaType: string().min(1)
150264
+ }), _void(), {
150265
+ kind: "mutation",
150266
+ auth: "protected"
150267
+ })
150268
+ },
150269
+ status: {
150270
+ schema: MediaPlayerStatusSchema,
150271
+ kind: "push"
150272
+ },
150273
+ /**
150274
+ * Runtime-state slice — mirrored by the kernel. UI players read the
150275
+ * full slice for live now-playing, volume, and progress updates
150276
+ * without polling.
150277
+ */
150278
+ runtimeState: MediaPlayerStatusSchema,
150279
+ /**
150280
+ * Runtime-state durability: **session** — a restored transport position describes a playback that stopped when the hub did.
150281
+ *
150282
+ * See `RuntimeStateDurability`. Enforced by
150283
+ * `scripts/check-runtime-state-durability.ts`.
150284
+ */
150285
+ durability: "session",
150286
+ /**
150287
+ * History (D850): volume (a level an operator or an automation sets; the
150288
+ * default 10 s floor folds a slider drag into its end value) and mute.
150289
+ * `position` is not recorded: it moves continuously while playing.
150290
+ */
150291
+ history: { fields: {
150292
+ volumeLevel: {
150293
+ kind: "gauge",
150294
+ unit: "%",
150295
+ deadband: 1
150296
+ },
150297
+ isMuted: { kind: "boolean" }
150298
+ } }
150299
+ };
149991
150300
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, 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.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, 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, DeviceType.Heater, 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, DeviceType.Heater, 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, DeviceType.Heater, 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, DeviceType.Heater, DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder, DeviceType.Heater;
149992
150301
  var NUMBER = {
149993
150302
  kind: "fixed",
@@ -158755,214 +159064,6 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
158755
159064
  ]);
158756
159065
  method(_void(), array(LoginMethodContributionSchema).readonly());
158757
159066
  /**
158758
- * Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
158759
- * Apple TV, Spotify, Roku, generic OTT receivers, …) on
158760
- * `DeviceType.MediaPlayer`. Disjoint from the camera streaming
158761
- * surface — those use `DeviceType.Camera` + the broker pipeline.
158762
- *
158763
- * The cap declares a wide method surface; not every backend supports
158764
- * every method. Drivers signal sub-capability via the
158765
- * `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
158766
- * corresponding method) so the UI gates buttons without a slice
158767
- * fetch — same pattern as `PanTiltZoom` for cameras.
158768
- */
158769
- var MediaPlayerStateSchema = _enum([
158770
- "off",
158771
- "on",
158772
- "idle",
158773
- "playing",
158774
- "paused",
158775
- "buffering",
158776
- "standby"
158777
- ]);
158778
- var MediaPlayerRepeatSchema = _enum([
158779
- "off",
158780
- "all",
158781
- "one"
158782
- ]);
158783
- var MediaInfoSchema = object({
158784
- /** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
158785
- * `podcast`, …). */
158786
- type: string(),
158787
- /** Human-readable title. */
158788
- title: string(),
158789
- /** Optional artist / channel / station label. */
158790
- artist: string().optional(),
158791
- /** Optional album / season / show name. */
158792
- album: string().optional(),
158793
- /** Optional cover-art / thumbnail URL. */
158794
- imageUrl: string().optional()
158795
- });
158796
- /**
158797
- * Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
158798
- * the device said so. `assumed`: the driver has no feedback (infrared) and
158799
- * tracks what it last SENT; it moves only after a send was accepted, and a
158800
- * human at the real remote makes it wrong. A UI shows an assumed value as a
158801
- * guess, never as a reading.
158802
- */
158803
- var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
158804
- /** The fields of a media-player status a driver can only guess. */
158805
- var MediaPlayerAssumedFieldSchema = _enum([
158806
- "state",
158807
- "volumeLevel",
158808
- "isMuted",
158809
- "source"
158810
- ]);
158811
- var MediaPlayerStatusSchema = object({
158812
- /** Playback lifecycle state. */
158813
- state: MediaPlayerStateSchema,
158814
- /**
158815
- * Whether the state fields are readings or the driver's own bookkeeping.
158816
- * A slice written before this field existed parses as `reported`.
158817
- */
158818
- stateSource: MediaPlayerStateSourceSchema.default("reported"),
158819
- /**
158820
- * Which fields are the driver's own guess. `stateSource` is `assumed` when
158821
- * this is not empty; a field not listed here is a reading even then (power
158822
- * from a running-state source, mute guessed from the last send).
158823
- */
158824
- assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
158825
- /** Volume as 0..100 inclusive. Null when the device has no volume
158826
- * surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
158827
- volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
158828
- /** Mute toggle distinct from volume=0. Null when no mute surface.
158829
- * Pair with `DeviceFeature.MediaPlayerMute`. */
158830
- isMuted: boolean().nullable(),
158831
- /** Active source / input. Empty when no source surface. */
158832
- source: string(),
158833
- /** Selectable sources. Empty when no source surface.
158834
- * Pair with `DeviceFeature.MediaPlayerSelectSource`. */
158835
- availableSources: array(string()),
158836
- /** Currently-playing media info. Null when nothing is playing. */
158837
- currentMedia: MediaInfoSchema.nullable(),
158838
- /** Current playback position in ms. Null when not seekable or
158839
- * nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
158840
- position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
158841
- /** Total duration of the current media in ms. Null when unknown
158842
- * (live stream) or nothing is playing. */
158843
- duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
158844
- /** Shuffle toggle. Null when no shuffle surface.
158845
- * Pair with `DeviceFeature.MediaPlayerShuffle`. */
158846
- shuffle: boolean().nullable(),
158847
- /** Repeat mode. Null when no repeat surface.
158848
- * Pair with `DeviceFeature.MediaPlayerRepeat`. */
158849
- repeat: MediaPlayerRepeatSchema.nullable(),
158850
- /** Ms epoch when the slice was last updated. */
158851
- lastChangedAt: number()
158852
- });
158853
- var mediaPlayerCapability = {
158854
- name: "media-player",
158855
- scope: "device",
158856
- deviceNative: true,
158857
- mode: "singleton",
158858
- deviceTypes: [DeviceType.MediaPlayer],
158859
- methods: {
158860
- play: method(object({ deviceId: number().int().nonnegative() }), _void(), {
158861
- kind: "mutation",
158862
- auth: "protected"
158863
- }),
158864
- pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
158865
- kind: "mutation",
158866
- auth: "protected"
158867
- }),
158868
- stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
158869
- kind: "mutation",
158870
- auth: "protected"
158871
- }),
158872
- next: method(object({ deviceId: number().int().nonnegative() }), _void(), {
158873
- kind: "mutation",
158874
- auth: "protected"
158875
- }),
158876
- previous: method(object({ deviceId: number().int().nonnegative() }), _void(), {
158877
- kind: "mutation",
158878
- auth: "protected"
158879
- }),
158880
- seek: method(object({
158881
- deviceId: number().int().nonnegative(),
158882
- position: number().int().nonnegative()
158883
- }), _void(), {
158884
- kind: "mutation",
158885
- auth: "protected"
158886
- }),
158887
- setVolume: method(object({
158888
- deviceId: number().int().nonnegative(),
158889
- volumeLevel: number().min(0).max(100)
158890
- }), _void(), {
158891
- kind: "mutation",
158892
- auth: "protected"
158893
- }),
158894
- setMute: method(object({
158895
- deviceId: number().int().nonnegative(),
158896
- muted: boolean()
158897
- }), _void(), {
158898
- kind: "mutation",
158899
- auth: "protected"
158900
- }),
158901
- setShuffle: method(object({
158902
- deviceId: number().int().nonnegative(),
158903
- shuffle: boolean()
158904
- }), _void(), {
158905
- kind: "mutation",
158906
- auth: "protected"
158907
- }),
158908
- setRepeat: method(object({
158909
- deviceId: number().int().nonnegative(),
158910
- repeat: MediaPlayerRepeatSchema
158911
- }), _void(), {
158912
- kind: "mutation",
158913
- auth: "protected"
158914
- }),
158915
- selectSource: method(object({
158916
- deviceId: number().int().nonnegative(),
158917
- source: string().min(1)
158918
- }), _void(), {
158919
- kind: "mutation",
158920
- auth: "protected"
158921
- }),
158922
- playMedia: method(object({
158923
- deviceId: number().int().nonnegative(),
158924
- /** Media identifier / URL. */
158925
- mediaId: string().min(1),
158926
- /** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
158927
- * passes it through to the upstream service. */
158928
- mediaType: string().min(1)
158929
- }), _void(), {
158930
- kind: "mutation",
158931
- auth: "protected"
158932
- })
158933
- },
158934
- status: {
158935
- schema: MediaPlayerStatusSchema,
158936
- kind: "push"
158937
- },
158938
- /**
158939
- * Runtime-state slice — mirrored by the kernel. UI players read the
158940
- * full slice for live now-playing, volume, and progress updates
158941
- * without polling.
158942
- */
158943
- runtimeState: MediaPlayerStatusSchema,
158944
- /**
158945
- * Runtime-state durability: **session** — a restored transport position describes a playback that stopped when the hub did.
158946
- *
158947
- * See `RuntimeStateDurability`. Enforced by
158948
- * `scripts/check-runtime-state-durability.ts`.
158949
- */
158950
- durability: "session",
158951
- /**
158952
- * History (D850): volume (a level an operator or an automation sets; the
158953
- * default 10 s floor folds a slider drag into its end value) and mute.
158954
- * `position` is not recorded: it moves continuously while playing.
158955
- */
158956
- history: { fields: {
158957
- volumeLevel: {
158958
- kind: "gauge",
158959
- unit: "%",
158960
- deadband: 1
158961
- },
158962
- isMuted: { kind: "boolean" }
158963
- } }
158964
- };
158965
- /**
158966
159067
  * mesh-network — collection cap for mesh-VPN providers.
158967
159068
  *
158968
159069
  * Different shape from `network-access` (public tunnels):
@@ -167741,6 +167842,21 @@ var NcTemplateVarKindSchema = _enum([
167741
167842
  "sound",
167742
167843
  "system"
167743
167844
  ]);
167845
+ /**
167846
+ * The default title/body a rule of one SITUATION is delivered with when the
167847
+ * operator wrote no template — served so an editor can pre-fill it (and the
167848
+ * operator can rebuild it from placeholders) instead of starting from a blank
167849
+ * box that, once saved, silently replaces it. `id` names the situation inside
167850
+ * a rule `kind`: `appliance-cycle` is a `sensor` rule whose device is an
167851
+ * appliance finishing a cycle. Texts are raw templates (`{{var}}` intact), in
167852
+ * the hub's current language and with its overrides applied.
167853
+ */
167854
+ var NcTemplateDefaultSchema = object({
167855
+ id: _enum(["appliance-cycle"]),
167856
+ kind: NcRuleKindSchema,
167857
+ title: string(),
167858
+ body: string()
167859
+ });
167744
167860
  /** Which producer renders a template: an ordinary rule, a timelapse, a digest. */
167745
167861
  var NcTemplateFamilySchema = _enum([
167746
167862
  "rule",
@@ -168596,7 +168712,11 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
168596
168712
  }), method(object({}), object({
168597
168713
  catalog: array(NcConditionDescriptorSchema),
168598
168714
  taxonomy: NcTaxonomySchema.optional()
168599
- })), method(object({}), object({ vars: array(NcTemplateVarDescriptorSchema) })), method(NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, {
168715
+ })), method(object({}), object({
168716
+ vars: array(NcTemplateVarDescriptorSchema),
168717
+ /** Per-situation default texts; absent on a hub that predates them. */
168718
+ defaults: array(NcTemplateDefaultSchema)
168719
+ })), method(NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, {
168600
168720
  kind: "mutation",
168601
168721
  access: "view"
168602
168722
  }), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({}), NcRuleLastRunsSchema, { auth: "admin" }), method(object({ artifactId: string().min(1) }), object({ url: string().nullable() }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
@@ -175354,7 +175474,13 @@ var RemoteMediaCommandSchema = _enum([
175354
175474
  "next",
175355
175475
  "previous",
175356
175476
  "setMute",
175357
- "selectSource"
175477
+ "selectSource",
175478
+ "turnOn",
175479
+ "turnOff",
175480
+ "volumeUp",
175481
+ "volumeDown",
175482
+ "channelUp",
175483
+ "channelDown"
175358
175484
  ]);
175359
175485
  /** A send result, or `not-routed`: the role is not bound, so the native cap answers. */
175360
175486
  var RemoteMediaCommandResultSchema = discriminatedUnion("status", [...RemoteSendResultSchema.options, object({ status: literal("not-routed") })]);
@@ -175375,7 +175501,7 @@ method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.e
175375
175501
  }), RemoteSendResultSchema, {
175376
175502
  kind: "mutation",
175377
175503
  auth: "protected"
175378
- }), method(deviceInput.extend({
175504
+ }), method(deviceInput, MediaPlayerStatusSchema.nullable(), { auth: "protected" }), method(deviceInput.extend({
175379
175505
  command: RemoteMediaCommandSchema,
175380
175506
  muted: boolean().optional(),
175381
175507
  source: string().optional(),
@@ -177725,7 +177851,11 @@ listSignals: method(_void(), array(StreamSignalSchema).readonly()) }
177725
177851
  * `getSettingsUISchema()` surface.
177726
177852
  */
177727
177853
  var SwitchStatusSchema = object({
177728
- on: boolean().meta({ label: "On" }),
177854
+ /**
177855
+ * `null` = the device has never reported its state (a measurement that
177856
+ * has not happened is unknown, never `false`).
177857
+ */
177858
+ on: boolean().nullable().meta({ label: "On" }),
177729
177859
  /** Ms epoch of the last state change. Useful for UI "X minutes ago". */
177730
177860
  lastChangedAt: number()
177731
177861
  });
@@ -177750,7 +177880,7 @@ var switchCapability = {
177750
177880
  }) },
177751
177881
  events: { onStateChanged: { data: object({
177752
177882
  deviceId: number(),
177753
- on: boolean(),
177883
+ on: boolean().nullable(),
177754
177884
  lastChangedAt: number()
177755
177885
  }) } },
177756
177886
  status: {
@@ -181762,6 +181892,7 @@ function buildStreamParamsConfigSchema(options, status) {
181762
181892
  if (sections.length === 0) return null;
181763
181893
  return { sections };
181764
181894
  }
181895
+ DeviceFeature.MediaPlayerPower, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious;
181765
181896
  var btn = (idSuffix, row, col, init) => ({
181766
181897
  idSuffix,
181767
181898
  row,
@@ -188088,6 +188219,20 @@ Object.freeze({
188088
188219
  access: "view",
188089
188220
  role: "admin"
188090
188221
  },
188222
+ "mediaPlayer.channelDown": {
188223
+ capName: "media-player",
188224
+ capScope: "device",
188225
+ addonId: null,
188226
+ access: "create",
188227
+ role: "viewer"
188228
+ },
188229
+ "mediaPlayer.channelUp": {
188230
+ capName: "media-player",
188231
+ capScope: "device",
188232
+ addonId: null,
188233
+ access: "create",
188234
+ role: "viewer"
188235
+ },
188091
188236
  "mediaPlayer.getStatus": {
188092
188237
  capName: "media-player",
188093
188238
  capScope: "device",
@@ -188179,6 +188324,34 @@ Object.freeze({
188179
188324
  access: "create",
188180
188325
  role: "viewer"
188181
188326
  },
188327
+ "mediaPlayer.turnOff": {
188328
+ capName: "media-player",
188329
+ capScope: "device",
188330
+ addonId: null,
188331
+ access: "create",
188332
+ role: "viewer"
188333
+ },
188334
+ "mediaPlayer.turnOn": {
188335
+ capName: "media-player",
188336
+ capScope: "device",
188337
+ addonId: null,
188338
+ access: "create",
188339
+ role: "viewer"
188340
+ },
188341
+ "mediaPlayer.volumeDown": {
188342
+ capName: "media-player",
188343
+ capScope: "device",
188344
+ addonId: null,
188345
+ access: "create",
188346
+ role: "viewer"
188347
+ },
188348
+ "mediaPlayer.volumeUp": {
188349
+ capName: "media-player",
188350
+ capScope: "device",
188351
+ addonId: null,
188352
+ access: "create",
188353
+ role: "viewer"
188354
+ },
188182
188355
  "meshNetwork.getStatus": {
188183
188356
  capName: "mesh-network",
188184
188357
  capScope: "system",
@@ -191735,6 +191908,13 @@ Object.freeze({
191735
191908
  access: "create",
191736
191909
  role: "admin"
191737
191910
  },
191911
+ "remote.getAssumedStatus": {
191912
+ capName: "remote",
191913
+ capScope: "system",
191914
+ addonId: null,
191915
+ access: "view",
191916
+ role: "admin"
191917
+ },
191738
191918
  "remote.getConfig": {
191739
191919
  capName: "remote",
191740
191920
  capScope: "system",
@@ -195553,6 +195733,16 @@ Object.freeze({
195553
195733
  form: "single",
195554
195734
  optional: true
195555
195735
  }],
195736
+ "mediaPlayer.channelDown": [{
195737
+ name: "deviceId",
195738
+ form: "single",
195739
+ optional: false
195740
+ }],
195741
+ "mediaPlayer.channelUp": [{
195742
+ name: "deviceId",
195743
+ form: "single",
195744
+ optional: false
195745
+ }],
195556
195746
  "mediaPlayer.getStatus": [{
195557
195747
  name: "deviceId",
195558
195748
  form: "single",
@@ -195618,6 +195808,26 @@ Object.freeze({
195618
195808
  form: "single",
195619
195809
  optional: false
195620
195810
  }],
195811
+ "mediaPlayer.turnOff": [{
195812
+ name: "deviceId",
195813
+ form: "single",
195814
+ optional: false
195815
+ }],
195816
+ "mediaPlayer.turnOn": [{
195817
+ name: "deviceId",
195818
+ form: "single",
195819
+ optional: false
195820
+ }],
195821
+ "mediaPlayer.volumeDown": [{
195822
+ name: "deviceId",
195823
+ form: "single",
195824
+ optional: false
195825
+ }],
195826
+ "mediaPlayer.volumeUp": [{
195827
+ name: "deviceId",
195828
+ form: "single",
195829
+ optional: false
195830
+ }],
195621
195831
  "meter.getStatus": [{
195622
195832
  name: "deviceId",
195623
195833
  form: "single",
@@ -196783,6 +196993,11 @@ Object.freeze({
196783
196993
  form: "single",
196784
196994
  optional: true
196785
196995
  }],
196996
+ "remote.getAssumedStatus": [{
196997
+ name: "deviceId",
196998
+ form: "single",
196999
+ optional: false
197000
+ }],
196786
197001
  "remote.getConfig": [{
196787
197002
  name: "deviceId",
196788
197003
  form: "single",
@@ -198038,6 +198253,7 @@ var STATE_SUMMARY_VARS = [
198038
198253
  [...RULE_TEXT],
198039
198254
  ([...RULE_TEXT], [...DEVICE_EVENTS]),
198040
198255
  ([...RULE_TEXT], [...COMBINED_ALARM]),
198256
+ ([...RULE_TEXT], [...COMBINED_ALARM]),
198041
198257
  ([...RULE_TEXT], [...DEVICE_EVENTS]),
198042
198258
  ([...RULE_TEXT], [...BATTERY, ...CONSUMABLE]),
198043
198259
  ([...RULE_TEXT], [...CONSUMABLE]),
@@ -208237,7 +208453,7 @@ var PirAccessory = class extends BaseDevice {
208237
208453
  async applySettingsPatch(patch) {
208238
208454
  await this.config.setAll(patch);
208239
208455
  if ("pirSensitive" in patch || "pirReduceAlarm" in patch || "pirIntervalS" in patch) try {
208240
- await this.pushConfigToFirmware(this.switchView().on);
208456
+ await this.pushConfigToFirmware(this.switchView().on === true);
208241
208457
  } catch (err) {
208242
208458
  this.ctx.logger.warn("pir firmware push failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
208243
208459
  throw err;