@camstack/addon-provider-homeassistant 1.2.85 → 1.2.86
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.js +1 -1
- package/dist/addon.mjs +1 -1
- package/dist/{dist-D8MM0d_3.mjs → dist-l3fKSOoz.mjs} +91 -1
- package/dist/{dist-DAyddjpR.js → dist-lHF9qIyU.js} +91 -1
- package/dist/ha-export/ha-export.addon.js +54 -1
- package/dist/ha-export/ha-export.addon.mjs +54 -1
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_dist = require("./dist-
|
|
2
|
+
const require_dist = require("./dist-lHF9qIyU.js");
|
|
3
3
|
let node_crypto = require("node:crypto");
|
|
4
4
|
let node_zlib = require("node:zlib");
|
|
5
5
|
//#region src/ha-device-source.ts
|
package/dist/addon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as presenceCapability, A as controlCapability, At as EventCategory, B as humiditySensorCapability, C as buildAddonRouteProvider, Ct as number, D as colorCapability, Dt as union, E as climateControlCapability, Et as string, F as eventEmitterCapability, G as motionCapability, H as lawnMowerControlCapability, I as fanControlCapability, J as notifierCapability, K as normalizeUnit, L as floodCapability, M as deviceAdoptionCapability, O as connectivityCapability, Ot as unknown, P as enumSensorCapability, Q as prepareNotification, R as gasCapability, S as brokerCapability, St as literal, T as carbonMonoxideCapability, Tt as record, U as lockControlCapability, V as imageCapability, W as mediaPlayerCapability, Y as numericSensorCapability, Z as powerMeterCapability, _ as automationControlCapability, _t as createEvent, at as temperatureSensorCapability, b as binaryCapability, bt as array, ct as valveCapability, d as TargetSchema, dt as weatherCapability, et as pressureSensorCapability, f as accessoriesCapability, ft as errMsg, g as ambientLightSensorCapability, gt as DeviceType, h as alarmPanelCapability, ht as DeviceRole, it as tamperCapability, j as coverCapability, k as contactCapability, kt as url, lt as vibrationCapability, m as airQualitySensorCapability, mt as DeviceFeature, n as BaseDevice, nt as smokeCapability, ot as updateCapability, p as addonRoutesCapability, q as notificationOutputCapability, r as BaseDeviceProvider, rt as switchCapability, s as EnumSensorDateTimeFormatSchema, st as vacuumControlCapability, tt as scriptRunnerCapability, ut as waterHeaterCapability, v as batteryCapability, w as buttonCapability, wt as object, x as brightnessCapability, xt as discriminatedUnion, y as bestLocationMatch, yt as _enum, z as humidifierCapability } from "./dist-
|
|
1
|
+
import { $ as presenceCapability, A as controlCapability, At as EventCategory, B as humiditySensorCapability, C as buildAddonRouteProvider, Ct as number, D as colorCapability, Dt as union, E as climateControlCapability, Et as string, F as eventEmitterCapability, G as motionCapability, H as lawnMowerControlCapability, I as fanControlCapability, J as notifierCapability, K as normalizeUnit, L as floodCapability, M as deviceAdoptionCapability, O as connectivityCapability, Ot as unknown, P as enumSensorCapability, Q as prepareNotification, R as gasCapability, S as brokerCapability, St as literal, T as carbonMonoxideCapability, Tt as record, U as lockControlCapability, V as imageCapability, W as mediaPlayerCapability, Y as numericSensorCapability, Z as powerMeterCapability, _ as automationControlCapability, _t as createEvent, at as temperatureSensorCapability, b as binaryCapability, bt as array, ct as valveCapability, d as TargetSchema, dt as weatherCapability, et as pressureSensorCapability, f as accessoriesCapability, ft as errMsg, g as ambientLightSensorCapability, gt as DeviceType, h as alarmPanelCapability, ht as DeviceRole, it as tamperCapability, j as coverCapability, k as contactCapability, kt as url, lt as vibrationCapability, m as airQualitySensorCapability, mt as DeviceFeature, n as BaseDevice, nt as smokeCapability, ot as updateCapability, p as addonRoutesCapability, q as notificationOutputCapability, r as BaseDeviceProvider, rt as switchCapability, s as EnumSensorDateTimeFormatSchema, st as vacuumControlCapability, tt as scriptRunnerCapability, ut as waterHeaterCapability, v as batteryCapability, w as buttonCapability, wt as object, x as brightnessCapability, xt as discriminatedUnion, y as bestLocationMatch, yt as _enum, z as humidifierCapability } from "./dist-l3fKSOoz.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { brotliCompressSync, deflateSync, gzipSync } from "node:zlib";
|
|
4
4
|
//#region src/ha-device-source.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../types/dist/event-category-
|
|
1
|
+
//#region ../types/dist/event-category-zAv7pMUz.mjs
|
|
2
2
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
3
3
|
EventCategory["SystemBoot"] = "system.boot";
|
|
4
4
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -370,6 +370,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
370
370
|
*/
|
|
371
371
|
EventCategory["BatteryOnStatusChanged"] = "battery.onStatusChanged";
|
|
372
372
|
/**
|
|
373
|
+
* Cap event fired by every device that registers the `network-link`
|
|
374
|
+
* capability. Mirrors the cap definition's `onStatusChanged`. Carries
|
|
375
|
+
* `{ deviceId, status: NetworkLinkStatus }` — a link switch or a signal
|
|
376
|
+
* reading that moved.
|
|
377
|
+
*/
|
|
378
|
+
EventCategory["NetworkLinkOnStatusChanged"] = "network-link.onStatusChanged";
|
|
379
|
+
/**
|
|
373
380
|
* Emitted by the battery cap provider WHEN `wakeForStream` enters the
|
|
374
381
|
* "wake in progress" window — between the Baichuan wake-up issue and
|
|
375
382
|
* the camera's first dialed-back RTP packet. The stream-broker
|
|
@@ -24209,6 +24216,88 @@ onStatusChanged: { data: object({
|
|
|
24209
24216
|
volatileStateFields: ["lastUpdated"]
|
|
24210
24217
|
};
|
|
24211
24218
|
/**
|
|
24219
|
+
* Network-link snapshot. Same shape for every provider (a Reolink wifi
|
|
24220
|
+
* camera, a Home Assistant device with a signal-strength sensor, a Tapo
|
|
24221
|
+
* plug): one slice under `device.runtimeState['network-link']`, one badge,
|
|
24222
|
+
* one Home Assistant projection.
|
|
24223
|
+
*/
|
|
24224
|
+
var NetworkLinkStatusSchema = object({
|
|
24225
|
+
/** The link the device is on. `'unknown'` = not read yet, not "no link". */
|
|
24226
|
+
type: _enum([
|
|
24227
|
+
"wifi",
|
|
24228
|
+
"ethernet",
|
|
24229
|
+
"cellular",
|
|
24230
|
+
"unknown"
|
|
24231
|
+
]),
|
|
24232
|
+
/**
|
|
24233
|
+
* Link quality, 0..100 inclusive, normalised by the provider from whatever
|
|
24234
|
+
* the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
|
|
24235
|
+
* KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
|
|
24236
|
+
* one whose reading has not landed must not be drawn at 0 %. Consumers
|
|
24237
|
+
* SKIP a null rather than coerce it.
|
|
24238
|
+
*/
|
|
24239
|
+
signalPercent: number().min(0).max(100).nullable(),
|
|
24240
|
+
/** Raw received signal strength in dBm, when the firmware reports one. */
|
|
24241
|
+
rssiDbm: number().optional(),
|
|
24242
|
+
/** Network name of a wireless link, when the firmware reports it. */
|
|
24243
|
+
ssid: string().optional(),
|
|
24244
|
+
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
24245
|
+
lastUpdated: number()
|
|
24246
|
+
});
|
|
24247
|
+
var networkLinkCapability = {
|
|
24248
|
+
name: "network-link",
|
|
24249
|
+
scope: "device",
|
|
24250
|
+
deviceNative: true,
|
|
24251
|
+
mode: "singleton",
|
|
24252
|
+
deviceTypes: [
|
|
24253
|
+
DeviceType.Camera,
|
|
24254
|
+
DeviceType.Sensor,
|
|
24255
|
+
DeviceType.Button,
|
|
24256
|
+
DeviceType.Switch,
|
|
24257
|
+
DeviceType.Light,
|
|
24258
|
+
DeviceType.Lock,
|
|
24259
|
+
DeviceType.Siren
|
|
24260
|
+
],
|
|
24261
|
+
methods: {},
|
|
24262
|
+
events: {
|
|
24263
|
+
/**
|
|
24264
|
+
* Emitted whenever the cached status changes (a link switch, a signal
|
|
24265
|
+
* reading that moved). Mirrored on the parent chain by the
|
|
24266
|
+
* DeviceEventPropagator like `battery.onStatusChanged`.
|
|
24267
|
+
*/
|
|
24268
|
+
onStatusChanged: { data: object({
|
|
24269
|
+
deviceId: number(),
|
|
24270
|
+
status: NetworkLinkStatusSchema
|
|
24271
|
+
}) } },
|
|
24272
|
+
status: {
|
|
24273
|
+
schema: NetworkLinkStatusSchema,
|
|
24274
|
+
kind: "push",
|
|
24275
|
+
empty: {
|
|
24276
|
+
type: "unknown",
|
|
24277
|
+
signalPercent: null,
|
|
24278
|
+
lastUpdated: 0
|
|
24279
|
+
}
|
|
24280
|
+
},
|
|
24281
|
+
/**
|
|
24282
|
+
* Runtime-state slice — every provider stores the same shape under
|
|
24283
|
+
* `device.runtimeState['network-link']`, read once by the badge and the
|
|
24284
|
+
* Home Assistant projector regardless of the driver.
|
|
24285
|
+
*/
|
|
24286
|
+
runtimeState: NetworkLinkStatusSchema,
|
|
24287
|
+
/**
|
|
24288
|
+
* Runtime-state durability: **restored** — a link reading is slow to
|
|
24289
|
+
* change and a sleeping battery camera may not report for hours; the
|
|
24290
|
+
* restored slice is what the badge shows until the next read.
|
|
24291
|
+
*
|
|
24292
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
24293
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
24294
|
+
*/
|
|
24295
|
+
durability: "restored",
|
|
24296
|
+
/** Clock fields: written, but excluded from the compare that decides
|
|
24297
|
+
* whether persisting is worth a SQLite commit. */
|
|
24298
|
+
volatileStateFields: ["lastUpdated"]
|
|
24299
|
+
};
|
|
24300
|
+
/**
|
|
24212
24301
|
* Generic boolean sensor — last-resort fallback when no domain-
|
|
24213
24302
|
* specific binary cap fits (Home Assistant `binary_sensor` without a
|
|
24214
24303
|
* known `device_class`, or a domain we haven't typed yet). Pure
|
|
@@ -32610,6 +32699,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
32610
32699
|
motionTrigger: motionTriggerCapability,
|
|
32611
32700
|
motionZones: motionZonesCapability,
|
|
32612
32701
|
nativeObjectDetection: nativeObjectDetectionCapability,
|
|
32702
|
+
networkLink: networkLinkCapability,
|
|
32613
32703
|
notifier: notifierCapability,
|
|
32614
32704
|
numericSensor: numericSensorCapability,
|
|
32615
32705
|
petFeeder: petFeederCapability,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../types/dist/event-category-
|
|
1
|
+
//#region ../types/dist/event-category-zAv7pMUz.mjs
|
|
2
2
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
3
3
|
EventCategory["SystemBoot"] = "system.boot";
|
|
4
4
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -370,6 +370,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
370
370
|
*/
|
|
371
371
|
EventCategory["BatteryOnStatusChanged"] = "battery.onStatusChanged";
|
|
372
372
|
/**
|
|
373
|
+
* Cap event fired by every device that registers the `network-link`
|
|
374
|
+
* capability. Mirrors the cap definition's `onStatusChanged`. Carries
|
|
375
|
+
* `{ deviceId, status: NetworkLinkStatus }` — a link switch or a signal
|
|
376
|
+
* reading that moved.
|
|
377
|
+
*/
|
|
378
|
+
EventCategory["NetworkLinkOnStatusChanged"] = "network-link.onStatusChanged";
|
|
379
|
+
/**
|
|
373
380
|
* Emitted by the battery cap provider WHEN `wakeForStream` enters the
|
|
374
381
|
* "wake in progress" window — between the Baichuan wake-up issue and
|
|
375
382
|
* the camera's first dialed-back RTP packet. The stream-broker
|
|
@@ -24209,6 +24216,88 @@ onStatusChanged: { data: object({
|
|
|
24209
24216
|
volatileStateFields: ["lastUpdated"]
|
|
24210
24217
|
};
|
|
24211
24218
|
/**
|
|
24219
|
+
* Network-link snapshot. Same shape for every provider (a Reolink wifi
|
|
24220
|
+
* camera, a Home Assistant device with a signal-strength sensor, a Tapo
|
|
24221
|
+
* plug): one slice under `device.runtimeState['network-link']`, one badge,
|
|
24222
|
+
* one Home Assistant projection.
|
|
24223
|
+
*/
|
|
24224
|
+
var NetworkLinkStatusSchema = object({
|
|
24225
|
+
/** The link the device is on. `'unknown'` = not read yet, not "no link". */
|
|
24226
|
+
type: _enum([
|
|
24227
|
+
"wifi",
|
|
24228
|
+
"ethernet",
|
|
24229
|
+
"cellular",
|
|
24230
|
+
"unknown"
|
|
24231
|
+
]),
|
|
24232
|
+
/**
|
|
24233
|
+
* Link quality, 0..100 inclusive, normalised by the provider from whatever
|
|
24234
|
+
* the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
|
|
24235
|
+
* KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
|
|
24236
|
+
* one whose reading has not landed must not be drawn at 0 %. Consumers
|
|
24237
|
+
* SKIP a null rather than coerce it.
|
|
24238
|
+
*/
|
|
24239
|
+
signalPercent: number().min(0).max(100).nullable(),
|
|
24240
|
+
/** Raw received signal strength in dBm, when the firmware reports one. */
|
|
24241
|
+
rssiDbm: number().optional(),
|
|
24242
|
+
/** Network name of a wireless link, when the firmware reports it. */
|
|
24243
|
+
ssid: string().optional(),
|
|
24244
|
+
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
24245
|
+
lastUpdated: number()
|
|
24246
|
+
});
|
|
24247
|
+
var networkLinkCapability = {
|
|
24248
|
+
name: "network-link",
|
|
24249
|
+
scope: "device",
|
|
24250
|
+
deviceNative: true,
|
|
24251
|
+
mode: "singleton",
|
|
24252
|
+
deviceTypes: [
|
|
24253
|
+
DeviceType.Camera,
|
|
24254
|
+
DeviceType.Sensor,
|
|
24255
|
+
DeviceType.Button,
|
|
24256
|
+
DeviceType.Switch,
|
|
24257
|
+
DeviceType.Light,
|
|
24258
|
+
DeviceType.Lock,
|
|
24259
|
+
DeviceType.Siren
|
|
24260
|
+
],
|
|
24261
|
+
methods: {},
|
|
24262
|
+
events: {
|
|
24263
|
+
/**
|
|
24264
|
+
* Emitted whenever the cached status changes (a link switch, a signal
|
|
24265
|
+
* reading that moved). Mirrored on the parent chain by the
|
|
24266
|
+
* DeviceEventPropagator like `battery.onStatusChanged`.
|
|
24267
|
+
*/
|
|
24268
|
+
onStatusChanged: { data: object({
|
|
24269
|
+
deviceId: number(),
|
|
24270
|
+
status: NetworkLinkStatusSchema
|
|
24271
|
+
}) } },
|
|
24272
|
+
status: {
|
|
24273
|
+
schema: NetworkLinkStatusSchema,
|
|
24274
|
+
kind: "push",
|
|
24275
|
+
empty: {
|
|
24276
|
+
type: "unknown",
|
|
24277
|
+
signalPercent: null,
|
|
24278
|
+
lastUpdated: 0
|
|
24279
|
+
}
|
|
24280
|
+
},
|
|
24281
|
+
/**
|
|
24282
|
+
* Runtime-state slice — every provider stores the same shape under
|
|
24283
|
+
* `device.runtimeState['network-link']`, read once by the badge and the
|
|
24284
|
+
* Home Assistant projector regardless of the driver.
|
|
24285
|
+
*/
|
|
24286
|
+
runtimeState: NetworkLinkStatusSchema,
|
|
24287
|
+
/**
|
|
24288
|
+
* Runtime-state durability: **restored** — a link reading is slow to
|
|
24289
|
+
* change and a sleeping battery camera may not report for hours; the
|
|
24290
|
+
* restored slice is what the badge shows until the next read.
|
|
24291
|
+
*
|
|
24292
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
24293
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
24294
|
+
*/
|
|
24295
|
+
durability: "restored",
|
|
24296
|
+
/** Clock fields: written, but excluded from the compare that decides
|
|
24297
|
+
* whether persisting is worth a SQLite commit. */
|
|
24298
|
+
volatileStateFields: ["lastUpdated"]
|
|
24299
|
+
};
|
|
24300
|
+
/**
|
|
24212
24301
|
* Generic boolean sensor — last-resort fallback when no domain-
|
|
24213
24302
|
* specific binary cap fits (Home Assistant `binary_sensor` without a
|
|
24214
24303
|
* known `device_class`, or a domain we haven't typed yet). Pure
|
|
@@ -32610,6 +32699,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
32610
32699
|
motionTrigger: motionTriggerCapability,
|
|
32611
32700
|
motionZones: motionZonesCapability,
|
|
32612
32701
|
nativeObjectDetection: nativeObjectDetectionCapability,
|
|
32702
|
+
networkLink: networkLinkCapability,
|
|
32613
32703
|
notifier: notifierCapability,
|
|
32614
32704
|
numericSensor: numericSensorCapability,
|
|
32615
32705
|
petFeeder: petFeederCapability,
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
//#endregion
|
|
6
|
-
const require_dist = require("../dist-
|
|
6
|
+
const require_dist = require("../dist-lHF9qIyU.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
//#region src/ha-export/topics.ts
|
|
9
9
|
/**
|
|
@@ -1333,6 +1333,22 @@ function cameraSpecs(device) {
|
|
|
1333
1333
|
enabledByDefault: true
|
|
1334
1334
|
}
|
|
1335
1335
|
];
|
|
1336
|
+
if (device.slices.includes("network-link")) specs.push({
|
|
1337
|
+
entity: "link",
|
|
1338
|
+
platform: "sensor",
|
|
1339
|
+
label: "Network link",
|
|
1340
|
+
icon: "mdi:lan-connect",
|
|
1341
|
+
entityCategory: "diagnostic",
|
|
1342
|
+
enabledByDefault: true
|
|
1343
|
+
}, {
|
|
1344
|
+
entity: "signal",
|
|
1345
|
+
platform: "sensor",
|
|
1346
|
+
label: "Signal",
|
|
1347
|
+
icon: "mdi:wifi",
|
|
1348
|
+
unit: "%",
|
|
1349
|
+
entityCategory: "diagnostic",
|
|
1350
|
+
enabledByDefault: true
|
|
1351
|
+
});
|
|
1336
1352
|
if (device.slices.includes("battery")) specs.push({
|
|
1337
1353
|
entity: "battery",
|
|
1338
1354
|
platform: "sensor",
|
|
@@ -4982,6 +4998,25 @@ function projectBatterySlice(deviceKey, slice) {
|
|
|
4982
4998
|
return values;
|
|
4983
4999
|
}
|
|
4984
5000
|
/**
|
|
5001
|
+
* The device's own link: which medium it is on and, for a wireless one, how
|
|
5002
|
+
* strong. An `unknown` type publishes nothing — it is the absence of a read,
|
|
5003
|
+
* and a wire drawn from it would be a lie the same way a 0 % battery was. A
|
|
5004
|
+
* `null` signal publishes no signal entity value: wired links have none, and
|
|
5005
|
+
* a wireless one not yet read must not sit at 0 %.
|
|
5006
|
+
*/
|
|
5007
|
+
function projectNetworkLinkSlice(deviceKey, slice) {
|
|
5008
|
+
if (slice.type === "unknown") return [];
|
|
5009
|
+
const values = [{
|
|
5010
|
+
topic: stateTopic(deviceKey, "link"),
|
|
5011
|
+
value: slice.type
|
|
5012
|
+
}];
|
|
5013
|
+
if (slice.signalPercent !== null) values.push({
|
|
5014
|
+
topic: stateTopic(deviceKey, "signal"),
|
|
5015
|
+
value: String(Math.round(slice.signalPercent))
|
|
5016
|
+
});
|
|
5017
|
+
return values;
|
|
5018
|
+
}
|
|
5019
|
+
/**
|
|
4985
5020
|
* The per-camera function switches, mirrored 1:1 from
|
|
4986
5021
|
* `deriveCameraFunctions` (`camera-functions.ts`) — the pure derivation over
|
|
4987
5022
|
* the AUTHORITIES that own each function, replacing the deprecated
|
|
@@ -6037,6 +6072,16 @@ var HaExportAddon = class extends require_dist.BaseAddon {
|
|
|
6037
6072
|
if (typeof online === "boolean") this.push(deviceId, projectDeviceStatus(deviceKey, online));
|
|
6038
6073
|
return;
|
|
6039
6074
|
}
|
|
6075
|
+
if (capName === "network-link") {
|
|
6076
|
+
const type = readString(slice, "type");
|
|
6077
|
+
if (type === null) return;
|
|
6078
|
+
const signalPercent = readNumber(slice, "signalPercent");
|
|
6079
|
+
this.push(deviceId, projectNetworkLinkSlice(deviceKey, {
|
|
6080
|
+
type,
|
|
6081
|
+
signalPercent
|
|
6082
|
+
}));
|
|
6083
|
+
return;
|
|
6084
|
+
}
|
|
6040
6085
|
if (capName === "battery") {
|
|
6041
6086
|
const percentage = readNumber(slice, "percentage");
|
|
6042
6087
|
const charging = readString(slice, "charging");
|
|
@@ -6800,6 +6845,14 @@ var HaExportAddon = class extends require_dist.BaseAddon {
|
|
|
6800
6845
|
const snapshot = toSnapshot(snapshotRaw);
|
|
6801
6846
|
const online = snapshot["device-status"]?.["online"];
|
|
6802
6847
|
if (typeof online === "boolean") values.push(...projectDeviceStatus(key, online));
|
|
6848
|
+
const link = snapshot["network-link"];
|
|
6849
|
+
if (link !== void 0) {
|
|
6850
|
+
const type = readString(link, "type");
|
|
6851
|
+
if (type !== null) values.push(...projectNetworkLinkSlice(key, {
|
|
6852
|
+
type,
|
|
6853
|
+
signalPercent: readNumber(link, "signalPercent")
|
|
6854
|
+
}));
|
|
6855
|
+
}
|
|
6803
6856
|
const battery = snapshot["battery"];
|
|
6804
6857
|
if (battery !== void 0) {
|
|
6805
6858
|
const percentage = readNumber(battery, "percentage");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as EventCategory, C as buildAddonRouteProvider, Et as string, N as deviceExportCapability, X as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, pt as BaseAddon, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, vt as nodePin } from "../dist-
|
|
1
|
+
import { At as EventCategory, C as buildAddonRouteProvider, Et as string, N as deviceExportCapability, X as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, pt as BaseAddon, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, vt as nodePin } from "../dist-l3fKSOoz.mjs";
|
|
2
2
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
3
3
|
//#region src/ha-export/topics.ts
|
|
4
4
|
/**
|
|
@@ -1328,6 +1328,22 @@ function cameraSpecs(device) {
|
|
|
1328
1328
|
enabledByDefault: true
|
|
1329
1329
|
}
|
|
1330
1330
|
];
|
|
1331
|
+
if (device.slices.includes("network-link")) specs.push({
|
|
1332
|
+
entity: "link",
|
|
1333
|
+
platform: "sensor",
|
|
1334
|
+
label: "Network link",
|
|
1335
|
+
icon: "mdi:lan-connect",
|
|
1336
|
+
entityCategory: "diagnostic",
|
|
1337
|
+
enabledByDefault: true
|
|
1338
|
+
}, {
|
|
1339
|
+
entity: "signal",
|
|
1340
|
+
platform: "sensor",
|
|
1341
|
+
label: "Signal",
|
|
1342
|
+
icon: "mdi:wifi",
|
|
1343
|
+
unit: "%",
|
|
1344
|
+
entityCategory: "diagnostic",
|
|
1345
|
+
enabledByDefault: true
|
|
1346
|
+
});
|
|
1331
1347
|
if (device.slices.includes("battery")) specs.push({
|
|
1332
1348
|
entity: "battery",
|
|
1333
1349
|
platform: "sensor",
|
|
@@ -4977,6 +4993,25 @@ function projectBatterySlice(deviceKey, slice) {
|
|
|
4977
4993
|
return values;
|
|
4978
4994
|
}
|
|
4979
4995
|
/**
|
|
4996
|
+
* The device's own link: which medium it is on and, for a wireless one, how
|
|
4997
|
+
* strong. An `unknown` type publishes nothing — it is the absence of a read,
|
|
4998
|
+
* and a wire drawn from it would be a lie the same way a 0 % battery was. A
|
|
4999
|
+
* `null` signal publishes no signal entity value: wired links have none, and
|
|
5000
|
+
* a wireless one not yet read must not sit at 0 %.
|
|
5001
|
+
*/
|
|
5002
|
+
function projectNetworkLinkSlice(deviceKey, slice) {
|
|
5003
|
+
if (slice.type === "unknown") return [];
|
|
5004
|
+
const values = [{
|
|
5005
|
+
topic: stateTopic(deviceKey, "link"),
|
|
5006
|
+
value: slice.type
|
|
5007
|
+
}];
|
|
5008
|
+
if (slice.signalPercent !== null) values.push({
|
|
5009
|
+
topic: stateTopic(deviceKey, "signal"),
|
|
5010
|
+
value: String(Math.round(slice.signalPercent))
|
|
5011
|
+
});
|
|
5012
|
+
return values;
|
|
5013
|
+
}
|
|
5014
|
+
/**
|
|
4980
5015
|
* The per-camera function switches, mirrored 1:1 from
|
|
4981
5016
|
* `deriveCameraFunctions` (`camera-functions.ts`) — the pure derivation over
|
|
4982
5017
|
* the AUTHORITIES that own each function, replacing the deprecated
|
|
@@ -6032,6 +6067,16 @@ var HaExportAddon = class extends BaseAddon {
|
|
|
6032
6067
|
if (typeof online === "boolean") this.push(deviceId, projectDeviceStatus(deviceKey, online));
|
|
6033
6068
|
return;
|
|
6034
6069
|
}
|
|
6070
|
+
if (capName === "network-link") {
|
|
6071
|
+
const type = readString(slice, "type");
|
|
6072
|
+
if (type === null) return;
|
|
6073
|
+
const signalPercent = readNumber(slice, "signalPercent");
|
|
6074
|
+
this.push(deviceId, projectNetworkLinkSlice(deviceKey, {
|
|
6075
|
+
type,
|
|
6076
|
+
signalPercent
|
|
6077
|
+
}));
|
|
6078
|
+
return;
|
|
6079
|
+
}
|
|
6035
6080
|
if (capName === "battery") {
|
|
6036
6081
|
const percentage = readNumber(slice, "percentage");
|
|
6037
6082
|
const charging = readString(slice, "charging");
|
|
@@ -6795,6 +6840,14 @@ var HaExportAddon = class extends BaseAddon {
|
|
|
6795
6840
|
const snapshot = toSnapshot(snapshotRaw);
|
|
6796
6841
|
const online = snapshot["device-status"]?.["online"];
|
|
6797
6842
|
if (typeof online === "boolean") values.push(...projectDeviceStatus(key, online));
|
|
6843
|
+
const link = snapshot["network-link"];
|
|
6844
|
+
if (link !== void 0) {
|
|
6845
|
+
const type = readString(link, "type");
|
|
6846
|
+
if (type !== null) values.push(...projectNetworkLinkSlice(key, {
|
|
6847
|
+
type,
|
|
6848
|
+
signalPercent: readNumber(link, "signalPercent")
|
|
6849
|
+
}));
|
|
6850
|
+
}
|
|
6798
6851
|
const battery = snapshot["battery"];
|
|
6799
6852
|
if (battery !== void 0) {
|
|
6800
6853
|
const percentage = readNumber(battery, "percentage");
|