@riddix/hamh 2.1.0-alpha.759 → 2.1.0-alpha.760

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.
@@ -123872,6 +123872,7 @@ var init_home_assistant_filter = __esm({
123872
123872
  HomeAssistantMatcherType2["EntityCategory"] = "entity_category";
123873
123873
  HomeAssistantMatcherType2["DeviceName"] = "device_name";
123874
123874
  HomeAssistantMatcherType2["ProductName"] = "product_name";
123875
+ HomeAssistantMatcherType2["Manufacturer"] = "manufacturer";
123875
123876
  HomeAssistantMatcherType2["DeviceClass"] = "device_class";
123876
123877
  })(HomeAssistantMatcherType || (HomeAssistantMatcherType = {}));
123877
123878
  }
@@ -125055,7 +125056,7 @@ var init_bridge_config_schema = __esm({
125055
125056
  {
125056
125057
  const: "any_field_regex",
125057
125058
  title: "any_field_regex",
125058
- description: "Regex tested against a single-line key=value haystack covering entity_id, domain, platform, area, entity_category, device_class, entity_labels, entity_label_names, device_labels, device_label_names, device_name, product_name. Use lookaheads for AND, alternation for OR. Example: '(?=.*domain=light)(?=.*area=living_room)|(?=.*domain=switch)(?=.*entity_labels=.*\\bvoice\\b)'."
125059
+ description: "Regex tested against a single-line key=value haystack covering entity_id, domain, platform, area, entity_category, device_class, entity_labels, entity_label_names, device_labels, device_label_names, device_name, product_name, manufacturer. Use lookaheads for AND, alternation for OR. Example: '(?=.*domain=light)(?=.*area=living_room)|(?=.*domain=switch)(?=.*entity_labels=.*\\bvoice\\b)'."
125059
125060
  },
125060
125061
  {
125061
125062
  const: "area",
@@ -125077,6 +125078,11 @@ var init_bridge_config_schema = __esm({
125077
125078
  title: "product_name",
125078
125079
  description: "Match entities by their product/model name. Supports wildcards. Example: 'Hue*Bulb'."
125079
125080
  },
125081
+ {
125082
+ const: "manufacturer",
125083
+ title: "manufacturer",
125084
+ description: "Match entities by their device manufacturer. Supports wildcards. Handy for MQTT or other generic integrations. Example: '*Sonoff*'."
125085
+ },
125080
125086
  {
125081
125087
  const: "device_class",
125082
125088
  title: "device_class",
@@ -127986,6 +127992,8 @@ function testMatcher(matcher, device, entity, entityState, labels) {
127986
127992
  return testDeviceName(matcher.value, device);
127987
127993
  case "product_name":
127988
127994
  return testProductName(matcher.value, device);
127995
+ case "manufacturer":
127996
+ return testManufacturer(matcher.value, device);
127989
127997
  case "device_class":
127990
127998
  return entityState?.attributes?.device_class === matcher.value;
127991
127999
  }
@@ -128059,7 +128067,8 @@ function buildEntityHaystack(entity, device, entityState, labels) {
128059
128067
  `device_labels=${deviceLabelSlugs.join(",")}`,
128060
128068
  `device_label_names=${deviceLabelNames.join(",")}`,
128061
128069
  `device_name=${deviceName}`,
128062
- `product_name=${productName}`
128070
+ `product_name=${productName}`,
128071
+ `manufacturer=${device?.manufacturer ?? device?.default_manufacturer ?? ""}`
128063
128072
  ].join(" ");
128064
128073
  }
128065
128074
  function testDeviceName(pattern2, device) {
@@ -128092,6 +128101,21 @@ function testProductName(pattern2, device) {
128092
128101
  }
128093
128102
  return lowerProductName.includes(lowerPattern);
128094
128103
  }
128104
+ function testManufacturer(pattern2, device) {
128105
+ if (!device) {
128106
+ return false;
128107
+ }
128108
+ const manufacturer = device.manufacturer ?? device.default_manufacturer;
128109
+ if (!manufacturer) {
128110
+ return false;
128111
+ }
128112
+ const lowerPattern = pattern2.toLowerCase();
128113
+ const lowerManufacturer = manufacturer.toLowerCase();
128114
+ if (lowerPattern.includes("*")) {
128115
+ return patternToRegex(lowerPattern).test(lowerManufacturer);
128116
+ }
128117
+ return lowerManufacturer.includes(lowerPattern);
128118
+ }
128095
128119
  function resolveLabelValue(value, labels) {
128096
128120
  if (labels) {
128097
128121
  const match = labels.find(
@@ -162046,7 +162070,10 @@ var matterDeviceTypeFactories = {
162046
162070
  },
162047
162071
  dishwasher: DishwasherEndpoint,
162048
162072
  dimmable_plugin_unit: (ha) => DimmablePlugInUnitType.set({ homeAssistantEntity: ha }),
162049
- on_off_switch: SwitchDevice,
162073
+ // Expose as On/Off Light (0x0100, an OnOff server) so controllers show a
162074
+ // switch instead of a plug. Plain SwitchDevice is 0x010A (a plug), so the
162075
+ // override had no effect before (#380).
162076
+ on_off_switch: (ha) => OnOffLightType.set({ homeAssistantEntity: ha }),
162050
162077
  door_lock: LockDevice,
162051
162078
  window_covering: CoverDevice,
162052
162079
  thermostat: ClimateDevice,