@camstack/addon-provider-homematic 1.2.205 → 1.2.206

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.
Files changed (17) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/_stub.js +2 -2
  3. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-BBYiqZ5h.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-DZpqsn6u.mjs} +4 -4
  4. package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CiaZc7Zu.mjs +26 -0
  5. package/dist/addon.js +395 -88
  6. package/dist/addon.mjs +395 -88
  7. package/dist/{hostInit-nT-RhOBP.mjs → hostInit-DBO78Hu-.mjs} +3 -3
  8. package/dist/remoteEntry.js +1 -1
  9. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-BI01xl_h.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-D1CbMi19.mjs} +1 -1
  10. package/dist/widgets/_stub.js +1 -1
  11. package/dist/widgets/{_virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_widgets-B0ssCAy7.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_widgets-Bwve1HPK.mjs} +2 -2
  12. package/dist/widgets/_virtual_mf___mfe_internal__addon_provider_homematic_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DaUa1YeZ.mjs +26 -0
  13. package/dist/widgets/{hostInit-phYEFIYx.mjs → hostInit-DSjxilwJ.mjs} +2 -2
  14. package/dist/widgets/remoteEntry.js +1 -1
  15. package/package.json +3 -3
  16. package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-Civ5HlCQ.mjs +0 -26
  17. package/dist/widgets/_virtual_mf___mfe_internal__addon_provider_homematic_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-De1hiEmR.mjs +0 -26
package/dist/addon.mjs CHANGED
@@ -9,7 +9,7 @@ import { networkInterfaces } from "node:os";
9
9
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
10
10
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
11
11
  //#endregion
12
- //#region ../types/dist/event-category-Hwx_JSCU.mjs
12
+ //#region ../types/dist/event-category-CY27-fF0.mjs
13
13
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
14
14
  EventCategory["SystemBoot"] = "system.boot";
15
15
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -509,7 +509,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
509
509
  */
510
510
  EventCategory["NetworkLinkOnStatusChanged"] = "network-link.onStatusChanged";
511
511
  /**
512
- * Emitted by the battery cap provider WHEN `wakeForStream` enters the
512
+ * Emitted by the battery cap provider WHEN `wakeUp` enters the
513
513
  * "wake in progress" window — between the Baichuan wake-up issue and
514
514
  * the camera's first dialed-back RTP packet. The stream-broker
515
515
  * manager subscribes to flip the per-broker placeholder reason to
@@ -841,7 +841,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
841
841
  return EventCategory;
842
842
  }({});
843
843
  //#endregion
844
- //#region ../types/dist/composed-stable-id-BBL71oUQ.mjs
844
+ //#region ../types/dist/composed-stable-id-BNTaDZEh.mjs
845
845
  /**
846
846
  import { errMsg } from '@camstack/types'
847
847
  * Extract a human-readable message from an unknown error value.
@@ -980,12 +980,19 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
980
980
  return DeviceType;
981
981
  }({});
982
982
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
983
+ /** The device reports a battery reading (the `battery` cap). Says nothing about sleep. */
983
984
  DeviceFeature["BatteryOperated"] = "battery-operated";
985
+ /**
986
+ * The device goes into low-power sleep and must be WOKEN before it streams
987
+ * (the `low-power-sleep` cap, `wakeUp`). A battery reading alone is
988
+ * not this: a battery sensor reports charge and never sleeps (#459, Q2).
989
+ */
990
+ DeviceFeature["Sleeps"] = "sleeps";
984
991
  DeviceFeature["Rebootable"] = "rebootable";
985
992
  /**
986
993
  * Device supports an on-demand re-sync of its derived spec with its
987
- * upstream source — drives the generic Re-sync button. The owning
988
- * provider implements the action via the `device-adoption.resync` cap.
994
+ * upstream source — drives the generic Re-sync button. Present when the
995
+ * device has the `resync` cap bound (#459, Q6).
989
996
  */
990
997
  DeviceFeature["Resyncable"] = "resyncable";
991
998
  DeviceFeature["NativeSnapshot"] = "native-snapshot";
@@ -1069,9 +1076,6 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1069
1076
  DeviceFeature["FanDirection"] = "fan-direction";
1070
1077
  /** Fan exposes an oscillation toggle. */
1071
1078
  DeviceFeature["FanOscillating"] = "fan-oscillating";
1072
- /** Lock requires a PIN code on lock/unlock. Gates the code-entry
1073
- * field on the UI lock-controls panel. */
1074
- DeviceFeature["LockPinRequired"] = "lock-pin-required";
1075
1079
  /** Lock supports a latch-release ("open door") action distinct from
1076
1080
  * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
1077
1081
  * `supported_features`. Gates the Open Door button in the UI. */
@@ -1102,8 +1106,6 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1102
1106
  DeviceFeature["MediaPlayerChannelStep"] = "media-player-channel-step";
1103
1107
  /** Media player exposes power on / off. */
1104
1108
  DeviceFeature["MediaPlayerPower"] = "media-player-power";
1105
- /** Alarm panel requires a PIN code on arm/disarm. */
1106
- DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
1107
1109
  /** Presence device carries GPS coordinates (lat/lng/accuracy) in
1108
1110
  * addition to a textual location. */
1109
1111
  DeviceFeature["PresenceGps"] = "presence-gps";
@@ -1123,15 +1125,9 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1123
1125
  /** Automation `trigger` accepts a skipCondition flag — fires the
1124
1126
  * automation's actions while bypassing its condition block. */
1125
1127
  DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
1126
- /** Robot vacuum exposes a live cleaning map (image child). Gates the
1127
- * map tile in the vacuum UI. */
1128
- DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
1129
1128
  /** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
1130
1129
  * switches group. */
1131
1130
  DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
1132
- /** Robot mower exposes a live mowing map (SVG image child). Gates the
1133
- * mower map tile. */
1134
- DeviceFeature["MowerHasMap"] = "mower-has-map";
1135
1131
  /** Robot mower exposes targeted mowing (all-area / zones / edges /
1136
1132
  * spots) — gates the Mow action + map selectors. */
1137
1133
  DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
@@ -6119,7 +6115,7 @@ var ZodIssueCode = {
6119
6115
  var ZodFirstPartyTypeKind;
6120
6116
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6121
6117
  //#endregion
6122
- //#region ../types/dist/sleep-D6Pih0Qt.mjs
6118
+ //#region ../types/dist/sleep-BT1bLgPq.mjs
6123
6119
  /**
6124
6120
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6125
6121
  * window to float samples (D455).
@@ -17478,6 +17474,14 @@ var CAP_VOCABULARY_BY_NAME = {
17478
17474
  icon: "refresh-cw"
17479
17475
  }]
17480
17476
  },
17477
+ "resync": {
17478
+ scope: "device",
17479
+ noun: {
17480
+ en: "Re-sync",
17481
+ it: "Risincronizzazione"
17482
+ },
17483
+ notOperatorFacing: { resync: "device adoption — re-aligning a device with its source is an onboarding step, not an automation action" }
17484
+ },
17481
17485
  "recording": {
17482
17486
  scope: "device",
17483
17487
  noun: {
@@ -19489,7 +19493,6 @@ var CAP_VOCABULARY_BY_NAME = {
19489
19493
  en: "Battery",
19490
19494
  it: "Batteria"
19491
19495
  },
19492
- notOperatorFacing: { wakeForStream: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage" },
19493
19496
  state: [
19494
19497
  {
19495
19498
  kind: "numeric",
@@ -19599,6 +19602,14 @@ var CAP_VOCABULARY_BY_NAME = {
19599
19602
  icon: "moon"
19600
19603
  }]
19601
19604
  },
19605
+ "low-power-sleep": {
19606
+ scope: "device",
19607
+ noun: {
19608
+ en: "Low-power sleep",
19609
+ it: "Sospensione a basso consumo"
19610
+ },
19611
+ notOperatorFacing: { wakeUp: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage" }
19612
+ },
19602
19613
  "network-link": {
19603
19614
  scope: "device",
19604
19615
  noun: {
@@ -20510,6 +20521,7 @@ var CAP_NAMES = Object.freeze([
20510
20521
  "log-channels",
20511
20522
  "log-destination",
20512
20523
  "login-method",
20524
+ "low-power-sleep",
20513
20525
  "media-player",
20514
20526
  "mesh-network",
20515
20527
  "meter",
@@ -20563,6 +20575,7 @@ var CAP_NAMES = Object.freeze([
20563
20575
  "records",
20564
20576
  "remote",
20565
20577
  "remote-layout-components",
20578
+ "resync",
20566
20579
  "running-state",
20567
20580
  "scene-monitor",
20568
20581
  "schedulers",
@@ -20666,7 +20679,7 @@ Object.freeze({
20666
20679
  ]
20667
20680
  },
20668
20681
  {
20669
- "path": "requiresCode",
20682
+ "path": "codeRequired",
20670
20683
  "valueType": "boolean"
20671
20684
  }
20672
20685
  ],
@@ -21734,7 +21747,24 @@ Object.freeze({
21734
21747
  "jammed",
21735
21748
  "door-open"
21736
21749
  ]
21750
+ }, {
21751
+ "path": "codeRequired",
21752
+ "valueType": "boolean"
21737
21753
  }],
21754
+ "low-power-sleep": [
21755
+ {
21756
+ "path": "sleeping",
21757
+ "valueType": "boolean"
21758
+ },
21759
+ {
21760
+ "path": "lastContactAt",
21761
+ "valueType": "number"
21762
+ },
21763
+ {
21764
+ "path": "lastUpdated",
21765
+ "valueType": "number"
21766
+ }
21767
+ ],
21738
21768
  "media-player": [
21739
21769
  {
21740
21770
  "path": "state",
@@ -22904,7 +22934,7 @@ Object.freeze({
22904
22934
  }
22905
22935
  });
22906
22936
  //#endregion
22907
- //#region ../types/dist/implemented-methods-u7ddjc-_.mjs
22937
+ //#region ../types/dist/implemented-methods-k3KProJd.mjs
22908
22938
  /**
22909
22939
  * The ffmpeg build every CamStack node downloads, per platform and arch.
22910
22940
  *
@@ -49340,6 +49370,67 @@ object({
49340
49370
  /** Namespaces the client listed that no longer exist. */
49341
49371
  deleted: array(PreferenceNamespaceSchema)
49342
49372
  });
49373
+ /**
49374
+ * The wire shapes of `apiCatalog.*` — the API explorer's data (planning#595).
49375
+ *
49376
+ * One entry per tRPC method the hub serves, capability and core routes alike,
49377
+ * read off the live router by the hub (never a hand-written list).
49378
+ */
49379
+ var ApiProcedureKindSchema = _enum([
49380
+ "query",
49381
+ "mutation",
49382
+ "subscription"
49383
+ ]);
49384
+ /** The gate a method runs behind. */
49385
+ var ApiProcedureTierSchema = _enum([
49386
+ "public",
49387
+ "protected",
49388
+ "admin"
49389
+ ]);
49390
+ /** The token scope a capability route is matched against (its `METHOD_ACCESS_MAP` row). */
49391
+ var ApiCatalogScopeSchema = object({
49392
+ capName: string(),
49393
+ capScope: _enum(["device", "system"]),
49394
+ access: _enum([
49395
+ "view",
49396
+ "create",
49397
+ "delete"
49398
+ ]),
49399
+ role: string()
49400
+ });
49401
+ var ApiCatalogEntrySchema = object({
49402
+ /** `<router>.<method>` — the tRPC path. */
49403
+ path: string(),
49404
+ router: string(),
49405
+ method: string(),
49406
+ kind: ApiProcedureKindSchema,
49407
+ tier: ApiProcedureTierSchema,
49408
+ source: _enum(["capability", "core"]),
49409
+ /** `null` on a core route: it needs authentication only (plus admin where its tier says so). */
49410
+ scope: ApiCatalogScopeSchema.nullable(),
49411
+ hasInput: boolean()
49412
+ });
49413
+ /**
49414
+ * May the CALLER call a method. The list has no input, so a method reached
49415
+ * only through a device grant is `per-device`: the real call is allowed or
49416
+ * refused on the device its input names.
49417
+ */
49418
+ var ApiCallableSchema = _enum([
49419
+ "yes",
49420
+ "no",
49421
+ "per-device"
49422
+ ]);
49423
+ object({ methods: array(ApiCatalogEntrySchema.extend({ callable: ApiCallableSchema })) });
49424
+ /** A JSON Schema document, as the explorer receives it. */
49425
+ var JsonSchemaDocumentSchema = record$1(string(), unknown());
49426
+ object({
49427
+ path: string(),
49428
+ hasInput: boolean(),
49429
+ /** The INPUT JSON schema (what the caller sends); `null` without input or when it could not be produced. */
49430
+ schema: JsonSchemaDocumentSchema.nullable(),
49431
+ /** Why no schema could be produced (a non-Zod parser, an unrepresentable type). */
49432
+ error: string().nullable()
49433
+ });
49343
49434
  _enum(["new-session", "step-up"]);
49344
49435
  /** The languages the hub's app landing pages are written in (D858). */
49345
49436
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -53198,9 +53289,8 @@ var airQualitySensorCapability = {
53198
53289
  * Many panels require a PIN code on arm / disarm — the optional
53199
53290
  * `code` field on the methods passes it through to the upstream
53200
53291
  * service; it's NEVER persisted in the runtime slice or any event
53201
- * payload. The presence of a required code is signalled by
53202
- * `DeviceFeature.AlarmPinRequired` so the UI gates a code-entry
53203
- * field without a slice fetch.
53292
+ * payload. Whether a code is required is the slice's `codeRequired`
53293
+ * (#459): `null` when the provider cannot tell (D393).
53204
53294
  *
53205
53295
  * `availableModes` mirrors HA's `supported_features`-derived arm
53206
53296
  * mode list — the UI renders only the buttons the panel accepts.
@@ -53239,9 +53329,13 @@ var AlarmPanelStatusSchema = object({
53239
53329
  /** Subset of arm modes the panel accepts. UI renders one button per
53240
53330
  * mode in this list. */
53241
53331
  availableModes: array(AlarmArmModeSchema),
53242
- /** Whether the panel requires a PIN on arm / disarm. Mirrors
53243
- * `DeviceFeature.AlarmPinRequired` for slice consumers. */
53244
- requiresCode: boolean(),
53332
+ /**
53333
+ * Whether the panel requires a PIN on arm / disarm (#459; the field was
53334
+ * `requiresCode`, and the `alarm-pin-required` device feature is gone).
53335
+ * `null` = the provider cannot tell (D393), never `false`. A slice restored
53336
+ * from before the rename is upgraded at boot by `restoredFieldRenames`.
53337
+ */
53338
+ codeRequired: boolean().nullable(),
53245
53339
  /** Ms epoch when the slice was last updated. */
53246
53340
  lastChangedAt: number$1()
53247
53341
  });
@@ -53298,7 +53392,7 @@ var alarmPanelCapability = {
53298
53392
  arm: method(object({
53299
53393
  deviceId: number$1().int().nonnegative(),
53300
53394
  mode: AlarmArmModeSchema,
53301
- /** Optional PIN code. Required when `requiresCode === true`.
53395
+ /** Optional PIN code. Required when `codeRequired === true`.
53302
53396
  * Passed through to the upstream service; never persisted. */
53303
53397
  code: string().min(1).optional()
53304
53398
  }), _void(), {
@@ -53415,7 +53509,7 @@ var alarmPanelCapability = {
53415
53509
  /**
53416
53510
  * Runtime-state slice — mirrored by the kernel. UI panel reads the
53417
53511
  * full slice; renders an arm button per `availableModes` entry and
53418
- * a PIN field iff `requiresCode === true`.
53512
+ * a PIN field iff `codeRequired === true`.
53419
53513
  */
53420
53514
  runtimeState: AlarmPanelStatusSchema,
53421
53515
  /**
@@ -53426,6 +53520,13 @@ var alarmPanelCapability = {
53426
53520
  */
53427
53521
  durability: "restored",
53428
53522
  /**
53523
+ * A slice persisted before #459 carries `requiresCode`; the boot seed reads it
53524
+ * once into `codeRequired` (`restoredPart`), so no reader meets the old key,
53525
+ * and rewrites the row once without it (`seedMirrorFromRow`) — so this entry
53526
+ * can be dropped after every node has booted once on a release that has it.
53527
+ */
53528
+ restoredFieldRenames: { requiresCode: "codeRequired" },
53529
+ /**
53429
53530
  * History (D850): the panel's lifecycle state as an `enum` series —
53430
53531
  * change-only, no floor, so an `arming -> pending -> triggered` sequence of a
53431
53532
  * few seconds keeps every step. Who armed it stays in the events ledger.
@@ -54623,9 +54724,9 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
54623
54724
  auth: "admin"
54624
54725
  });
54625
54726
  /**
54626
- * Battery status snapshot. Emitted by providers whose device is
54627
- * battery-operated (cameras with `DeviceFeature.BatteryOperated`,
54628
- * future sensor/button accessories). Consumers build their own "low
54727
+ * Battery status snapshot. Emitted by providers whose device reports a
54728
+ * battery (`DeviceFeature.BatteryOperated`): battery cameras, sensors,
54729
+ * buttons. Whether the device SLEEPS is `low-power-sleep`, not this cap. Consumers build their own "low
54629
54730
  * battery" alerting on top — the cap deliberately does NOT enforce a
54630
54731
  * threshold.
54631
54732
  */
@@ -54782,47 +54883,12 @@ var batteryCapability = {
54782
54883
  deviceNative: true,
54783
54884
  mode: "singleton",
54784
54885
  deviceTypes: BATTERY_DEVICE_TYPES,
54785
- methods: {
54786
54886
  /**
54787
- * Explicitly wake the camera from low-power sleep ahead of a
54788
- * streaming session start. Consumers that initiate a stream
54789
- * against a sleeping battery cam (HomeKit Secure Video, Alexa
54790
- * RTCSession, snapshot wrappers) call this with a short timeout
54791
- * before establishing the media pipeline — the broker's own
54792
- * passive wake-on-dial works but adds 5–7 seconds to first-frame,
54793
- * during which the consumer renders a black screen. Pre-waking
54794
- * compresses that gap.
54795
- *
54796
- * Returns `awoke: true` when the firmware acknowledged the wake
54797
- * before `timeoutMs`. Returns `awoke: false` when it timed out OR
54798
- * the cap surface is unavailable (no Baichuan / firmware
54799
- * channel); the caller should still attempt the stream — the
54800
- * passive broker wake remains as fallback.
54801
- */
54802
- wakeForStream: method(object({
54803
- deviceId: number$1(),
54804
- /** Bound on the wait. Sensible range 3000–10000ms. */
54805
- timeoutMs: number$1().int().min(500).max(3e4).default(8e3)
54806
- }), object({
54807
- awoke: boolean(),
54808
- durationMs: number$1()
54809
- }), {
54810
- kind: "mutation",
54811
- notOperatorFacing: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage"
54812
- }) },
54813
- /**
54814
- * A composed provider (battery ADDED to a pet feeder or container that has
54815
- * no wake surface) answers `wakeForStream` with the same "unavailable"
54816
- * result the contract already defines above: "Returns `awoke: false` when
54817
- * … the cap surface is unavailable." (D663).
54887
+ * No methods: waking a sleeping camera is `low-power-sleep.wakeUp`
54888
+ * (#459, Q2). A battery reading says nothing about sleep — a battery sensor
54889
+ * reports charge and never needs waking.
54818
54890
  */
54819
- composedMethods: { wakeForStream: {
54820
- kind: "answer",
54821
- value: {
54822
- awoke: false,
54823
- durationMs: 0
54824
- }
54825
- } },
54891
+ methods: {},
54826
54892
  events: {
54827
54893
  /**
54828
54894
  * Emitted whenever the cached status changes (firmware push OR
@@ -61854,6 +61920,69 @@ function normaliseIdentifiers(raw, options = {}) {
61854
61920
  rejected: refused
61855
61921
  };
61856
61922
  }
61923
+ /**
61924
+ * Cross-integration identity candidates (planning#593, step 2 of D1059's epic).
61925
+ *
61926
+ * Two devices brought by DIFFERENT integrations that share provider-declared
61927
+ * identifiers ({@link DeviceIdentifiers}) are candidates for being the same
61928
+ * physical object. This module holds the answer's shape; the device-manager
61929
+ * keeps the index that finds the pairs and the ONE rule that grades a match
61930
+ * (`classifyIdentityMatch`, `device-identity-index.ts`).
61931
+ *
61932
+ * The rule (operator, planning#590):
61933
+ *
61934
+ * | Matched keys | Confidence |
61935
+ * | ---------------------------------------------- | ----------- |
61936
+ * | two strong KINDS (e.g. `mac` + `serial`) | `auto` |
61937
+ * | `mac` + `ip` | `auto` |
61938
+ * | exactly one strong kind | `proposal` |
61939
+ * | weak keys only (`hostname`, `ip`) | no candidate|
61940
+ *
61941
+ * Strength counts distinct KINDS, not values: two MACs of one device matching
61942
+ * the other's two MACs are still one kind of evidence, so a proposal. In doubt,
61943
+ * no match.
61944
+ *
61945
+ * Read-only: a candidate is NOT a link. Links are step 3.
61946
+ */
61947
+ var IdentityConfidenceSchema = _enum(["auto", "proposal"]);
61948
+ /** One identifier both devices declared, with the same normalised value. */
61949
+ var IdentityMatchedKeySchema = object({
61950
+ key: DeviceIdentifierKeySchema,
61951
+ value: string()
61952
+ });
61953
+ /** One side of a pair: the device and the integration that brought it. */
61954
+ var IdentityCandidateDeviceSchema = object({
61955
+ deviceId: number$1().int(),
61956
+ addonId: string(),
61957
+ /** The integration instance (`int_NNNN`) that adopted it; `null` when none was stamped. */
61958
+ integrationId: string().nullable()
61959
+ });
61960
+ /** Two devices of different integrations sharing at least one strong identifier. `a.deviceId < b.deviceId`. */
61961
+ var IdentityCandidatePairSchema = object({
61962
+ a: IdentityCandidateDeviceSchema,
61963
+ b: IdentityCandidateDeviceSchema,
61964
+ /** Every identifier the two share, weak ones included, ordered by key then value. */
61965
+ keys: array(IdentityMatchedKeySchema).readonly(),
61966
+ confidence: IdentityConfidenceSchema
61967
+ });
61968
+ /**
61969
+ * The answer of `device-manager.listIdentityCandidates`.
61970
+ *
61971
+ * - `unknown` — the index has not loaded yet: nothing can be said, and it is
61972
+ * NOT an empty list (D315).
61973
+ * - `answered` — `pairs` holds every candidate. `undeclaredDeviceIds` are the
61974
+ * devices with no identifiers on record: whether they match anything is
61975
+ * UNKNOWN, never "no match" (D393). A device absent from both lists declared
61976
+ * identifiers and matched nobody.
61977
+ */
61978
+ var IdentityCandidatesSchema = discriminatedUnion("status", [object({
61979
+ status: literal("unknown"),
61980
+ reason: string()
61981
+ }), object({
61982
+ status: literal("answered"),
61983
+ pairs: array(IdentityCandidatePairSchema).readonly(),
61984
+ undeclaredDeviceIds: array(number$1().int()).readonly()
61985
+ })]);
61857
61986
  var DeviceSearchRequiresSchema = object({
61858
61987
  /** Capability names the field wants a value of. Absent when the field wants actions only. */
61859
61988
  caps: array(string()).readonly().optional(),
@@ -62894,6 +63023,9 @@ method(object({
62894
63023
  }), _void(), {
62895
63024
  kind: "mutation",
62896
63025
  auth: "admin"
63026
+ }), method(object({}), IdentityCandidatesSchema, {
63027
+ kind: "query",
63028
+ auth: "admin"
62897
63029
  }), method(_void(), array(string())), method(object({ name: string() }), _void(), {
62898
63030
  kind: "mutation",
62899
63031
  auth: "admin"
@@ -71432,6 +71564,13 @@ var LockControlStatusSchema = object({
71432
71564
  "jammed",
71433
71565
  "door-open"
71434
71566
  ]),
71567
+ /**
71568
+ * Whether lock / unlock need a PIN `code` (#459, replaces the
71569
+ * `lock-pin-required` device feature). `null` = the provider cannot tell
71570
+ * (D393) — never `false`. `.optional()` so a restored slice written before
71571
+ * the field still parses; readers treat absent exactly like `null`.
71572
+ */
71573
+ codeRequired: boolean().nullable().optional(),
71435
71574
  /** Ms epoch when the slice was last updated. */
71436
71575
  lastChangedAt: number$1()
71437
71576
  });
@@ -71889,6 +72028,90 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
71889
72028
  ]);
71890
72029
  method(_void(), array(LoginMethodContributionSchema).readonly()), NOT_A_DEVICE.IDENTITY;
71891
72030
  /**
72031
+ * low-power-sleep — a device that goes into low-power sleep and must be WOKEN
72032
+ * before it streams (#459, Q2). A battery camera (Reolink Argus, a robot's
72033
+ * on-board camera) is one; a battery SENSOR is not: it reports charge on the
72034
+ * `battery` cap and never sleeps. The two meanings used to share
72035
+ * `DeviceFeature.BatteryOperated`; this cap is the one that answers "sleeps",
72036
+ * and `DeviceFeature.Sleeps` is derived from it being bound with
72037
+ * `wakeUp` implemented.
72038
+ *
72039
+ * The state is the sleep inputs (`deriveBatteryPresence`): whether the device
72040
+ * is asleep, and the last time it PROVED it was reachable. Read from this slice
72041
+ * by the stream broker (`readBatterySleepFacts`), the recorder
72042
+ * (`recordingWakeDeps`) and the snapshot builtin. The broker's per-device
72043
+ * mirror is still also fed by `BatteryOnStatusChanged` events.
72044
+ */
72045
+ var LowPowerSleepStatusSchema = object({
72046
+ /**
72047
+ * True while the firmware is in low-power mode. A provider MUST avoid polling
72048
+ * during sleep — a read wakes the device and drains charge.
72049
+ */
72050
+ sleeping: boolean().meta({ label: "Sleeping" }),
72051
+ /**
72052
+ * Ms epoch of the last time the device proved it was reachable, from
72053
+ * PASSIVE signals only (a completed round-trip, an observed wake, a push).
72054
+ * Absent = never since this slice was born. The only input that separates
72055
+ * "asleep" from "gone".
72056
+ */
72057
+ lastContactAt: number$1().optional(),
72058
+ /** Ms epoch of the last observation. */
72059
+ lastUpdated: number$1().meta(readingMeta("none"))
72060
+ });
72061
+ var lowPowerSleepCapability = {
72062
+ name: "low-power-sleep",
72063
+ scope: "device",
72064
+ deviceNative: true,
72065
+ mode: "singleton",
72066
+ deviceTypes: [DeviceType.Camera],
72067
+ methods: {
72068
+ /**
72069
+ * Explicitly wake the device from low-power sleep ahead of a streaming
72070
+ * session start. Consumers that initiate a stream against a sleeping
72071
+ * camera (wake-on-play, the recorder, HomeKit, Alexa, snapshot wrappers)
72072
+ * call this with a short timeout before establishing the media pipeline —
72073
+ * the broker's own passive wake-on-dial works but adds 5–7 seconds to
72074
+ * first-frame. Pre-waking compresses that gap.
72075
+ *
72076
+ * Returns `awoke: true` when the firmware acknowledged the wake before
72077
+ * `timeoutMs`, `awoke: false` when it timed out; the caller should still
72078
+ * attempt the stream — the passive broker wake remains as fallback.
72079
+ */
72080
+ wakeUp: method(object({
72081
+ deviceId: number$1(),
72082
+ /** Bound on the wait. Sensible range 3000–10000ms. */
72083
+ timeoutMs: number$1().int().min(500).max(3e4).default(8e3)
72084
+ }), object({
72085
+ awoke: boolean(),
72086
+ durationMs: number$1()
72087
+ }), {
72088
+ kind: "mutation",
72089
+ notOperatorFacing: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage"
72090
+ }) },
72091
+ status: {
72092
+ schema: LowPowerSleepStatusSchema,
72093
+ kind: "push",
72094
+ empty: {
72095
+ sleeping: false,
72096
+ lastUpdated: 0
72097
+ }
72098
+ },
72099
+ runtimeState: LowPowerSleepStatusSchema,
72100
+ /**
72101
+ * Runtime-state durability: **restored** — a sleeping camera may not report
72102
+ * for hours; the restored sleep inputs are the only thing the sleep gate and
72103
+ * the presence derivation have (the same argument as `battery`).
72104
+ */
72105
+ durability: "restored",
72106
+ /** History (D850): none — battery never recorded a sleep series either. */
72107
+ history: "none",
72108
+ volatileStateFields: ["lastUpdated"],
72109
+ vocabulary: {
72110
+ noun: t("Low-power sleep", "Sospensione a basso consumo"),
72111
+ order: 5245
72112
+ }
72113
+ };
72114
+ /**
71892
72115
  * mesh-network — collection cap for mesh-VPN providers.
71893
72116
  *
71894
72117
  * Different shape from `network-access` (public tunnels):
@@ -89041,6 +89264,42 @@ var RemoteLayoutComponentSchema = object({
89041
89264
  });
89042
89265
  });
89043
89266
  method(object({}), array(RemoteLayoutComponentSchema), { auth: "protected" });
89267
+ /**
89268
+ * resync — a device whose derived spec can be re-aligned on demand with its
89269
+ * upstream source (#459, Q6). Registered by the containers an integration
89270
+ * adopted; `DeviceFeature.Resyncable` (the generic Re-sync button) is derived
89271
+ * from it being bound with `resync` implemented.
89272
+ *
89273
+ * The work itself stays where it is: the owning addon's `device-adoption`
89274
+ * provider, reached through `deviceManager.adoptionResync` (which also owns
89275
+ * the "resync from zero" child purge). A provider answers this method by
89276
+ * asking for exactly that — see `resyncThroughAdoption`.
89277
+ */
89278
+ var ResyncDeviceInputSchema = object({
89279
+ deviceId: number$1().int().nonnegative(),
89280
+ /** "Resync from zero": purge the accessory children before re-deriving. */
89281
+ resetToSource: boolean().optional()
89282
+ });
89283
+ var resyncCapability = {
89284
+ name: "resync",
89285
+ scope: "device",
89286
+ deviceNative: true,
89287
+ mode: "singleton",
89288
+ deviceTypes: [
89289
+ DeviceType.Container,
89290
+ DeviceType.Workload,
89291
+ DeviceType.WeatherStation
89292
+ ],
89293
+ methods: { resync: method(ResyncDeviceInputSchema, ResyncResultSchema, {
89294
+ kind: "mutation",
89295
+ auth: "admin",
89296
+ notOperatorFacing: "device adoption — re-aligning a device with its source is an onboarding step, not an automation action"
89297
+ }) },
89298
+ vocabulary: {
89299
+ noun: t("Re-sync", "Risincronizzazione"),
89300
+ order: 3245
89301
+ }
89302
+ };
89044
89303
  var RUNNING_POWER_START_DELAY_MS = 3e4;
89045
89304
  var RUNNING_POWER_STOP_DELAY_MS = 18e4;
89046
89305
  /**
@@ -97338,6 +97597,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
97338
97597
  irTransmitter: irTransmitterCapability,
97339
97598
  lawnMowerControl: lawnMowerControlCapability,
97340
97599
  lockControl: lockControlCapability,
97600
+ lowPowerSleep: lowPowerSleepCapability,
97341
97601
  mediaPlayer: mediaPlayerCapability,
97342
97602
  meter: meterCapability,
97343
97603
  motion: motionCapability,
@@ -98817,6 +99077,21 @@ var BaseDeviceProvider = class extends BaseAddon {
98817
99077
  return toDeviceSummary(device, this.addonId);
98818
99078
  }
98819
99079
  };
99080
+ /**
99081
+ * The `resync` provider of an adopted container (#459, Q6): the work is the
99082
+ * owning addon's `device-adoption.resync`, reached through
99083
+ * `deviceManager.adoptionResync`, which also owns the "resync from zero" child
99084
+ * purge. Registering this is what makes `DeviceFeature.Resyncable` true.
99085
+ */
99086
+ function resyncThroughAdoption(deviceManager, ownDeviceId) {
99087
+ return { resync: async ({ deviceId, resetToSource }) => {
99088
+ if (deviceId !== ownDeviceId) throw new Error(`resync: deviceId mismatch, expected ${ownDeviceId}, got ${deviceId}`);
99089
+ return deviceManager.adoptionResync.mutate({
99090
+ camDeviceId: deviceId,
99091
+ ...resetToSource !== void 0 ? { resetToSource } : {}
99092
+ });
99093
+ } };
99094
+ }
98820
99095
  DeviceType.HeatPump;
98821
99096
  DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Workload, DeviceType.Camera, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.WeatherStation, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
98822
99097
  new Set(Object.values(DeviceType));
@@ -99027,8 +99302,8 @@ var ALARM_MODES = [
99027
99302
  "vacation",
99028
99303
  "custom_bypass"
99029
99304
  ];
99030
- function alarmControls(state, modes, requiresCode) {
99031
- if (requiresCode) return [];
99305
+ function alarmControls(state, modes, codeRequired) {
99306
+ if (codeRequired) return [];
99032
99307
  const disarm = asAction(action("alarm.disarm", t("Disarm", "Disinserisci"), "shield-off", "alarm-panel", "disarm", {}, "primary"));
99033
99308
  const arm = (primaryFirst) => modes.map((mode, i) => asAction(action(`alarm.arm.${mode}`, ARM_LABELS[mode], "shield-check", "alarm-panel", "arm", { mode }, primaryFirst && i === 0 ? "primary" : "normal")));
99034
99309
  switch (state) {
@@ -99048,7 +99323,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
99048
99323
  const modes = slice === void 0 ? ALARM_MODES : slice.availableModes;
99049
99324
  return {
99050
99325
  reading: reading$1("alarm-panel", words?.state ?? "unknown", false, words?.title),
99051
- rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? NOT_REPORTED, since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
99326
+ rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? NOT_REPORTED, since]), alarmControls(state, modes, slice?.codeRequired !== false))],
99052
99327
  ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] },
99053
99328
  ...words === null ? {} : { tiles: {
99054
99329
  left: [{
@@ -102431,13 +102706,6 @@ Object.freeze({
102431
102706
  access: "view",
102432
102707
  role: "viewer"
102433
102708
  },
102434
- "battery.wakeForStream": {
102435
- capName: "battery",
102436
- capScope: "device",
102437
- addonId: null,
102438
- access: "create",
102439
- role: "viewer"
102440
- },
102441
102709
  "binary.getStatus": {
102442
102710
  capName: "binary",
102443
102711
  capScope: "device",
@@ -103964,6 +104232,13 @@ Object.freeze({
103964
104232
  access: "view",
103965
104233
  role: "admin"
103966
104234
  },
104235
+ "deviceManager.listIdentityCandidates": {
104236
+ capName: "device-manager",
104237
+ capScope: "system",
104238
+ addonId: null,
104239
+ access: "view",
104240
+ role: "admin"
104241
+ },
103967
104242
  "deviceManager.listLocationDescriptions": {
103968
104243
  capName: "device-manager",
103969
104244
  capScope: "system",
@@ -106085,6 +106360,20 @@ Object.freeze({
106085
106360
  access: "view",
106086
106361
  role: "admin"
106087
106362
  },
106363
+ "lowPowerSleep.getStatus": {
106364
+ capName: "low-power-sleep",
106365
+ capScope: "device",
106366
+ addonId: null,
106367
+ access: "view",
106368
+ role: "viewer"
106369
+ },
106370
+ "lowPowerSleep.wakeUp": {
106371
+ capName: "low-power-sleep",
106372
+ capScope: "device",
106373
+ addonId: null,
106374
+ access: "create",
106375
+ role: "viewer"
106376
+ },
106088
106377
  "mediaPlayer.channelDown": {
106089
106378
  capName: "media-player",
106090
106379
  capScope: "device",
@@ -109760,6 +110049,13 @@ Object.freeze({
109760
110049
  access: "view",
109761
110050
  role: "admin"
109762
110051
  },
110052
+ "resync.resync": {
110053
+ capName: "resync",
110054
+ capScope: "device",
110055
+ addonId: null,
110056
+ access: "create",
110057
+ role: "admin"
110058
+ },
109763
110059
  "runningState.getStatus": {
109764
110060
  capName: "running-state",
109765
110061
  capScope: "device",
@@ -112155,7 +112451,7 @@ Object.freeze({
112155
112451
  role: "admin"
112156
112452
  }
112157
112453
  });
112158
- DeviceFeature.BatteryOperated;
112454
+ DeviceFeature.Sleeps;
112159
112455
  function bound(cap, methods = [], authority = "reported") {
112160
112456
  return {
112161
112457
  kind: "cap",
@@ -112167,11 +112463,11 @@ function bound(cap, methods = [], authority = "reported") {
112167
112463
  function derived(cap, methods = []) {
112168
112464
  return bound(cap, methods, "derived");
112169
112465
  }
112170
- DeviceFeature.BatteryOperated, DeviceFeature.Rebootable, derived("reboot", ["reboot"]), DeviceFeature.Resyncable, DeviceFeature.NativeSnapshot, DeviceFeature.DoorbellButton, derived("doorbell"), DeviceFeature.TwoWayAudio, derived("intercom", [
112466
+ DeviceFeature.BatteryOperated, DeviceFeature.Sleeps, derived("low-power-sleep", ["wakeUp"]), DeviceFeature.Rebootable, derived("reboot", ["reboot"]), DeviceFeature.Resyncable, derived("resync", ["resync"]), DeviceFeature.NativeSnapshot, DeviceFeature.DoorbellButton, derived("doorbell"), DeviceFeature.TwoWayAudio, derived("intercom", [
112171
112467
  "startTalkSession",
112172
112468
  "pushTalkAudio",
112173
112469
  "endTalkSession"
112174
- ]), DeviceFeature.PanTiltZoom, derived("ptz"), DeviceFeature.PtzAutotrack, derived("ptz-autotrack"), DeviceFeature.MotionTrigger, derived("motion-trigger", ["setMotionTrigger"]), DeviceFeature.TimedRun, derived("timed-run", ["runFor"]), DeviceFeature.Switch, DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired, DeviceFeature.ClimateDualSetpoint, DeviceFeature.ClimateHumidity, DeviceFeature.ClimateFanMode, DeviceFeature.ClimatePreset, DeviceFeature.ClimateSwingVertical, DeviceFeature.ClimateSwingHorizontal, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.CoverStoppable, DeviceFeature.ValvePositionable, DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.LockPinRequired, DeviceFeature.LockOpen, DeviceFeature.MediaPlayerSeek, DeviceFeature.MediaPlayerVolume, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerShuffle, DeviceFeature.MediaPlayerRepeat, DeviceFeature.MediaPlayerSelectSource, DeviceFeature.MediaPlayerPlayMedia, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerPower, DeviceFeature.AlarmPinRequired, DeviceFeature.PresenceGps, DeviceFeature.NotifierImage, DeviceFeature.NotifierPriority, DeviceFeature.NotifierData, DeviceFeature.NotifierActions, DeviceFeature.NotifierRecipients, DeviceFeature.ScriptVariables, DeviceFeature.AutomationSkipCondition, DeviceFeature.VacuumHasMap, DeviceFeature.VacuumHasAi, DeviceFeature.MowerHasMap, DeviceFeature.MowerHasTargetedMowing, DeviceFeature.Navigation, derived("navigation"), DeviceFeature.NetworkLink, derived("network-link");
112470
+ ]), DeviceFeature.PanTiltZoom, derived("ptz"), DeviceFeature.PtzAutotrack, derived("ptz-autotrack"), DeviceFeature.MotionTrigger, derived("motion-trigger", ["setMotionTrigger"]), DeviceFeature.TimedRun, derived("timed-run", ["runFor"]), DeviceFeature.Switch, DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired, DeviceFeature.ClimateDualSetpoint, DeviceFeature.ClimateHumidity, DeviceFeature.ClimateFanMode, DeviceFeature.ClimatePreset, DeviceFeature.ClimateSwingVertical, DeviceFeature.ClimateSwingHorizontal, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.CoverStoppable, DeviceFeature.ValvePositionable, DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.LockOpen, DeviceFeature.MediaPlayerSeek, DeviceFeature.MediaPlayerVolume, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerShuffle, DeviceFeature.MediaPlayerRepeat, DeviceFeature.MediaPlayerSelectSource, DeviceFeature.MediaPlayerPlayMedia, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerPower, DeviceFeature.PresenceGps, DeviceFeature.NotifierImage, DeviceFeature.NotifierPriority, DeviceFeature.NotifierData, DeviceFeature.NotifierActions, DeviceFeature.NotifierRecipients, DeviceFeature.ScriptVariables, DeviceFeature.AutomationSkipCondition, DeviceFeature.VacuumHasAi, DeviceFeature.MowerHasTargetedMowing, DeviceFeature.Navigation, derived("navigation"), DeviceFeature.NetworkLink, derived("network-link");
112175
112471
  var ALL_FEATURES = Object.values(DeviceFeature);
112176
112472
  new Set(ALL_FEATURES);
112177
112473
  DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
@@ -112510,11 +112806,6 @@ Object.freeze({
112510
112806
  form: "single",
112511
112807
  optional: false
112512
112808
  }],
112513
- "battery.wakeForStream": [{
112514
- name: "deviceId",
112515
- form: "single",
112516
- optional: false
112517
- }],
112518
112809
  "binary.getStatus": [{
112519
112810
  name: "deviceId",
112520
112811
  form: "single",
@@ -113698,6 +113989,16 @@ Object.freeze({
113698
113989
  form: "single",
113699
113990
  optional: true
113700
113991
  }],
113992
+ "lowPowerSleep.getStatus": [{
113993
+ name: "deviceId",
113994
+ form: "single",
113995
+ optional: false
113996
+ }],
113997
+ "lowPowerSleep.wakeUp": [{
113998
+ name: "deviceId",
113999
+ form: "single",
114000
+ optional: false
114001
+ }],
113701
114002
  "mediaPlayer.channelDown": [{
113702
114003
  name: "deviceId",
113703
114004
  form: "single",
@@ -114983,6 +115284,11 @@ Object.freeze({
114983
115284
  form: "single",
114984
115285
  optional: false
114985
115286
  }],
115287
+ "resync.resync": [{
115288
+ name: "deviceId",
115289
+ form: "single",
115290
+ optional: false
115291
+ }],
114986
115292
  "runningState.getStatus": [{
114987
115293
  name: "deviceId",
114988
115294
  form: "single",
@@ -146760,6 +147066,7 @@ var HmContainerDevice = class HmContainerDevice extends BaseDevice {
146760
147066
  constructor(ctx) {
146761
147067
  const cfg = hmContainerSchema.parse(ctx.persistedConfig ?? {});
146762
147068
  super(ctx, hmContainerSchema, { type: DeviceType.Container });
147069
+ this.ctx.registerNativeCap(resyncCapability, resyncThroughAdoption(this.ctx.api.deviceManager, this.id));
146763
147070
  this.address = cfg.address;
146764
147071
  this.integrationId = cfg.integrationId;
146765
147072
  const hmDevice = this.resolveHmDevice();