@camstack/addon-provider-ecowitt 0.1.3 → 0.1.5

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 CHANGED
@@ -4647,7 +4647,7 @@ function preprocess(fn, schema) {
4647
4647
  });
4648
4648
  }
4649
4649
  //#endregion
4650
- //#region ../types/dist/sleep-NOH4yRwj.mjs
4650
+ //#region ../types/dist/sleep-DVmKHFGi.mjs
4651
4651
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4652
4652
  EventCategory["SystemBoot"] = "system.boot";
4653
4653
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -6447,6 +6447,17 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
6447
6447
  DeviceRole["HumiditySensor"] = "humidity-sensor";
6448
6448
  DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
6449
6449
  DeviceRole["PressureSensor"] = "pressure-sensor";
6450
+ /** Wind speed or direction (weather-station `wind-sensor` cap). */
6451
+ DeviceRole["WindSensor"] = "wind-sensor";
6452
+ /** Rain accumulation or rate (weather-station `rain-sensor` cap). */
6453
+ DeviceRole["RainSensor"] = "rain-sensor";
6454
+ /** UV index (weather-station `uv-sensor` cap). */
6455
+ DeviceRole["UvSensor"] = "uv-sensor";
6456
+ /** Solar irradiance W/m² (weather-station `solar-radiation-sensor` cap).
6457
+ * Distinct from AmbientLightSensor (lux). */
6458
+ DeviceRole["SolarRadiationSensor"] = "solar-radiation-sensor";
6459
+ /** Soil moisture % (garden/weather `soil-moisture-sensor` cap). */
6460
+ DeviceRole["SoilMoistureSensor"] = "soil-moisture-sensor";
6450
6461
  DeviceRole["PowerSensor"] = "power-sensor";
6451
6462
  DeviceRole["EnergySensor"] = "energy-sensor";
6452
6463
  DeviceRole["VoltageSensor"] = "voltage-sensor";
@@ -45597,27 +45608,46 @@ function buildEcowittBrokerProvider(deps) {
45597
45608
  //#endregion
45598
45609
  //#region src/ecowitt-mapping.ts
45599
45610
  /**
45600
- * Map an Ecowitt quantity to its camstack typed sensor cap. Pure, total.
45611
+ * Map an Ecowitt quantity to its camstack sensor cap. Pure, total.
45601
45612
  *
45602
- * Accepts a plain `string` (not just the {@link Quantity} union) so a persisted
45603
- * config value flows through without a cast any unrecognised string falls to
45604
- * `numeric-sensor`, which is the same safe default the union's tail uses.
45613
+ * Only temperature/humidity/pressure get a dedicated typed cap (the thermostat
45614
+ * surface consumes them); every other quantity rides `numeric-sensor` and is
45615
+ * typed by its {@link roleForQuantity} role instead. Accepts a plain `string`
45616
+ * so a persisted config value flows through without a cast — any unrecognised
45617
+ * string falls to `numeric-sensor`, the same safe default the tail uses.
45605
45618
  */
45606
45619
  function capForQuantity(quantity) {
45607
45620
  switch (quantity) {
45608
45621
  case "temperature": return "temperature-sensor";
45609
45622
  case "humidity": return "humidity-sensor";
45610
45623
  case "pressure": return "pressure-sensor";
45611
- case "irradiance": return "ambient-light-sensor";
45612
- case "uv":
45624
+ default: return "numeric-sensor";
45625
+ }
45626
+ }
45627
+ /**
45628
+ * Map an Ecowitt quantity to the semantic {@link DeviceRole} that drives the
45629
+ * child's icon/label (and, in future, its canonical unit). Pure, total — an
45630
+ * unrecognised quantity falls to {@link DeviceRole.NumericSensor}.
45631
+ *
45632
+ * This is where weather metrics get their typing: wind/rain/uv/irradiance ride
45633
+ * the generic `numeric-sensor` cap but carry a typed role, so the UI renders a
45634
+ * wind / rain / UV / solar glyph instead of a bare hash.
45635
+ */
45636
+ function roleForQuantity(quantity) {
45637
+ switch (quantity) {
45638
+ case "temperature": return DeviceRole.TemperatureSensor;
45639
+ case "humidity": return DeviceRole.HumiditySensor;
45640
+ case "pressure": return DeviceRole.PressureSensor;
45613
45641
  case "wind_speed":
45614
- case "wind_direction":
45642
+ case "wind_direction": return DeviceRole.WindSensor;
45615
45643
  case "precipitation":
45616
- case "precipitation_rate":
45644
+ case "precipitation_rate": return DeviceRole.RainSensor;
45645
+ case "uv": return DeviceRole.UvSensor;
45646
+ case "irradiance": return DeviceRole.SolarRadiationSensor;
45617
45647
  case "lightning_distance":
45618
45648
  case "lightning_count":
45619
- case "vpd": return "numeric-sensor";
45620
- default: return "numeric-sensor";
45649
+ case "vpd": return DeviceRole.NumericSensor;
45650
+ default: return DeviceRole.NumericSensor;
45621
45651
  }
45622
45652
  }
45623
45653
  /**
@@ -46199,6 +46229,7 @@ var EcowittContainerDevice = class extends BaseDevice {
46199
46229
  return this.config.values.sensors.map((sensor) => {
46200
46230
  const meta = {
46201
46231
  type: DeviceType.Sensor,
46232
+ role: roleForQuantity(sensor.quantity),
46202
46233
  name: sensorLabel(sensor.quantity, sensor.channel),
46203
46234
  linkDeviceId: this.id,
46204
46235
  ...this.integrationId !== void 0 ? { integrationId: this.integrationId } : {}
package/dist/addon.mjs CHANGED
@@ -4648,7 +4648,7 @@ function preprocess(fn, schema) {
4648
4648
  });
4649
4649
  }
4650
4650
  //#endregion
4651
- //#region ../types/dist/sleep-NOH4yRwj.mjs
4651
+ //#region ../types/dist/sleep-DVmKHFGi.mjs
4652
4652
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4653
4653
  EventCategory["SystemBoot"] = "system.boot";
4654
4654
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -6448,6 +6448,17 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
6448
6448
  DeviceRole["HumiditySensor"] = "humidity-sensor";
6449
6449
  DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
6450
6450
  DeviceRole["PressureSensor"] = "pressure-sensor";
6451
+ /** Wind speed or direction (weather-station `wind-sensor` cap). */
6452
+ DeviceRole["WindSensor"] = "wind-sensor";
6453
+ /** Rain accumulation or rate (weather-station `rain-sensor` cap). */
6454
+ DeviceRole["RainSensor"] = "rain-sensor";
6455
+ /** UV index (weather-station `uv-sensor` cap). */
6456
+ DeviceRole["UvSensor"] = "uv-sensor";
6457
+ /** Solar irradiance W/m² (weather-station `solar-radiation-sensor` cap).
6458
+ * Distinct from AmbientLightSensor (lux). */
6459
+ DeviceRole["SolarRadiationSensor"] = "solar-radiation-sensor";
6460
+ /** Soil moisture % (garden/weather `soil-moisture-sensor` cap). */
6461
+ DeviceRole["SoilMoistureSensor"] = "soil-moisture-sensor";
6451
6462
  DeviceRole["PowerSensor"] = "power-sensor";
6452
6463
  DeviceRole["EnergySensor"] = "energy-sensor";
6453
6464
  DeviceRole["VoltageSensor"] = "voltage-sensor";
@@ -45598,27 +45609,46 @@ function buildEcowittBrokerProvider(deps) {
45598
45609
  //#endregion
45599
45610
  //#region src/ecowitt-mapping.ts
45600
45611
  /**
45601
- * Map an Ecowitt quantity to its camstack typed sensor cap. Pure, total.
45612
+ * Map an Ecowitt quantity to its camstack sensor cap. Pure, total.
45602
45613
  *
45603
- * Accepts a plain `string` (not just the {@link Quantity} union) so a persisted
45604
- * config value flows through without a cast any unrecognised string falls to
45605
- * `numeric-sensor`, which is the same safe default the union's tail uses.
45614
+ * Only temperature/humidity/pressure get a dedicated typed cap (the thermostat
45615
+ * surface consumes them); every other quantity rides `numeric-sensor` and is
45616
+ * typed by its {@link roleForQuantity} role instead. Accepts a plain `string`
45617
+ * so a persisted config value flows through without a cast — any unrecognised
45618
+ * string falls to `numeric-sensor`, the same safe default the tail uses.
45606
45619
  */
45607
45620
  function capForQuantity(quantity) {
45608
45621
  switch (quantity) {
45609
45622
  case "temperature": return "temperature-sensor";
45610
45623
  case "humidity": return "humidity-sensor";
45611
45624
  case "pressure": return "pressure-sensor";
45612
- case "irradiance": return "ambient-light-sensor";
45613
- case "uv":
45625
+ default: return "numeric-sensor";
45626
+ }
45627
+ }
45628
+ /**
45629
+ * Map an Ecowitt quantity to the semantic {@link DeviceRole} that drives the
45630
+ * child's icon/label (and, in future, its canonical unit). Pure, total — an
45631
+ * unrecognised quantity falls to {@link DeviceRole.NumericSensor}.
45632
+ *
45633
+ * This is where weather metrics get their typing: wind/rain/uv/irradiance ride
45634
+ * the generic `numeric-sensor` cap but carry a typed role, so the UI renders a
45635
+ * wind / rain / UV / solar glyph instead of a bare hash.
45636
+ */
45637
+ function roleForQuantity(quantity) {
45638
+ switch (quantity) {
45639
+ case "temperature": return DeviceRole.TemperatureSensor;
45640
+ case "humidity": return DeviceRole.HumiditySensor;
45641
+ case "pressure": return DeviceRole.PressureSensor;
45614
45642
  case "wind_speed":
45615
- case "wind_direction":
45643
+ case "wind_direction": return DeviceRole.WindSensor;
45616
45644
  case "precipitation":
45617
- case "precipitation_rate":
45645
+ case "precipitation_rate": return DeviceRole.RainSensor;
45646
+ case "uv": return DeviceRole.UvSensor;
45647
+ case "irradiance": return DeviceRole.SolarRadiationSensor;
45618
45648
  case "lightning_distance":
45619
45649
  case "lightning_count":
45620
- case "vpd": return "numeric-sensor";
45621
- default: return "numeric-sensor";
45650
+ case "vpd": return DeviceRole.NumericSensor;
45651
+ default: return DeviceRole.NumericSensor;
45622
45652
  }
45623
45653
  }
45624
45654
  /**
@@ -46200,6 +46230,7 @@ var EcowittContainerDevice = class extends BaseDevice {
46200
46230
  return this.config.values.sensors.map((sensor) => {
46201
46231
  const meta = {
46202
46232
  type: DeviceType.Sensor,
46233
+ role: roleForQuantity(sensor.quantity),
46203
46234
  name: sensorLabel(sensor.quantity, sensor.channel),
46204
46235
  linkDeviceId: this.id,
46205
46236
  ...this.integrationId !== void 0 ? { integrationId: this.integrationId } : {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-ecowitt",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Ecowitt weather-station device-provider addon for CamStack — wraps the @apocaliss92/nodewitt local-poll / push client",
5
5
  "keywords": [
6
6
  "camstack",