@camstack/addon-provider-homeassistant 1.2.652 → 1.2.654

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.
@@ -785,7 +785,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
785
785
  return EventCategory;
786
786
  }({});
787
787
  //#endregion
788
- //#region ../types/dist/device-type-CfHw_quR.mjs
788
+ //#region ../types/dist/device-type-D1fH5kaC.mjs
789
789
  /**
790
790
  import { errMsg } from '@camstack/types'
791
791
  * Extract a human-readable message from an unknown error value.
@@ -1016,6 +1016,12 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1016
1016
  DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
1017
1017
  /** Media player exposes stop distinct from pause. */
1018
1018
  DeviceFeature["MediaPlayerStop"] = "media-player-stop";
1019
+ /** Media player exposes volume up / down in steps (an infrared TV has no level). */
1020
+ DeviceFeature["MediaPlayerVolumeStep"] = "media-player-volume-step";
1021
+ /** Media player exposes channel up / down in steps. */
1022
+ DeviceFeature["MediaPlayerChannelStep"] = "media-player-channel-step";
1023
+ /** Media player exposes power on / off. */
1024
+ DeviceFeature["MediaPlayerPower"] = "media-player-power";
1019
1025
  /** Alarm panel requires a PIN code on arm/disarm. */
1020
1026
  DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
1021
1027
  /** Presence device carries GPS coordinates (lat/lng/accuracy) in
@@ -5975,7 +5981,7 @@ var ZodIssueCode = {
5975
5981
  var ZodFirstPartyTypeKind;
5976
5982
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5977
5983
  //#endregion
5978
- //#region ../types/dist/sleep-hmSP-eJt.mjs
5984
+ //#region ../types/dist/sleep-BKClVk0K.mjs
5979
5985
  /**
5980
5986
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5981
5987
  * window to float samples (D455).
@@ -6054,6 +6060,22 @@ function buildAlawTable() {
6054
6060
  }
6055
6061
  buildUlawTable();
6056
6062
  buildAlawTable();
6063
+ /**
6064
+ * An addon whose own migrations did not apply refuses to initialise (D987). The error is typed
6065
+ * so a runner hosting several addons can tell "this addon is blocked" from a crash and keep its
6066
+ * co-located siblings running. Recognised by NAME and shape, never `instanceof`: a forked addon
6067
+ * bundles its own copy of this module, so the class the runner sees is not the one that threw.
6068
+ */
6069
+ var MIGRATIONS_BLOCKED_ERROR_NAME = "AddonMigrationsBlockedError";
6070
+ var AddonMigrationsBlockedError = class extends Error {
6071
+ /** The ledger ids that did not apply and block the owner. */
6072
+ migrationIds;
6073
+ constructor(migrationIds) {
6074
+ super(`migration(s) ${migrationIds.join(", ")} did not apply and block this addon — fix or retry them (migrations.retry), then restart it`);
6075
+ this.name = MIGRATIONS_BLOCKED_ERROR_NAME;
6076
+ this.migrationIds = migrationIds;
6077
+ }
6078
+ };
6057
6079
  /** Is this field's stored value a credential? */
6058
6080
  function isSecretConfigField(field) {
6059
6081
  if (field.type === "password") return true;
@@ -7707,7 +7729,7 @@ var BaseAddon = class {
7707
7729
  startMigration: (input) => api.startMigration.mutate(input),
7708
7730
  finishMigration: (input) => api.finishMigration.mutate(input)
7709
7731
  }, migrations, this.ctx.logger);
7710
- 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`);
7732
+ if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
7711
7733
  return report;
7712
7734
  }
7713
7735
  /**
@@ -11765,7 +11787,7 @@ object({
11765
11787
  params: record(string(), union([string(), number()])).optional()
11766
11788
  });
11767
11789
  //#endregion
11768
- //#region ../types/dist/composition-Dh3RfMx5.mjs
11790
+ //#region ../types/dist/composition-BodkvOV0.mjs
11769
11791
  /**
11770
11792
  * The ffmpeg build every CamStack node downloads, per platform and arch.
11771
11793
  *
@@ -12902,7 +12924,14 @@ var CompositionForwardCommandSchema = object({
12902
12924
  method: string().min(1),
12903
12925
  args: record(string().min(1), CompositionForwardArgSchema).optional()
12904
12926
  });
12905
- var CompositionCommandTargetSchema = discriminatedUnion("kind", [CompositionForwardCommandSchema, CompositionCodeSourceSchema]);
12927
+ var CompositionCommandTargetSchema = discriminatedUnion("kind", [
12928
+ CompositionForwardCommandSchema,
12929
+ CompositionCodeSourceSchema,
12930
+ object({
12931
+ kind: literal("extension"),
12932
+ target: literal("remote")
12933
+ })
12934
+ ]);
12906
12935
  /** An item key inside an item-array cap (`consumables.items[<key>]`). */
12907
12936
  var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
12908
12937
  /**
@@ -19563,6 +19592,48 @@ var APPLIANCE_CAP_VOCABULARY = {
19563
19592
  scope: "device",
19564
19593
  noun: t("Media player", "Lettore multimediale"),
19565
19594
  actions: [
19595
+ {
19596
+ id: "media.turnOn",
19597
+ method: "turnOn",
19598
+ label: t("Turn on", "Accendi"),
19599
+ phrase: t("Turn on {device}", "Accendi {device}"),
19600
+ icon: "power"
19601
+ },
19602
+ {
19603
+ id: "media.turnOff",
19604
+ method: "turnOff",
19605
+ label: t("Turn off", "Spegni"),
19606
+ phrase: t("Turn off {device}", "Spegni {device}"),
19607
+ icon: "power"
19608
+ },
19609
+ {
19610
+ id: "media.volumeUp",
19611
+ method: "volumeUp",
19612
+ label: t("Volume up", "Alza il volume"),
19613
+ phrase: t("Raise the volume of {device}", "Alza il volume di {device}"),
19614
+ icon: "volume-2"
19615
+ },
19616
+ {
19617
+ id: "media.volumeDown",
19618
+ method: "volumeDown",
19619
+ label: t("Volume down", "Abbassa il volume"),
19620
+ phrase: t("Lower the volume of {device}", "Abbassa il volume di {device}"),
19621
+ icon: "volume-2"
19622
+ },
19623
+ {
19624
+ id: "media.channelUp",
19625
+ method: "channelUp",
19626
+ label: t("Channel up", "Canale successivo"),
19627
+ phrase: t("Go to the next channel on {device}", "Passa al canale successivo su {device}"),
19628
+ icon: "skip-forward"
19629
+ },
19630
+ {
19631
+ id: "media.channelDown",
19632
+ method: "channelDown",
19633
+ label: t("Channel down", "Canale precedente"),
19634
+ phrase: t("Go to the previous channel on {device}", "Torna al canale precedente su {device}"),
19635
+ icon: "skip-back"
19636
+ },
19566
19637
  {
19567
19638
  id: "media.play",
19568
19639
  method: "play",
@@ -49532,6 +49603,244 @@ var controlCapability = {
49532
49603
  */
49533
49604
  history: "none"
49534
49605
  };
49606
+ /**
49607
+ * Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
49608
+ * Apple TV, Spotify, Roku, generic OTT receivers, …) on
49609
+ * `DeviceType.MediaPlayer`. Disjoint from the camera streaming
49610
+ * surface — those use `DeviceType.Camera` + the broker pipeline.
49611
+ *
49612
+ * The cap declares a wide method surface; not every backend supports
49613
+ * every method. Drivers signal sub-capability via the
49614
+ * `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
49615
+ * corresponding method) so the UI gates buttons without a slice
49616
+ * fetch — same pattern as `PanTiltZoom` for cameras.
49617
+ */
49618
+ var MediaPlayerStateSchema = _enum([
49619
+ "off",
49620
+ "on",
49621
+ "idle",
49622
+ "playing",
49623
+ "paused",
49624
+ "buffering",
49625
+ "standby"
49626
+ ]);
49627
+ var MediaPlayerRepeatSchema = _enum([
49628
+ "off",
49629
+ "all",
49630
+ "one"
49631
+ ]);
49632
+ var MediaInfoSchema = object({
49633
+ /** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
49634
+ * `podcast`, …). */
49635
+ type: string(),
49636
+ /** Human-readable title. */
49637
+ title: string(),
49638
+ /** Optional artist / channel / station label. */
49639
+ artist: string().optional(),
49640
+ /** Optional album / season / show name. */
49641
+ album: string().optional(),
49642
+ /** Optional cover-art / thumbnail URL. */
49643
+ imageUrl: string().optional()
49644
+ });
49645
+ /**
49646
+ * Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
49647
+ * the device said so. `assumed`: the driver has no feedback (infrared) and
49648
+ * tracks what it last SENT; it moves only after a send was accepted, and a
49649
+ * human at the real remote makes it wrong. A UI shows an assumed value as a
49650
+ * guess, never as a reading.
49651
+ */
49652
+ var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
49653
+ /** The fields of a media-player status a driver can only guess. */
49654
+ var MediaPlayerAssumedFieldSchema = _enum([
49655
+ "state",
49656
+ "volumeLevel",
49657
+ "isMuted",
49658
+ "source"
49659
+ ]);
49660
+ var MediaPlayerStatusSchema = object({
49661
+ /** Playback lifecycle state. */
49662
+ state: MediaPlayerStateSchema,
49663
+ /**
49664
+ * Whether the state fields are readings or the driver's own bookkeeping.
49665
+ * A slice written before this field existed parses as `reported`.
49666
+ */
49667
+ stateSource: MediaPlayerStateSourceSchema.default("reported"),
49668
+ /**
49669
+ * Which fields are the driver's own guess. `stateSource` is `assumed` when
49670
+ * this is not empty; a field not listed here is a reading even then (power
49671
+ * from a running-state source, mute guessed from the last send).
49672
+ */
49673
+ assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
49674
+ /** Volume as 0..100 inclusive. Null when the device has no volume
49675
+ * surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
49676
+ volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
49677
+ /** Mute toggle distinct from volume=0. Null when no mute surface.
49678
+ * Pair with `DeviceFeature.MediaPlayerMute`. */
49679
+ isMuted: boolean().nullable(),
49680
+ /** Active source / input. Empty when no source surface. */
49681
+ source: string(),
49682
+ /** Selectable sources. Empty when no source surface.
49683
+ * Pair with `DeviceFeature.MediaPlayerSelectSource`. */
49684
+ availableSources: array(string()),
49685
+ /** Currently-playing media info. Null when nothing is playing. */
49686
+ currentMedia: MediaInfoSchema.nullable(),
49687
+ /** Current playback position in ms. Null when not seekable or
49688
+ * nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
49689
+ position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
49690
+ /** Total duration of the current media in ms. Null when unknown
49691
+ * (live stream) or nothing is playing. */
49692
+ duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
49693
+ /** Shuffle toggle. Null when no shuffle surface.
49694
+ * Pair with `DeviceFeature.MediaPlayerShuffle`. */
49695
+ shuffle: boolean().nullable(),
49696
+ /** Repeat mode. Null when no repeat surface.
49697
+ * Pair with `DeviceFeature.MediaPlayerRepeat`. */
49698
+ repeat: MediaPlayerRepeatSchema.nullable(),
49699
+ /** Ms epoch when the slice was last updated. */
49700
+ lastChangedAt: number()
49701
+ });
49702
+ var stepInput = object({
49703
+ deviceId: number().int().nonnegative(),
49704
+ /** How many presses: the caller's count (Alexa `volumeSteps`, `channelCount`). */
49705
+ steps: number().int().min(1).max(50).default(1)
49706
+ });
49707
+ var deviceOnly = object({ deviceId: number().int().nonnegative() });
49708
+ var mediaPlayerCapability = {
49709
+ name: "media-player",
49710
+ scope: "device",
49711
+ deviceNative: true,
49712
+ mode: "singleton",
49713
+ deviceTypes: [DeviceType.MediaPlayer],
49714
+ methods: {
49715
+ turnOn: method(deviceOnly, _void(), {
49716
+ kind: "mutation",
49717
+ auth: "protected"
49718
+ }),
49719
+ turnOff: method(deviceOnly, _void(), {
49720
+ kind: "mutation",
49721
+ auth: "protected"
49722
+ }),
49723
+ volumeUp: method(stepInput, _void(), {
49724
+ kind: "mutation",
49725
+ auth: "protected"
49726
+ }),
49727
+ volumeDown: method(stepInput, _void(), {
49728
+ kind: "mutation",
49729
+ auth: "protected"
49730
+ }),
49731
+ channelUp: method(stepInput, _void(), {
49732
+ kind: "mutation",
49733
+ auth: "protected"
49734
+ }),
49735
+ channelDown: method(stepInput, _void(), {
49736
+ kind: "mutation",
49737
+ auth: "protected"
49738
+ }),
49739
+ play: method(object({ deviceId: number().int().nonnegative() }), _void(), {
49740
+ kind: "mutation",
49741
+ auth: "protected"
49742
+ }),
49743
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
49744
+ kind: "mutation",
49745
+ auth: "protected"
49746
+ }),
49747
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
49748
+ kind: "mutation",
49749
+ auth: "protected"
49750
+ }),
49751
+ next: method(object({ deviceId: number().int().nonnegative() }), _void(), {
49752
+ kind: "mutation",
49753
+ auth: "protected"
49754
+ }),
49755
+ previous: method(object({ deviceId: number().int().nonnegative() }), _void(), {
49756
+ kind: "mutation",
49757
+ auth: "protected"
49758
+ }),
49759
+ seek: method(object({
49760
+ deviceId: number().int().nonnegative(),
49761
+ position: number().int().nonnegative()
49762
+ }), _void(), {
49763
+ kind: "mutation",
49764
+ auth: "protected"
49765
+ }),
49766
+ setVolume: method(object({
49767
+ deviceId: number().int().nonnegative(),
49768
+ volumeLevel: number().min(0).max(100)
49769
+ }), _void(), {
49770
+ kind: "mutation",
49771
+ auth: "protected"
49772
+ }),
49773
+ setMute: method(object({
49774
+ deviceId: number().int().nonnegative(),
49775
+ muted: boolean()
49776
+ }), _void(), {
49777
+ kind: "mutation",
49778
+ auth: "protected"
49779
+ }),
49780
+ setShuffle: method(object({
49781
+ deviceId: number().int().nonnegative(),
49782
+ shuffle: boolean()
49783
+ }), _void(), {
49784
+ kind: "mutation",
49785
+ auth: "protected"
49786
+ }),
49787
+ setRepeat: method(object({
49788
+ deviceId: number().int().nonnegative(),
49789
+ repeat: MediaPlayerRepeatSchema
49790
+ }), _void(), {
49791
+ kind: "mutation",
49792
+ auth: "protected"
49793
+ }),
49794
+ selectSource: method(object({
49795
+ deviceId: number().int().nonnegative(),
49796
+ source: string().min(1)
49797
+ }), _void(), {
49798
+ kind: "mutation",
49799
+ auth: "protected"
49800
+ }),
49801
+ playMedia: method(object({
49802
+ deviceId: number().int().nonnegative(),
49803
+ /** Media identifier / URL. */
49804
+ mediaId: string().min(1),
49805
+ /** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
49806
+ * passes it through to the upstream service. */
49807
+ mediaType: string().min(1)
49808
+ }), _void(), {
49809
+ kind: "mutation",
49810
+ auth: "protected"
49811
+ })
49812
+ },
49813
+ status: {
49814
+ schema: MediaPlayerStatusSchema,
49815
+ kind: "push"
49816
+ },
49817
+ /**
49818
+ * Runtime-state slice — mirrored by the kernel. UI players read the
49819
+ * full slice for live now-playing, volume, and progress updates
49820
+ * without polling.
49821
+ */
49822
+ runtimeState: MediaPlayerStatusSchema,
49823
+ /**
49824
+ * Runtime-state durability: **session** — a restored transport position describes a playback that stopped when the hub did.
49825
+ *
49826
+ * See `RuntimeStateDurability`. Enforced by
49827
+ * `scripts/check-runtime-state-durability.ts`.
49828
+ */
49829
+ durability: "session",
49830
+ /**
49831
+ * History (D850): volume (a level an operator or an automation sets; the
49832
+ * default 10 s floor folds a slider drag into its end value) and mute.
49833
+ * `position` is not recorded: it moves continuously while playing.
49834
+ */
49835
+ history: { fields: {
49836
+ volumeLevel: {
49837
+ kind: "gauge",
49838
+ unit: "%",
49839
+ deadband: 1
49840
+ },
49841
+ isMuted: { kind: "boolean" }
49842
+ } }
49843
+ };
49535
49844
  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;
49536
49845
  var NUMBER = {
49537
49846
  kind: "fixed",
@@ -58285,214 +58594,6 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
58285
58594
  ]);
58286
58595
  method(_void(), array(LoginMethodContributionSchema).readonly());
58287
58596
  /**
58288
- * Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
58289
- * Apple TV, Spotify, Roku, generic OTT receivers, …) on
58290
- * `DeviceType.MediaPlayer`. Disjoint from the camera streaming
58291
- * surface — those use `DeviceType.Camera` + the broker pipeline.
58292
- *
58293
- * The cap declares a wide method surface; not every backend supports
58294
- * every method. Drivers signal sub-capability via the
58295
- * `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
58296
- * corresponding method) so the UI gates buttons without a slice
58297
- * fetch — same pattern as `PanTiltZoom` for cameras.
58298
- */
58299
- var MediaPlayerStateSchema = _enum([
58300
- "off",
58301
- "on",
58302
- "idle",
58303
- "playing",
58304
- "paused",
58305
- "buffering",
58306
- "standby"
58307
- ]);
58308
- var MediaPlayerRepeatSchema = _enum([
58309
- "off",
58310
- "all",
58311
- "one"
58312
- ]);
58313
- var MediaInfoSchema = object({
58314
- /** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
58315
- * `podcast`, …). */
58316
- type: string(),
58317
- /** Human-readable title. */
58318
- title: string(),
58319
- /** Optional artist / channel / station label. */
58320
- artist: string().optional(),
58321
- /** Optional album / season / show name. */
58322
- album: string().optional(),
58323
- /** Optional cover-art / thumbnail URL. */
58324
- imageUrl: string().optional()
58325
- });
58326
- /**
58327
- * Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
58328
- * the device said so. `assumed`: the driver has no feedback (infrared) and
58329
- * tracks what it last SENT; it moves only after a send was accepted, and a
58330
- * human at the real remote makes it wrong. A UI shows an assumed value as a
58331
- * guess, never as a reading.
58332
- */
58333
- var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
58334
- /** The fields of a media-player status a driver can only guess. */
58335
- var MediaPlayerAssumedFieldSchema = _enum([
58336
- "state",
58337
- "volumeLevel",
58338
- "isMuted",
58339
- "source"
58340
- ]);
58341
- var MediaPlayerStatusSchema = object({
58342
- /** Playback lifecycle state. */
58343
- state: MediaPlayerStateSchema,
58344
- /**
58345
- * Whether the state fields are readings or the driver's own bookkeeping.
58346
- * A slice written before this field existed parses as `reported`.
58347
- */
58348
- stateSource: MediaPlayerStateSourceSchema.default("reported"),
58349
- /**
58350
- * Which fields are the driver's own guess. `stateSource` is `assumed` when
58351
- * this is not empty; a field not listed here is a reading even then (power
58352
- * from a running-state source, mute guessed from the last send).
58353
- */
58354
- assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
58355
- /** Volume as 0..100 inclusive. Null when the device has no volume
58356
- * surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
58357
- volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
58358
- /** Mute toggle distinct from volume=0. Null when no mute surface.
58359
- * Pair with `DeviceFeature.MediaPlayerMute`. */
58360
- isMuted: boolean().nullable(),
58361
- /** Active source / input. Empty when no source surface. */
58362
- source: string(),
58363
- /** Selectable sources. Empty when no source surface.
58364
- * Pair with `DeviceFeature.MediaPlayerSelectSource`. */
58365
- availableSources: array(string()),
58366
- /** Currently-playing media info. Null when nothing is playing. */
58367
- currentMedia: MediaInfoSchema.nullable(),
58368
- /** Current playback position in ms. Null when not seekable or
58369
- * nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
58370
- position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
58371
- /** Total duration of the current media in ms. Null when unknown
58372
- * (live stream) or nothing is playing. */
58373
- duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
58374
- /** Shuffle toggle. Null when no shuffle surface.
58375
- * Pair with `DeviceFeature.MediaPlayerShuffle`. */
58376
- shuffle: boolean().nullable(),
58377
- /** Repeat mode. Null when no repeat surface.
58378
- * Pair with `DeviceFeature.MediaPlayerRepeat`. */
58379
- repeat: MediaPlayerRepeatSchema.nullable(),
58380
- /** Ms epoch when the slice was last updated. */
58381
- lastChangedAt: number()
58382
- });
58383
- var mediaPlayerCapability = {
58384
- name: "media-player",
58385
- scope: "device",
58386
- deviceNative: true,
58387
- mode: "singleton",
58388
- deviceTypes: [DeviceType.MediaPlayer],
58389
- methods: {
58390
- play: method(object({ deviceId: number().int().nonnegative() }), _void(), {
58391
- kind: "mutation",
58392
- auth: "protected"
58393
- }),
58394
- pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
58395
- kind: "mutation",
58396
- auth: "protected"
58397
- }),
58398
- stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
58399
- kind: "mutation",
58400
- auth: "protected"
58401
- }),
58402
- next: method(object({ deviceId: number().int().nonnegative() }), _void(), {
58403
- kind: "mutation",
58404
- auth: "protected"
58405
- }),
58406
- previous: method(object({ deviceId: number().int().nonnegative() }), _void(), {
58407
- kind: "mutation",
58408
- auth: "protected"
58409
- }),
58410
- seek: method(object({
58411
- deviceId: number().int().nonnegative(),
58412
- position: number().int().nonnegative()
58413
- }), _void(), {
58414
- kind: "mutation",
58415
- auth: "protected"
58416
- }),
58417
- setVolume: method(object({
58418
- deviceId: number().int().nonnegative(),
58419
- volumeLevel: number().min(0).max(100)
58420
- }), _void(), {
58421
- kind: "mutation",
58422
- auth: "protected"
58423
- }),
58424
- setMute: method(object({
58425
- deviceId: number().int().nonnegative(),
58426
- muted: boolean()
58427
- }), _void(), {
58428
- kind: "mutation",
58429
- auth: "protected"
58430
- }),
58431
- setShuffle: method(object({
58432
- deviceId: number().int().nonnegative(),
58433
- shuffle: boolean()
58434
- }), _void(), {
58435
- kind: "mutation",
58436
- auth: "protected"
58437
- }),
58438
- setRepeat: method(object({
58439
- deviceId: number().int().nonnegative(),
58440
- repeat: MediaPlayerRepeatSchema
58441
- }), _void(), {
58442
- kind: "mutation",
58443
- auth: "protected"
58444
- }),
58445
- selectSource: method(object({
58446
- deviceId: number().int().nonnegative(),
58447
- source: string().min(1)
58448
- }), _void(), {
58449
- kind: "mutation",
58450
- auth: "protected"
58451
- }),
58452
- playMedia: method(object({
58453
- deviceId: number().int().nonnegative(),
58454
- /** Media identifier / URL. */
58455
- mediaId: string().min(1),
58456
- /** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
58457
- * passes it through to the upstream service. */
58458
- mediaType: string().min(1)
58459
- }), _void(), {
58460
- kind: "mutation",
58461
- auth: "protected"
58462
- })
58463
- },
58464
- status: {
58465
- schema: MediaPlayerStatusSchema,
58466
- kind: "push"
58467
- },
58468
- /**
58469
- * Runtime-state slice — mirrored by the kernel. UI players read the
58470
- * full slice for live now-playing, volume, and progress updates
58471
- * without polling.
58472
- */
58473
- runtimeState: MediaPlayerStatusSchema,
58474
- /**
58475
- * Runtime-state durability: **session** — a restored transport position describes a playback that stopped when the hub did.
58476
- *
58477
- * See `RuntimeStateDurability`. Enforced by
58478
- * `scripts/check-runtime-state-durability.ts`.
58479
- */
58480
- durability: "session",
58481
- /**
58482
- * History (D850): volume (a level an operator or an automation sets; the
58483
- * default 10 s floor folds a slider drag into its end value) and mute.
58484
- * `position` is not recorded: it moves continuously while playing.
58485
- */
58486
- history: { fields: {
58487
- volumeLevel: {
58488
- kind: "gauge",
58489
- unit: "%",
58490
- deadband: 1
58491
- },
58492
- isMuted: { kind: "boolean" }
58493
- } }
58494
- };
58495
- /**
58496
58597
  * mesh-network — collection cap for mesh-VPN providers.
58497
58598
  *
58498
58599
  * Different shape from `network-access` (public tunnels):
@@ -67251,6 +67352,21 @@ var NcTemplateVarKindSchema = _enum([
67251
67352
  "sound",
67252
67353
  "system"
67253
67354
  ]);
67355
+ /**
67356
+ * The default title/body a rule of one SITUATION is delivered with when the
67357
+ * operator wrote no template — served so an editor can pre-fill it (and the
67358
+ * operator can rebuild it from placeholders) instead of starting from a blank
67359
+ * box that, once saved, silently replaces it. `id` names the situation inside
67360
+ * a rule `kind`: `appliance-cycle` is a `sensor` rule whose device is an
67361
+ * appliance finishing a cycle. Texts are raw templates (`{{var}}` intact), in
67362
+ * the hub's current language and with its overrides applied.
67363
+ */
67364
+ var NcTemplateDefaultSchema = object({
67365
+ id: _enum(["appliance-cycle"]),
67366
+ kind: NcRuleKindSchema,
67367
+ title: string(),
67368
+ body: string()
67369
+ });
67254
67370
  /** Which producer renders a template: an ordinary rule, a timelapse, a digest. */
67255
67371
  var NcTemplateFamilySchema = _enum([
67256
67372
  "rule",
@@ -68106,7 +68222,11 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
68106
68222
  }), method(object({}), object({
68107
68223
  catalog: array(NcConditionDescriptorSchema),
68108
68224
  taxonomy: NcTaxonomySchema.optional()
68109
- })), method(object({}), object({ vars: array(NcTemplateVarDescriptorSchema) })), method(NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, {
68225
+ })), method(object({}), object({
68226
+ vars: array(NcTemplateVarDescriptorSchema),
68227
+ /** Per-situation default texts; absent on a hub that predates them. */
68228
+ defaults: array(NcTemplateDefaultSchema)
68229
+ })), method(NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, {
68110
68230
  kind: "mutation",
68111
68231
  access: "view"
68112
68232
  }), 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 }), {
@@ -74274,7 +74394,13 @@ var RemoteMediaCommandSchema = _enum([
74274
74394
  "next",
74275
74395
  "previous",
74276
74396
  "setMute",
74277
- "selectSource"
74397
+ "selectSource",
74398
+ "turnOn",
74399
+ "turnOff",
74400
+ "volumeUp",
74401
+ "volumeDown",
74402
+ "channelUp",
74403
+ "channelDown"
74278
74404
  ]);
74279
74405
  /** A send result, or `not-routed`: the role is not bound, so the native cap answers. */
74280
74406
  var RemoteMediaCommandResultSchema = discriminatedUnion("status", [...RemoteSendResultSchema.options, object({ status: literal("not-routed") })]);
@@ -74295,7 +74421,7 @@ method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.e
74295
74421
  }), RemoteSendResultSchema, {
74296
74422
  kind: "mutation",
74297
74423
  auth: "protected"
74298
- }), method(deviceInput.extend({
74424
+ }), method(deviceInput, MediaPlayerStatusSchema.nullable(), { auth: "protected" }), method(deviceInput.extend({
74299
74425
  command: RemoteMediaCommandSchema,
74300
74426
  muted: boolean().optional(),
74301
74427
  source: string().optional(),
@@ -76549,7 +76675,11 @@ listSignals: method(_void(), array(StreamSignalSchema).readonly()) }
76549
76675
  * `getSettingsUISchema()` surface.
76550
76676
  */
76551
76677
  var SwitchStatusSchema = object({
76552
- on: boolean().meta({ label: "On" }),
76678
+ /**
76679
+ * `null` = the device has never reported its state (a measurement that
76680
+ * has not happened is unknown, never `false`).
76681
+ */
76682
+ on: boolean().nullable().meta({ label: "On" }),
76553
76683
  /** Ms epoch of the last state change. Useful for UI "X minutes ago". */
76554
76684
  lastChangedAt: number()
76555
76685
  });
@@ -76574,7 +76704,7 @@ var switchCapability = {
76574
76704
  }) },
76575
76705
  events: { onStateChanged: { data: object({
76576
76706
  deviceId: number(),
76577
- on: boolean(),
76707
+ on: boolean().nullable(),
76578
76708
  lastChangedAt: number()
76579
76709
  }) } },
76580
76710
  status: {
@@ -80257,6 +80387,7 @@ function buildDescriptor(capName, kind) {
80257
80387
  * contributes one entry per bound cap present in this map.
80258
80388
  */
80259
80389
  var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
80390
+ DeviceFeature.MediaPlayerPower, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious;
80260
80391
  var btn = (idSuffix, row, col, init) => ({
80261
80392
  idSuffix,
80262
80393
  row,
@@ -86472,6 +86603,20 @@ Object.freeze({
86472
86603
  access: "view",
86473
86604
  role: "admin"
86474
86605
  },
86606
+ "mediaPlayer.channelDown": {
86607
+ capName: "media-player",
86608
+ capScope: "device",
86609
+ addonId: null,
86610
+ access: "create",
86611
+ role: "viewer"
86612
+ },
86613
+ "mediaPlayer.channelUp": {
86614
+ capName: "media-player",
86615
+ capScope: "device",
86616
+ addonId: null,
86617
+ access: "create",
86618
+ role: "viewer"
86619
+ },
86475
86620
  "mediaPlayer.getStatus": {
86476
86621
  capName: "media-player",
86477
86622
  capScope: "device",
@@ -86563,6 +86708,34 @@ Object.freeze({
86563
86708
  access: "create",
86564
86709
  role: "viewer"
86565
86710
  },
86711
+ "mediaPlayer.turnOff": {
86712
+ capName: "media-player",
86713
+ capScope: "device",
86714
+ addonId: null,
86715
+ access: "create",
86716
+ role: "viewer"
86717
+ },
86718
+ "mediaPlayer.turnOn": {
86719
+ capName: "media-player",
86720
+ capScope: "device",
86721
+ addonId: null,
86722
+ access: "create",
86723
+ role: "viewer"
86724
+ },
86725
+ "mediaPlayer.volumeDown": {
86726
+ capName: "media-player",
86727
+ capScope: "device",
86728
+ addonId: null,
86729
+ access: "create",
86730
+ role: "viewer"
86731
+ },
86732
+ "mediaPlayer.volumeUp": {
86733
+ capName: "media-player",
86734
+ capScope: "device",
86735
+ addonId: null,
86736
+ access: "create",
86737
+ role: "viewer"
86738
+ },
86566
86739
  "meshNetwork.getStatus": {
86567
86740
  capName: "mesh-network",
86568
86741
  capScope: "system",
@@ -90119,6 +90292,13 @@ Object.freeze({
90119
90292
  access: "create",
90120
90293
  role: "admin"
90121
90294
  },
90295
+ "remote.getAssumedStatus": {
90296
+ capName: "remote",
90297
+ capScope: "system",
90298
+ addonId: null,
90299
+ access: "view",
90300
+ role: "admin"
90301
+ },
90122
90302
  "remote.getConfig": {
90123
90303
  capName: "remote",
90124
90304
  capScope: "system",
@@ -93796,6 +93976,16 @@ Object.freeze({
93796
93976
  form: "single",
93797
93977
  optional: true
93798
93978
  }],
93979
+ "mediaPlayer.channelDown": [{
93980
+ name: "deviceId",
93981
+ form: "single",
93982
+ optional: false
93983
+ }],
93984
+ "mediaPlayer.channelUp": [{
93985
+ name: "deviceId",
93986
+ form: "single",
93987
+ optional: false
93988
+ }],
93799
93989
  "mediaPlayer.getStatus": [{
93800
93990
  name: "deviceId",
93801
93991
  form: "single",
@@ -93861,6 +94051,26 @@ Object.freeze({
93861
94051
  form: "single",
93862
94052
  optional: false
93863
94053
  }],
94054
+ "mediaPlayer.turnOff": [{
94055
+ name: "deviceId",
94056
+ form: "single",
94057
+ optional: false
94058
+ }],
94059
+ "mediaPlayer.turnOn": [{
94060
+ name: "deviceId",
94061
+ form: "single",
94062
+ optional: false
94063
+ }],
94064
+ "mediaPlayer.volumeDown": [{
94065
+ name: "deviceId",
94066
+ form: "single",
94067
+ optional: false
94068
+ }],
94069
+ "mediaPlayer.volumeUp": [{
94070
+ name: "deviceId",
94071
+ form: "single",
94072
+ optional: false
94073
+ }],
93864
94074
  "meter.getStatus": [{
93865
94075
  name: "deviceId",
93866
94076
  form: "single",
@@ -95026,6 +95236,11 @@ Object.freeze({
95026
95236
  form: "single",
95027
95237
  optional: true
95028
95238
  }],
95239
+ "remote.getAssumedStatus": [{
95240
+ name: "deviceId",
95241
+ form: "single",
95242
+ optional: false
95243
+ }],
95029
95244
  "remote.getConfig": [{
95030
95245
  name: "deviceId",
95031
95246
  form: "single",
@@ -96545,6 +96760,7 @@ var STATE_SUMMARY_VARS = [
96545
96760
  [...RULE_TEXT],
96546
96761
  ([...RULE_TEXT], [...DEVICE_EVENTS]),
96547
96762
  ([...RULE_TEXT], [...COMBINED_ALARM]),
96763
+ ([...RULE_TEXT], [...COMBINED_ALARM]),
96548
96764
  ([...RULE_TEXT], [...DEVICE_EVENTS]),
96549
96765
  ([...RULE_TEXT], [...BATTERY, ...CONSUMABLE]),
96550
96766
  ([...RULE_TEXT], [...CONSUMABLE]),
@@ -97448,7 +97664,7 @@ object({
97448
97664
  * short-circuits any cap the calling process already provides.
97449
97665
  */
97450
97666
  /** The addon that owns the import direction, and every `ha_*` broker. */
97451
- var HA_PROVIDER_ADDON_ID = "provider-homeassistant";
97667
+ var HA_PROVIDER_ADDON_ID$1 = "provider-homeassistant";
97452
97668
  /** The `BrokerInfo.kind` tag the Home Assistant provider stamps. */
97453
97669
  var HA_BROKER_KIND = "home-assistant";
97454
97670
  /**
@@ -97462,6 +97678,54 @@ var HA_BROKER_KIND = "home-assistant";
97462
97678
  async function listHomeAssistantBrokers(query) {
97463
97679
  return (await query({})).filter((broker) => broker.kind === HA_BROKER_KIND);
97464
97680
  }
97681
+ function haInstanceSettingsPortsOver(api) {
97682
+ const listInstances = async () => {
97683
+ const all = await api.list.query();
97684
+ const rows = [];
97685
+ for (const integration of all) {
97686
+ if (integration.addonId !== "provider-homeassistant") continue;
97687
+ const settings = await api.getSettings.query({ id: integration.id });
97688
+ const brokerId = settings["brokerId"];
97689
+ rows.push({
97690
+ integrationId: integration.id,
97691
+ brokerId: typeof brokerId === "string" && brokerId.length > 0 ? brokerId : null,
97692
+ settings
97693
+ });
97694
+ }
97695
+ return rows;
97696
+ };
97697
+ return {
97698
+ listInstances,
97699
+ patchInstanceSettings: async (integrationId, patch) => {
97700
+ if (!(await api.list.query()).some((i) => i.id === integrationId && i.addonId === "provider-homeassistant")) return false;
97701
+ const stored = await api.getSettings.query({ id: integrationId });
97702
+ await api.setSettings.mutate({
97703
+ id: integrationId,
97704
+ settings: {
97705
+ ...stored,
97706
+ ...patch
97707
+ },
97708
+ skipRestart: true
97709
+ });
97710
+ return true;
97711
+ }
97712
+ };
97713
+ }
97714
+ /** The brokerId → settings view of the instances: what a reader keeps per broker. */
97715
+ function settingsByBroker(rows) {
97716
+ const out = /* @__PURE__ */ new Map();
97717
+ for (const row of rows) if (row.brokerId !== null) out.set(row.brokerId, row.settings);
97718
+ return out;
97719
+ }
97720
+ /** Read the instances, or report why not and answer nothing (a reader falls back to the legacy key). */
97721
+ async function listInstancesOrNothing(ports, onError) {
97722
+ try {
97723
+ return await ports.listInstances();
97724
+ } catch (err) {
97725
+ onError(errMsg(err));
97726
+ return [];
97727
+ }
97728
+ }
97465
97729
  //#endregion
97466
97730
  Object.defineProperty(exports, "AlarmArmModeSchema", {
97467
97731
  enumerable: true,
@@ -97568,7 +97832,7 @@ Object.defineProperty(exports, "HA_BROKER_KIND", {
97568
97832
  Object.defineProperty(exports, "HA_PROVIDER_ADDON_ID", {
97569
97833
  enumerable: true,
97570
97834
  get: function() {
97571
- return HA_PROVIDER_ADDON_ID;
97835
+ return HA_PROVIDER_ADDON_ID$1;
97572
97836
  }
97573
97837
  });
97574
97838
  Object.defineProperty(exports, "HvacModeSchema", {
@@ -97871,6 +98135,12 @@ Object.defineProperty(exports, "gasCapability", {
97871
98135
  return gasCapability;
97872
98136
  }
97873
98137
  });
98138
+ Object.defineProperty(exports, "haInstanceSettingsPortsOver", {
98139
+ enumerable: true,
98140
+ get: function() {
98141
+ return haInstanceSettingsPortsOver;
98142
+ }
98143
+ });
97874
98144
  Object.defineProperty(exports, "humidifierCapability", {
97875
98145
  enumerable: true,
97876
98146
  get: function() {
@@ -97913,6 +98183,12 @@ Object.defineProperty(exports, "listHomeAssistantBrokers", {
97913
98183
  return listHomeAssistantBrokers;
97914
98184
  }
97915
98185
  });
98186
+ Object.defineProperty(exports, "listInstancesOrNothing", {
98187
+ enumerable: true,
98188
+ get: function() {
98189
+ return listInstancesOrNothing;
98190
+ }
98191
+ });
97916
98192
  Object.defineProperty(exports, "literal", {
97917
98193
  enumerable: true,
97918
98194
  get: function() {
@@ -98093,6 +98369,12 @@ Object.defineProperty(exports, "sendToExportedTarget", {
98093
98369
  return sendToExportedTarget;
98094
98370
  }
98095
98371
  });
98372
+ Object.defineProperty(exports, "settingsByBroker", {
98373
+ enumerable: true,
98374
+ get: function() {
98375
+ return settingsByBroker;
98376
+ }
98377
+ });
98096
98378
  Object.defineProperty(exports, "smokeCapability", {
98097
98379
  enumerable: true,
98098
98380
  get: function() {