@camstack/addon-provider-bosch 0.1.39 → 0.1.41

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.
@@ -1,4 +1,4 @@
1
- import { $ as EventCategory, A as switchCapability, B as _enum, C as integrationInstancesCapability, D as rowsDepsOver, F as defineCustomActions, G as object, I as defineEntryKind, L as entryBody, P as customAction, Q as errMsg, U as literal, V as array, W as number, Z as DeviceType, _ as deviceAdoptionCapability, a as BaseDevice, f as batteryCapability, h as connectionTestCapability, i as testBoschInstance, j as temperatureSensorCapability, l as RecordIntegrationInstances, m as climateControlCapability, n as boschRowsPorts, o as BaseDeviceProvider, q as string, r as keepBodyKeys, t as boschRowsMigration, x as heatingValveCapability } from "../bosch-instances-GrNuqDFv.mjs";
1
+ import { A as RecordIntegrationInstances, B as array, D as switchCapability, F as entryBody, H as literal, K as string, M as customAction, N as defineCustomActions, O as temperatureSensorCapability, P as defineEntryKind, Q as EventCategory, R as rowsDepsOver, U as number, W as object, X as DeviceType, Z as errMsg, a as BaseDevice, d as batteryCapability, h as deviceAdoptionCapability, i as testBoschInstance, n as boschRowsPorts, o as BaseDeviceProvider, p as climateControlCapability, r as keepBodyKeys, t as boschRowsMigration, x as integrationInstancesCapability, y as heatingValveCapability, z as _enum } from "../bosch-instances-C1zZd1KP.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { request } from "node:https";
@@ -23731,34 +23731,30 @@ var ShcClientRegistry = class {
23731
23731
  //#region src/shc/shc-connection-test.ts
23732
23732
  /** REST port of a Smart Home Controller. A connect here means the address answers. */
23733
23733
  var SHC_REACHABILITY_PORT = 8444;
23734
- var TEST_LABEL = "Checks that the controller address answers on the local network";
23735
23734
  function buildShcConnectionTestProvider(deps) {
23736
23735
  const { logger, probe = probeTcp } = deps;
23737
- return {
23738
- describeTest: async () => ({ label: TEST_LABEL }),
23739
- testSettings: async ({ settings }) => {
23740
- const host = readHost(settings);
23741
- if (host === null) return {
23742
- outcome: "rejected",
23743
- error: "Enter the controller host or IP address."
23744
- };
23745
- const startedAt = Date.now();
23746
- if (!await probe(host, 8444)) {
23747
- logger.warn("Bosch SHC connection test: host unreachable", { meta: {
23748
- host,
23749
- port: SHC_REACHABILITY_PORT
23750
- } });
23751
- return {
23752
- outcome: "rejected",
23753
- error: `Could not reach ${host} on port ${SHC_REACHABILITY_PORT}.`
23754
- };
23755
- }
23736
+ return { testSettings: async ({ settings }) => {
23737
+ const host = readHost(settings);
23738
+ if (host === null) return {
23739
+ outcome: "rejected",
23740
+ error: "Enter the controller host or IP address."
23741
+ };
23742
+ const startedAt = Date.now();
23743
+ if (!await probe(host, 8444)) {
23744
+ logger.warn("Bosch SHC connection test: host unreachable", { meta: {
23745
+ host,
23746
+ port: SHC_REACHABILITY_PORT
23747
+ } });
23756
23748
  return {
23757
- outcome: "validated",
23758
- latencyMs: Date.now() - startedAt
23749
+ outcome: "rejected",
23750
+ error: `Could not reach ${host} on port ${SHC_REACHABILITY_PORT}.`
23759
23751
  };
23760
23752
  }
23761
- };
23753
+ return {
23754
+ outcome: "validated",
23755
+ latencyMs: Date.now() - startedAt
23756
+ };
23757
+ } };
23762
23758
  }
23763
23759
  function readHost(settings) {
23764
23760
  if (settings === null || typeof settings !== "object") return null;
@@ -23844,6 +23840,10 @@ var BoschShcProviderAddon = class extends BaseDeviceProvider {
23844
23840
  const records = this.ctx.records;
23845
23841
  if (records === void 0) throw new Error("bosch-shc: ctx.records is required (hub-only addon)");
23846
23842
  await records.declare(shcRecordKinds);
23843
+ this.declareRegistrySwitch({
23844
+ kind: shcConnectionsEntryKind,
23845
+ initialBody: (name) => ({ name })
23846
+ });
23847
23847
  await this.runMigrations(SHC_MIGRATIONS, (api) => shcRowsPorts({ ...rowsDepsOver(api) }));
23848
23848
  const built = buildShcInstances(records, {
23849
23849
  onChanged: () => this.reconcileIntegrations(),
@@ -23866,10 +23866,6 @@ var BoschShcProviderAddon = class extends BaseDeviceProvider {
23866
23866
  capability: deviceAdoptionCapability,
23867
23867
  provider: this.buildAdoptionProvider()
23868
23868
  },
23869
- {
23870
- capability: connectionTestCapability,
23871
- provider: this.buildConnectionTestProvider()
23872
- },
23873
23869
  {
23874
23870
  capability: integrationInstancesCapability,
23875
23871
  provider: built.provider
@@ -24011,8 +24007,9 @@ var BoschShcProviderAddon = class extends BaseDeviceProvider {
24011
24007
  if (typeof addonId === "string" && addonId !== this.ctx.id) return;
24012
24008
  this.reconcileIntegrations();
24013
24009
  };
24014
- this.ctx.eventBus.subscribe({ category: EventCategory.IntegrationEnabled }, handler);
24015
- this.ctx.eventBus.subscribe({ category: EventCategory.IntegrationDisabled }, handler);
24010
+ this.requireInstances().onSwitched(() => {
24011
+ this.reconcileIntegrations();
24012
+ });
24016
24013
  this.ctx.eventBus.subscribe({ category: EventCategory.IntegrationDeleted }, handler);
24017
24014
  }
24018
24015
  async cascadeRemoveDevicesForIntegration(integrationId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-bosch",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
4
4
  "description": "Bosch smart-home device-provider addons for CamStack — SHC, Home Connect, and HomeCom cloud integrations (scaffold)",
5
5
  "keywords": [
6
6
  "camstack",
@@ -56,9 +56,6 @@
56
56
  {
57
57
  "name": "device-adoption"
58
58
  },
59
- {
60
- "name": "connection-test"
61
- },
62
59
  {
63
60
  "name": "integration-instances"
64
61
  }
@@ -86,9 +83,6 @@
86
83
  {
87
84
  "name": "device-adoption"
88
85
  },
89
- {
90
- "name": "connection-test"
91
- },
92
86
  {
93
87
  "name": "integration-instances"
94
88
  },
@@ -125,9 +119,6 @@
125
119
  {
126
120
  "name": "device-adoption"
127
121
  },
128
- {
129
- "name": "connection-test"
130
- },
131
122
  {
132
123
  "name": "integration-instances"
133
124
  },
@@ -141,7 +132,7 @@
141
132
  }
142
133
  ],
143
134
  "requires": {
144
- "server": ">=1.2.780"
135
+ "server": ">=1.2.787"
145
136
  }
146
137
  },
147
138
  "files": [