@riddix/hamh 2.1.0-alpha.443 → 2.1.0-alpha.444
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/backend/cli.js
CHANGED
|
@@ -146085,6 +146085,13 @@ var init_clusters2 = __esm({
|
|
|
146085
146085
|
}
|
|
146086
146086
|
});
|
|
146087
146087
|
|
|
146088
|
+
// ../common/dist/controller-profiles.js
|
|
146089
|
+
var init_controller_profiles = __esm({
|
|
146090
|
+
"../common/dist/controller-profiles.js"() {
|
|
146091
|
+
"use strict";
|
|
146092
|
+
}
|
|
146093
|
+
});
|
|
146094
|
+
|
|
146088
146095
|
// ../common/dist/diagnostic-event.js
|
|
146089
146096
|
var init_diagnostic_event = __esm({
|
|
146090
146097
|
"../common/dist/diagnostic-event.js"() {
|
|
@@ -146999,6 +147006,7 @@ var init_dist = __esm({
|
|
|
146999
147006
|
init_bridge_export();
|
|
147000
147007
|
init_bridge_templates();
|
|
147001
147008
|
init_clusters2();
|
|
147009
|
+
init_controller_profiles();
|
|
147002
147010
|
init_diagnostic_event();
|
|
147003
147011
|
init_domains();
|
|
147004
147012
|
init_endpoint_data();
|
|
@@ -149304,6 +149312,73 @@ function matterApi(bridgeService, haRegistry) {
|
|
|
149304
149312
|
areas.sort((a, b) => a.name.localeCompare(b.name));
|
|
149305
149313
|
res.status(200).json(areas);
|
|
149306
149314
|
});
|
|
149315
|
+
router.get("/areas/summary", async (_, res) => {
|
|
149316
|
+
if (!haRegistry) {
|
|
149317
|
+
res.status(503).json({ error: "Home Assistant registry not available" });
|
|
149318
|
+
return;
|
|
149319
|
+
}
|
|
149320
|
+
const supportedDomains = /* @__PURE__ */ new Set([
|
|
149321
|
+
"light",
|
|
149322
|
+
"switch",
|
|
149323
|
+
"sensor",
|
|
149324
|
+
"binary_sensor",
|
|
149325
|
+
"climate",
|
|
149326
|
+
"cover",
|
|
149327
|
+
"fan",
|
|
149328
|
+
"lock",
|
|
149329
|
+
"media_player",
|
|
149330
|
+
"vacuum",
|
|
149331
|
+
"valve",
|
|
149332
|
+
"humidifier",
|
|
149333
|
+
"water_heater",
|
|
149334
|
+
"select",
|
|
149335
|
+
"input_select",
|
|
149336
|
+
"input_boolean",
|
|
149337
|
+
"alarm_control_panel",
|
|
149338
|
+
"event",
|
|
149339
|
+
"automation",
|
|
149340
|
+
"script",
|
|
149341
|
+
"scene"
|
|
149342
|
+
]);
|
|
149343
|
+
const entities = Object.values(haRegistry.entities);
|
|
149344
|
+
const devices = haRegistry.devices;
|
|
149345
|
+
const states = haRegistry.states;
|
|
149346
|
+
const areaSummary = /* @__PURE__ */ new Map();
|
|
149347
|
+
for (const [areaId, areaName] of haRegistry.areas) {
|
|
149348
|
+
areaSummary.set(areaId, { name: areaName, entityCount: 0, domains: {} });
|
|
149349
|
+
}
|
|
149350
|
+
for (const entity of entities) {
|
|
149351
|
+
if (entity.disabled_by != null) continue;
|
|
149352
|
+
const domain = entity.entity_id.split(".")[0];
|
|
149353
|
+
if (!supportedDomains.has(domain)) continue;
|
|
149354
|
+
const state = states[entity.entity_id];
|
|
149355
|
+
if (!state || state.state === "unavailable") continue;
|
|
149356
|
+
let areaId;
|
|
149357
|
+
const entityAreaId = entity.area_id;
|
|
149358
|
+
if (entityAreaId && haRegistry.areas.has(entityAreaId)) {
|
|
149359
|
+
areaId = entityAreaId;
|
|
149360
|
+
} else {
|
|
149361
|
+
const device = entity.device_id ? devices[entity.device_id] : void 0;
|
|
149362
|
+
const deviceAreaId = device?.area_id;
|
|
149363
|
+
if (deviceAreaId && haRegistry.areas.has(deviceAreaId)) {
|
|
149364
|
+
areaId = deviceAreaId;
|
|
149365
|
+
}
|
|
149366
|
+
}
|
|
149367
|
+
if (!areaId) continue;
|
|
149368
|
+
const summary = areaSummary.get(areaId);
|
|
149369
|
+
if (summary) {
|
|
149370
|
+
summary.entityCount++;
|
|
149371
|
+
summary.domains[domain] = (summary.domains[domain] || 0) + 1;
|
|
149372
|
+
}
|
|
149373
|
+
}
|
|
149374
|
+
const result = [...areaSummary.entries()].map(([area_id, data]) => ({
|
|
149375
|
+
area_id,
|
|
149376
|
+
name: data.name,
|
|
149377
|
+
entityCount: data.entityCount,
|
|
149378
|
+
domains: data.domains
|
|
149379
|
+
})).sort((a, b) => a.name.localeCompare(b.name));
|
|
149380
|
+
res.status(200).json(result);
|
|
149381
|
+
});
|
|
149307
149382
|
router.get("/filter-values", async (_, res) => {
|
|
149308
149383
|
if (!haRegistry) {
|
|
149309
149384
|
res.status(503).json({ error: "Home Assistant registry not available" });
|