@camstack/addon-provider-bosch 0.1.33 → 0.1.35
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/CHANGELOG.md +12 -0
- package/dist/{account-integration-offline-Bpa-ZlLg.mjs → account-integration-offline-Bt3N9Zdk.mjs} +1 -1
- package/dist/{account-integration-offline-BueUSEv3.js → account-integration-offline-De_H_EsP.js} +1 -1
- package/dist/{dist-hH1ghdQ4.mjs → dist-CkMPcvma.mjs} +67791 -66050
- package/dist/{dist-BHYWG3lC.js → dist-CyZFf49n.js} +67790 -66049
- package/dist/home-connect/addon.js +2 -2
- package/dist/home-connect/addon.mjs +2 -2
- package/dist/homecom/addon.js +2 -2
- package/dist/homecom/addon.mjs +2 -2
- package/dist/shc/addon.js +201 -114
- package/dist/shc/addon.mjs +201 -114
- package/package.json +5 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_dist = require("../dist-
|
|
3
|
-
const require_account_integration_offline = require("../account-integration-offline-
|
|
2
|
+
const require_dist = require("../dist-CyZFf49n.js");
|
|
3
|
+
const require_account_integration_offline = require("../account-integration-offline-De_H_EsP.js");
|
|
4
4
|
let node_crypto = require("node:crypto");
|
|
5
5
|
let node_tls = require("node:tls");
|
|
6
6
|
let node_zlib = require("node:zlib");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { a as createSignInAttemptStore, i as openSignInProxy, n as cascadeRemoveDevicesForIntegration, o as loginFailureForAttempt, r as createSignInClaims, s as parseOAuthCallback, t as setIntegrationDevicesOnline } from "../account-integration-offline-
|
|
1
|
+
import { A as isSecretMarkerLike, B as unknown, D as customAction, E as createEvent, H as DeviceType, I as object, L as record, M as array, N as boolean, O as defineCustomActions, P as literal, R as string, S as runningStateCapability, U as errMsg, V as DeviceRole, W as EventCategory, _ as ingestReading, b as quantityFromUnit, c as binaryCapability, d as consumablesCapability, f as deviceAdoptionCapability, h as eventEmitterCapability, i as RUNNING_STATE_COLD, j as _enum, k as isSecretMarker, m as enumSensorCapability, n as BaseDeviceProvider, o as VendorLoginProxy, p as dishwasherCapability, r as DishwasherOperationStateSchema, t as BaseDevice, u as connectionTestCapability, v as numericSensorCapability, x as runningFromDishwasherOperation, y as powerMeterCapability, z as union } from "../dist-CkMPcvma.mjs";
|
|
2
|
+
import { a as createSignInAttemptStore, i as openSignInProxy, n as cascadeRemoveDevicesForIntegration, o as loginFailureForAttempt, r as createSignInClaims, s as parseOAuthCallback, t as setIntegrationDevicesOnline } from "../account-integration-offline-Bt3N9Zdk.mjs";
|
|
3
3
|
import { createHash, randomBytes } from "node:crypto";
|
|
4
4
|
import { connect } from "node:tls";
|
|
5
5
|
import { inflateRawSync } from "node:zlib";
|
package/dist/homecom/addon.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_dist = require("../dist-
|
|
3
|
-
const require_account_integration_offline = require("../account-integration-offline-
|
|
2
|
+
const require_dist = require("../dist-CyZFf49n.js");
|
|
3
|
+
const require_account_integration_offline = require("../account-integration-offline-De_H_EsP.js");
|
|
4
4
|
let node_crypto = require("node:crypto");
|
|
5
5
|
//#region src/homecom/config.ts
|
|
6
6
|
var HOMECOM_BRANDS = ["bosch", "buderus"];
|
package/dist/homecom/addon.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { a as createSignInAttemptStore, i as openSignInProxy, n as cascadeRemoveDevicesForIntegration, o as loginFailureForAttempt, r as createSignInClaims, s as parseOAuthCallback, t as setIntegrationDevicesOnline } from "../account-integration-offline-
|
|
1
|
+
import { A as isSecretMarkerLike, D as customAction, F as number, H as DeviceType, I as object, M as array, N as boolean, O as defineCustomActions, P as literal, R as string, T as waterHeaterCapability, U as errMsg, W as EventCategory, f as deviceAdoptionCapability, j as _enum, k as isSecretMarker, l as climateControlCapability, n as BaseDeviceProvider, o as VendorLoginProxy, t as BaseDevice, u as connectionTestCapability } from "../dist-CkMPcvma.mjs";
|
|
2
|
+
import { a as createSignInAttemptStore, i as openSignInProxy, n as cascadeRemoveDevicesForIntegration, o as loginFailureForAttempt, r as createSignInClaims, s as parseOAuthCallback, t as setIntegrationDevicesOnline } from "../account-integration-offline-Bt3N9Zdk.mjs";
|
|
3
3
|
import { createHash, randomBytes } from "node:crypto";
|
|
4
4
|
//#region src/homecom/config.ts
|
|
5
5
|
var HOMECOM_BRANDS = ["bosch", "buderus"];
|
package/dist/shc/addon.js
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
4
4
|
//#endregion
|
|
5
|
-
const require_dist = require("../dist-
|
|
5
|
+
const require_dist = require("../dist-CyZFf49n.js");
|
|
6
6
|
let node_crypto = require("node:crypto");
|
|
7
7
|
let node_https = require("node:https");
|
|
8
8
|
let node_child_process = require("node:child_process");
|
|
@@ -388,7 +388,7 @@ function proposeShcControllers(found, existingHosts) {
|
|
|
388
388
|
function shcDiscoveryCandidates(proposals) {
|
|
389
389
|
return proposals.map((found) => ({
|
|
390
390
|
stableId: `bosch-shc:${found.id}`,
|
|
391
|
-
type: require_dist.DeviceType.
|
|
391
|
+
type: require_dist.DeviceType.Gateway,
|
|
392
392
|
suggestedName: found.name,
|
|
393
393
|
prefilledConfig: { host: found.host },
|
|
394
394
|
setupIntegration: true
|
|
@@ -408,6 +408,137 @@ function resolveShcPairingHost(input) {
|
|
|
408
408
|
throw new Error("Enter the controller host or IP address.");
|
|
409
409
|
}
|
|
410
410
|
//#endregion
|
|
411
|
+
//#region src/shc/shc-gateway.ts
|
|
412
|
+
/** In-process resolver: integrationId → live SHC connection surface. */
|
|
413
|
+
var ShcConnectionResolver = class {
|
|
414
|
+
#surfaces = /* @__PURE__ */ new Map();
|
|
415
|
+
set(integrationId, surface) {
|
|
416
|
+
if (surface === null) {
|
|
417
|
+
this.#surfaces.delete(integrationId);
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
this.#surfaces.set(integrationId, surface);
|
|
421
|
+
}
|
|
422
|
+
has(integrationId) {
|
|
423
|
+
return this.#surfaces.has(integrationId);
|
|
424
|
+
}
|
|
425
|
+
devices(integrationId) {
|
|
426
|
+
return this.#surfaces.get(integrationId)?.devices ?? [];
|
|
427
|
+
}
|
|
428
|
+
getClient(integrationId) {
|
|
429
|
+
return this.#surfaces.get(integrationId)?.client ?? null;
|
|
430
|
+
}
|
|
431
|
+
list() {
|
|
432
|
+
return Array.from(this.#surfaces.keys()).map((id) => ({ id }));
|
|
433
|
+
}
|
|
434
|
+
clear() {
|
|
435
|
+
for (const surface of this.#surfaces.values()) surface.client.close();
|
|
436
|
+
this.#surfaces.clear();
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
var shcConnections = new ShcConnectionResolver();
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/shc/devices/shc-device-base.ts
|
|
442
|
+
var shcDeviceSchema = require_dist.object({
|
|
443
|
+
shcDeviceId: require_dist.string().min(1).describe("Bosch SHC device id"),
|
|
444
|
+
brokerId: require_dist.string().min(1).describe("Integration id"),
|
|
445
|
+
deviceModel: require_dist.string().optional(),
|
|
446
|
+
system: require_dist.literal("bosch-shc").optional(),
|
|
447
|
+
integrationId: require_dist.string().optional(),
|
|
448
|
+
tempStep: require_dist.number().positive().optional()
|
|
449
|
+
});
|
|
450
|
+
var ShcBaseDevice = class extends require_dist.BaseDevice {
|
|
451
|
+
features = [];
|
|
452
|
+
shcDeviceId;
|
|
453
|
+
brokerId;
|
|
454
|
+
deviceModel;
|
|
455
|
+
stateUnsub = null;
|
|
456
|
+
constructor(ctx) {
|
|
457
|
+
const persisted = shcDeviceSchema.parse(ctx.persistedConfig ?? {});
|
|
458
|
+
super(ctx, shcDeviceSchema, { type: ctx.deviceMeta.type });
|
|
459
|
+
this.shcDeviceId = persisted.shcDeviceId;
|
|
460
|
+
this.brokerId = persisted.brokerId;
|
|
461
|
+
this.deviceModel = persisted.deviceModel;
|
|
462
|
+
this.online = shcConnections.has(this.brokerId);
|
|
463
|
+
this.updateSourceInfo({
|
|
464
|
+
id: this.shcDeviceId,
|
|
465
|
+
system: "bosch-shc"
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
resolveClient() {
|
|
469
|
+
return shcConnections.getClient(this.brokerId);
|
|
470
|
+
}
|
|
471
|
+
requireClient() {
|
|
472
|
+
const client = this.resolveClient();
|
|
473
|
+
if (client === null) throw new Error(`SHC client unavailable (device=${this.shcDeviceId})`);
|
|
474
|
+
return client;
|
|
475
|
+
}
|
|
476
|
+
async onActivate() {
|
|
477
|
+
await super.onActivate();
|
|
478
|
+
this.registerCaps();
|
|
479
|
+
this.attachStateListener();
|
|
480
|
+
await this.refreshFromController();
|
|
481
|
+
}
|
|
482
|
+
async removeDevice() {
|
|
483
|
+
if (this.stateUnsub) {
|
|
484
|
+
try {
|
|
485
|
+
this.stateUnsub();
|
|
486
|
+
} catch {}
|
|
487
|
+
this.stateUnsub = null;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
attachStateListener() {
|
|
491
|
+
const client = this.resolveClient();
|
|
492
|
+
if (client === null) return;
|
|
493
|
+
const onEvent = (event) => {
|
|
494
|
+
if (event.deviceId !== this.shcDeviceId) return;
|
|
495
|
+
this.refreshFromController().catch((err) => {
|
|
496
|
+
this.deviceLog("warn", "SHC refresh after controller event failed", {
|
|
497
|
+
shcDeviceId: this.shcDeviceId,
|
|
498
|
+
error: require_dist.errMsg(err)
|
|
499
|
+
});
|
|
500
|
+
});
|
|
501
|
+
};
|
|
502
|
+
this.stateUnsub = client.onStateChange(onEvent);
|
|
503
|
+
}
|
|
504
|
+
deviceLog(level, message, meta) {
|
|
505
|
+
const extras = {
|
|
506
|
+
tags: { deviceId: this.ctx.id },
|
|
507
|
+
...meta === void 0 ? {} : { meta }
|
|
508
|
+
};
|
|
509
|
+
if (level === "warn") this.ctx.logger.warn(message, extras);
|
|
510
|
+
else this.ctx.logger.info(message, extras);
|
|
511
|
+
}
|
|
512
|
+
unsupported(surface) {
|
|
513
|
+
throw new Error(`bosch-shc ${this.shcDeviceId}: ${surface} not supported`);
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/shc/devices/shc-gateway-device.ts
|
|
518
|
+
/**
|
|
519
|
+
* The Smart Home Controller box, as a {@link DeviceType.Gateway}. Its connection
|
|
520
|
+
* lives on the INTEGRATION; this device is the box's presence in the device list
|
|
521
|
+
* and follows the session's online state (the integration's connect and
|
|
522
|
+
* disconnect callbacks flip it).
|
|
523
|
+
*
|
|
524
|
+
* It registers no action: the controller's local API offers no reboot or update
|
|
525
|
+
* and the box serves no web page, so there is nothing real to expose. Rooms and
|
|
526
|
+
* devices are NOT children of it; they are adopted as their own top-level
|
|
527
|
+
* devices of the same integration.
|
|
528
|
+
*/
|
|
529
|
+
var ShcGatewayDevice = class extends require_dist.BaseDevice {
|
|
530
|
+
features = [];
|
|
531
|
+
constructor(ctx) {
|
|
532
|
+
const cfg = shcDeviceSchema.parse(ctx.persistedConfig ?? {});
|
|
533
|
+
super(ctx, shcDeviceSchema, { type: require_dist.DeviceType.Gateway });
|
|
534
|
+
this.online = shcConnections.has(cfg.brokerId);
|
|
535
|
+
this.updateSourceInfo({
|
|
536
|
+
id: cfg.shcDeviceId,
|
|
537
|
+
system: "bosch-shc"
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
//#endregion
|
|
411
542
|
//#region src/shc/shc-domain-mapping.ts
|
|
412
543
|
var ROOM_CLIMATE_MODEL = "ROOM_CLIMATE_CONTROL";
|
|
413
544
|
/** Classify a normalised device summary into an adoption / driver kind. */
|
|
@@ -530,6 +661,11 @@ function buildRoomClimatePutBody(input) {
|
|
|
530
661
|
}
|
|
531
662
|
//#endregion
|
|
532
663
|
//#region src/shc/shc-discovery.ts
|
|
664
|
+
var GATEWAY_SUFFIX = ":controller";
|
|
665
|
+
/** The `childNativeId` (and `shcDeviceId`) of the controller box itself, one per integration. */
|
|
666
|
+
function shcGatewayNativeId(integrationId) {
|
|
667
|
+
return `${integrationId}${GATEWAY_SUFFIX}`;
|
|
668
|
+
}
|
|
533
669
|
function shouldSkipShcDevice(device) {
|
|
534
670
|
if (classifyShcDevice(device) === "unsupported") return true;
|
|
535
671
|
if (device.deviceModel.startsWith("HOMECONNECT_")) return true;
|
|
@@ -624,7 +760,21 @@ function leafCandidate(device, kind, adoptedId) {
|
|
|
624
760
|
/** Map live SHC discovery rows to adoption candidates. Pure — no I/O. */
|
|
625
761
|
function buildShcCandidates(input) {
|
|
626
762
|
const linkedTrvs = collectTrvsLinkedToRoomClimate(input.devices);
|
|
627
|
-
const
|
|
763
|
+
const gatewayId = shcGatewayNativeId(input.integrationId);
|
|
764
|
+
const gatewayAdopted = input.adopted.get(gatewayId) ?? null;
|
|
765
|
+
const out = [{
|
|
766
|
+
childNativeId: gatewayId,
|
|
767
|
+
name: input.integrationName,
|
|
768
|
+
type: require_dist.DeviceType.Gateway,
|
|
769
|
+
status: "online",
|
|
770
|
+
metadata: {
|
|
771
|
+
manufacturer: "Bosch",
|
|
772
|
+
model: "Smart Home Controller"
|
|
773
|
+
},
|
|
774
|
+
alreadyAdopted: gatewayAdopted !== null,
|
|
775
|
+
adoptedDeviceId: gatewayAdopted,
|
|
776
|
+
capabilities: []
|
|
777
|
+
}];
|
|
628
778
|
for (const device of input.devices) {
|
|
629
779
|
if (shouldSkipShcDevice(device)) continue;
|
|
630
780
|
const kind = classifyShcDevice(device);
|
|
@@ -654,112 +804,6 @@ function shcStableIdSuffixFromDeviceId(shcDeviceId) {
|
|
|
654
804
|
return shcDeviceId.replace(/[^a-zA-Z0-9._-]+/g, "_");
|
|
655
805
|
}
|
|
656
806
|
//#endregion
|
|
657
|
-
//#region src/shc/shc-gateway.ts
|
|
658
|
-
/** In-process resolver: integrationId → live SHC connection surface. */
|
|
659
|
-
var ShcConnectionResolver = class {
|
|
660
|
-
#surfaces = /* @__PURE__ */ new Map();
|
|
661
|
-
set(integrationId, surface) {
|
|
662
|
-
if (surface === null) {
|
|
663
|
-
this.#surfaces.delete(integrationId);
|
|
664
|
-
return;
|
|
665
|
-
}
|
|
666
|
-
this.#surfaces.set(integrationId, surface);
|
|
667
|
-
}
|
|
668
|
-
has(integrationId) {
|
|
669
|
-
return this.#surfaces.has(integrationId);
|
|
670
|
-
}
|
|
671
|
-
devices(integrationId) {
|
|
672
|
-
return this.#surfaces.get(integrationId)?.devices ?? [];
|
|
673
|
-
}
|
|
674
|
-
getClient(integrationId) {
|
|
675
|
-
return this.#surfaces.get(integrationId)?.client ?? null;
|
|
676
|
-
}
|
|
677
|
-
list() {
|
|
678
|
-
return Array.from(this.#surfaces.keys()).map((id) => ({ id }));
|
|
679
|
-
}
|
|
680
|
-
clear() {
|
|
681
|
-
for (const surface of this.#surfaces.values()) surface.client.close();
|
|
682
|
-
this.#surfaces.clear();
|
|
683
|
-
}
|
|
684
|
-
};
|
|
685
|
-
var shcConnections = new ShcConnectionResolver();
|
|
686
|
-
//#endregion
|
|
687
|
-
//#region src/shc/devices/shc-device-base.ts
|
|
688
|
-
var shcDeviceSchema = require_dist.object({
|
|
689
|
-
shcDeviceId: require_dist.string().min(1).describe("Bosch SHC device id"),
|
|
690
|
-
brokerId: require_dist.string().min(1).describe("Integration id"),
|
|
691
|
-
deviceModel: require_dist.string().optional(),
|
|
692
|
-
system: require_dist.literal("bosch-shc").optional(),
|
|
693
|
-
integrationId: require_dist.string().optional(),
|
|
694
|
-
tempStep: require_dist.number().positive().optional()
|
|
695
|
-
});
|
|
696
|
-
var ShcBaseDevice = class extends require_dist.BaseDevice {
|
|
697
|
-
features = [];
|
|
698
|
-
shcDeviceId;
|
|
699
|
-
brokerId;
|
|
700
|
-
deviceModel;
|
|
701
|
-
stateUnsub = null;
|
|
702
|
-
constructor(ctx) {
|
|
703
|
-
const persisted = shcDeviceSchema.parse(ctx.persistedConfig ?? {});
|
|
704
|
-
super(ctx, shcDeviceSchema, { type: ctx.deviceMeta.type });
|
|
705
|
-
this.shcDeviceId = persisted.shcDeviceId;
|
|
706
|
-
this.brokerId = persisted.brokerId;
|
|
707
|
-
this.deviceModel = persisted.deviceModel;
|
|
708
|
-
this.online = shcConnections.has(this.brokerId);
|
|
709
|
-
this.updateSourceInfo({
|
|
710
|
-
id: this.shcDeviceId,
|
|
711
|
-
system: "bosch-shc"
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
resolveClient() {
|
|
715
|
-
return shcConnections.getClient(this.brokerId);
|
|
716
|
-
}
|
|
717
|
-
requireClient() {
|
|
718
|
-
const client = this.resolveClient();
|
|
719
|
-
if (client === null) throw new Error(`SHC client unavailable (device=${this.shcDeviceId})`);
|
|
720
|
-
return client;
|
|
721
|
-
}
|
|
722
|
-
async onActivate() {
|
|
723
|
-
await super.onActivate();
|
|
724
|
-
this.registerCaps();
|
|
725
|
-
this.attachStateListener();
|
|
726
|
-
await this.refreshFromController();
|
|
727
|
-
}
|
|
728
|
-
async removeDevice() {
|
|
729
|
-
if (this.stateUnsub) {
|
|
730
|
-
try {
|
|
731
|
-
this.stateUnsub();
|
|
732
|
-
} catch {}
|
|
733
|
-
this.stateUnsub = null;
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
attachStateListener() {
|
|
737
|
-
const client = this.resolveClient();
|
|
738
|
-
if (client === null) return;
|
|
739
|
-
const onEvent = (event) => {
|
|
740
|
-
if (event.deviceId !== this.shcDeviceId) return;
|
|
741
|
-
this.refreshFromController().catch((err) => {
|
|
742
|
-
this.deviceLog("warn", "SHC refresh after controller event failed", {
|
|
743
|
-
shcDeviceId: this.shcDeviceId,
|
|
744
|
-
error: require_dist.errMsg(err)
|
|
745
|
-
});
|
|
746
|
-
});
|
|
747
|
-
};
|
|
748
|
-
this.stateUnsub = client.onStateChange(onEvent);
|
|
749
|
-
}
|
|
750
|
-
deviceLog(level, message, meta) {
|
|
751
|
-
const extras = {
|
|
752
|
-
tags: { deviceId: this.ctx.id },
|
|
753
|
-
...meta === void 0 ? {} : { meta }
|
|
754
|
-
};
|
|
755
|
-
if (level === "warn") this.ctx.logger.warn(message, extras);
|
|
756
|
-
else this.ctx.logger.info(message, extras);
|
|
757
|
-
}
|
|
758
|
-
unsupported(surface) {
|
|
759
|
-
throw new Error(`bosch-shc ${this.shcDeviceId}: ${surface} not supported`);
|
|
760
|
-
}
|
|
761
|
-
};
|
|
762
|
-
//#endregion
|
|
763
807
|
//#region src/shc/shc-climate-schedules.ts
|
|
764
808
|
/** Heating profiles from `GET /climate/schedule/{id}/HEATING`. */
|
|
765
809
|
function heatingProfilesFromSchedule(body) {
|
|
@@ -1127,11 +1171,15 @@ async function adoptedMapForIntegration(integrationId, listAdoptedShc) {
|
|
|
1127
1171
|
return map;
|
|
1128
1172
|
}
|
|
1129
1173
|
function buildShcAdoptionProvider(deps) {
|
|
1130
|
-
const { registry, hasIntegration, listIntegrations, listAdoptedShc, adoptDevice, removeDevice, findDeviceConfig, logger } = deps;
|
|
1174
|
+
const { registry, hasIntegration, listIntegrations, integrationName, listAdoptedShc, adoptDevice, removeDevice, findDeviceConfig, logger } = deps;
|
|
1131
1175
|
async function allCandidatesForIntegration(integrationId) {
|
|
1176
|
+
const devices = registry.devices(integrationId);
|
|
1177
|
+
const adopted = await adoptedMapForIntegration(integrationId, listAdoptedShc);
|
|
1132
1178
|
return buildShcCandidates({
|
|
1133
|
-
|
|
1134
|
-
|
|
1179
|
+
integrationId,
|
|
1180
|
+
integrationName: integrationName(integrationId) ?? "Bosch SHC",
|
|
1181
|
+
devices,
|
|
1182
|
+
adopted
|
|
1135
1183
|
});
|
|
1136
1184
|
}
|
|
1137
1185
|
return {
|
|
@@ -1192,6 +1240,22 @@ function buildShcAdoptionProvider(deps) {
|
|
|
1192
1240
|
const adopted = [];
|
|
1193
1241
|
let failures = 0;
|
|
1194
1242
|
for (const shcDeviceId of childNativeIds) try {
|
|
1243
|
+
if (shcDeviceId === shcGatewayNativeId(integrationId)) {
|
|
1244
|
+
const name = perCandidate?.[shcDeviceId]?.name ?? integrationName(integrationId) ?? "Bosch SHC";
|
|
1245
|
+
const { deviceId } = await adoptDevice({
|
|
1246
|
+
shcDeviceId,
|
|
1247
|
+
integrationId,
|
|
1248
|
+
type: require_dist.DeviceType.Gateway,
|
|
1249
|
+
name,
|
|
1250
|
+
deviceModel: "Smart Home Controller"
|
|
1251
|
+
});
|
|
1252
|
+
adopted.push({
|
|
1253
|
+
childNativeId: shcDeviceId,
|
|
1254
|
+
parentDeviceId: deviceId,
|
|
1255
|
+
accessoryDeviceIds: []
|
|
1256
|
+
});
|
|
1257
|
+
continue;
|
|
1258
|
+
}
|
|
1195
1259
|
const dev = devices.find((d) => d.id === shcDeviceId);
|
|
1196
1260
|
if (dev === void 0) {
|
|
1197
1261
|
failures++;
|
|
@@ -1236,7 +1300,7 @@ function buildShcAdoptionProvider(deps) {
|
|
|
1236
1300
|
const integrationId = String(cfg["brokerId"]);
|
|
1237
1301
|
const shcDeviceId = String(cfg["shcDeviceId"]);
|
|
1238
1302
|
if (!hasIntegration(integrationId)) throw new Error(`bosch-shc resync: integration ${integrationId} not connected`);
|
|
1239
|
-
if (!registry.devices(integrationId).some((d) => d.id === shcDeviceId)) throw new Error(`bosch-shc resync: device ${shcDeviceId} no longer on integration`);
|
|
1303
|
+
if (!(shcDeviceId === shcGatewayNativeId(integrationId) || registry.devices(integrationId).some((d) => d.id === shcDeviceId))) throw new Error(`bosch-shc resync: device ${shcDeviceId} no longer on integration`);
|
|
1240
1304
|
return {
|
|
1241
1305
|
changed: false,
|
|
1242
1306
|
rebuiltChildren: 0
|
|
@@ -23461,6 +23525,10 @@ var ShcClientRegistry = class {
|
|
|
23461
23525
|
makeClient: opts.makeClient ?? this.#makeClient
|
|
23462
23526
|
}));
|
|
23463
23527
|
}
|
|
23528
|
+
/** The integration's display name, or null when it is not registered. */
|
|
23529
|
+
nameOf(integrationId) {
|
|
23530
|
+
return this.#entries.get(integrationId)?.manager.getInfo().name ?? null;
|
|
23531
|
+
}
|
|
23464
23532
|
setOnConnected(cb) {
|
|
23465
23533
|
this.#onConnected = cb;
|
|
23466
23534
|
}
|
|
@@ -23656,6 +23724,7 @@ var BoschShcProviderAddon = class extends require_dist.BaseDeviceProvider {
|
|
|
23656
23724
|
addonId = "bosch-shc";
|
|
23657
23725
|
providerName = "Bosch SHC";
|
|
23658
23726
|
deviceClasses = {
|
|
23727
|
+
[require_dist.DeviceType.Gateway]: ShcGatewayDevice,
|
|
23659
23728
|
[require_dist.DeviceType.Container]: ShcClimateRoomDevice,
|
|
23660
23729
|
[require_dist.DeviceType.Climate]: ShcRoomClimateDevice,
|
|
23661
23730
|
[require_dist.DeviceType.Thermostat]: ShcTrvDevice,
|
|
@@ -23847,6 +23916,7 @@ var BoschShcProviderAddon = class extends require_dist.BaseDeviceProvider {
|
|
|
23847
23916
|
logger: this.ctx.logger,
|
|
23848
23917
|
hasIntegration: (integrationId) => this.requireClients().has(integrationId),
|
|
23849
23918
|
listIntegrations: () => this.requireClients().list(),
|
|
23919
|
+
integrationName: (integrationId) => this.requireClients().nameOf(integrationId),
|
|
23850
23920
|
listAdoptedShc: async () => {
|
|
23851
23921
|
const reg = this.ctx.kernel.deviceRegistry;
|
|
23852
23922
|
const devices = this.ctx.kernel.devices;
|
|
@@ -23866,8 +23936,25 @@ var BoschShcProviderAddon = class extends require_dist.BaseDeviceProvider {
|
|
|
23866
23936
|
const devices = this.ctx.kernel.devices;
|
|
23867
23937
|
if (!devices) throw new Error("bosch-shc adopt: kernel.devices unavailable");
|
|
23868
23938
|
const summary = shcConnections.devices(integrationId).find((d) => d.id === shcDeviceId);
|
|
23869
|
-
const kind = summary ? classifyShcDevice(summary) : "unsupported";
|
|
23939
|
+
const kind = type === require_dist.DeviceType.Gateway ? "gateway" : summary ? classifyShcDevice(summary) : "unsupported";
|
|
23870
23940
|
if (kind === "unsupported") throw new Error(`bosch-shc adopt: unsupported device ${shcDeviceId}`);
|
|
23941
|
+
if (type === require_dist.DeviceType.Gateway) {
|
|
23942
|
+
const config = {
|
|
23943
|
+
shcDeviceId,
|
|
23944
|
+
brokerId: integrationId,
|
|
23945
|
+
deviceModel,
|
|
23946
|
+
system: "bosch-shc",
|
|
23947
|
+
integrationId,
|
|
23948
|
+
name
|
|
23949
|
+
};
|
|
23950
|
+
const stableId = this.generateStableId(require_dist.DeviceType.Gateway, config);
|
|
23951
|
+
const meta = {
|
|
23952
|
+
type: require_dist.DeviceType.Gateway,
|
|
23953
|
+
name,
|
|
23954
|
+
integrationId
|
|
23955
|
+
};
|
|
23956
|
+
return { deviceId: (await devices.create(stableId, ShcGatewayDevice, config, null, meta)).id };
|
|
23957
|
+
}
|
|
23871
23958
|
const baseConfig = {
|
|
23872
23959
|
shcDeviceId,
|
|
23873
23960
|
brokerId: integrationId,
|