@riddix/hamh 2.1.0-alpha.398 → 2.1.0-alpha.400

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.
@@ -165627,9 +165627,9 @@ var OnOffServerBase = class extends OnOffServer {
165627
165627
  };
165628
165628
  logger158.info(`[${homeAssistant.entityId}] Turning ON -> ${action.action}`);
165629
165629
  notifyLightTurnedOn(homeAssistant.entityId);
165630
+ applyPatchState(this.state, { onOff: true });
165630
165631
  homeAssistant.callAction(action);
165631
165632
  if (turnOff === null) {
165632
- applyPatchState(this.state, { onOff: true });
165633
165633
  setTimeout(this.callback(this.autoReset), 1e3);
165634
165634
  }
165635
165635
  }
@@ -165644,6 +165644,7 @@ var OnOffServerBase = class extends OnOffServer {
165644
165644
  action: "homeassistant.turn_off"
165645
165645
  };
165646
165646
  logger158.info(`[${homeAssistant.entityId}] Turning OFF -> ${action.action}`);
165647
+ applyPatchState(this.state, { onOff: false });
165647
165648
  homeAssistant.callAction(action);
165648
165649
  }
165649
165650
  autoReset() {
@@ -166878,7 +166879,7 @@ var FanFanControlServer = FanControlServer2(fanControlConfig);
166878
166879
  var FanOnOffServer = OnOffServer2({
166879
166880
  turnOn: () => ({ action: "fan.turn_on" }),
166880
166881
  turnOff: () => ({ action: "fan.turn_off" })
166881
- }).with("Lighting");
166882
+ });
166882
166883
 
166883
166884
  // src/matter/endpoints/composed/composed-air-purifier-endpoint.ts
166884
166885
  var logger160 = Logger.get("ComposedAirPurifierEndpoint");
@@ -166939,41 +166940,6 @@ function buildEntityPayload(registry2, entityId) {
166939
166940
  deviceRegistry
166940
166941
  };
166941
166942
  }
166942
- function buildAirPurifierSubType(attributes7, mapping) {
166943
- const supportedFeatures = attributes7.supported_features ?? 0;
166944
- const features2 = /* @__PURE__ */ new Set();
166945
- if (testBit(supportedFeatures, FanDeviceFeature.SET_SPEED)) {
166946
- features2.add("MultiSpeed");
166947
- features2.add("Step");
166948
- }
166949
- if (testBit(supportedFeatures, FanDeviceFeature.PRESET_MODE)) {
166950
- features2.add("Auto");
166951
- }
166952
- if (testBit(supportedFeatures, FanDeviceFeature.DIRECTION)) {
166953
- features2.add("AirflowDirection");
166954
- }
166955
- if (testBit(supportedFeatures, FanDeviceFeature.OSCILLATE)) {
166956
- features2.add("Rocking");
166957
- }
166958
- const presetModes = attributes7.preset_modes ?? [];
166959
- const hasWindModes = presetModes.some(
166960
- (m) => m.toLowerCase() === "natural" || m.toLowerCase() === "nature" || m.toLowerCase() === "sleep"
166961
- );
166962
- if (hasWindModes) {
166963
- features2.add("Wind");
166964
- }
166965
- let device = AirPurifierDevice.with(
166966
- IdentifyServer2,
166967
- HomeAssistantEntityBehavior,
166968
- FanOnOffServer,
166969
- FanFanControlServer.with(...features2)
166970
- );
166971
- const hasFilterLife = attributes7.filter_life != null || attributes7.filter_life_remaining != null || attributes7.filter_life_level != null || !!mapping?.filterLifeEntity;
166972
- if (hasFilterLife) {
166973
- device = device.with(AirPurifierHepaFilterMonitoringServer);
166974
- }
166975
- return device;
166976
- }
166977
166943
  var coolingModes = [
166978
166944
  ClimateHvacMode.heat_cool,
166979
166945
  ClimateHvacMode.cool
@@ -167068,11 +167034,40 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
167068
167034
  const { registry: registry2, primaryEntityId } = config10;
167069
167035
  const primaryPayload = buildEntityPayload(registry2, primaryEntityId);
167070
167036
  if (!primaryPayload) return void 0;
167071
- let parentType = BridgedNodeEndpoint.with(
167037
+ const airPurifierAttributes = primaryPayload.state.attributes;
167038
+ const supportedFeatures = airPurifierAttributes.supported_features ?? 0;
167039
+ const features2 = /* @__PURE__ */ new Set();
167040
+ if (testBit(supportedFeatures, FanDeviceFeature.SET_SPEED)) {
167041
+ features2.add("MultiSpeed");
167042
+ features2.add("Step");
167043
+ }
167044
+ if (testBit(supportedFeatures, FanDeviceFeature.PRESET_MODE)) {
167045
+ features2.add("Auto");
167046
+ }
167047
+ if (testBit(supportedFeatures, FanDeviceFeature.DIRECTION)) {
167048
+ features2.add("AirflowDirection");
167049
+ }
167050
+ if (testBit(supportedFeatures, FanDeviceFeature.OSCILLATE)) {
167051
+ features2.add("Rocking");
167052
+ }
167053
+ const presetModes = airPurifierAttributes.preset_modes ?? [];
167054
+ const hasWindModes = presetModes.some(
167055
+ (m) => m.toLowerCase() === "natural" || m.toLowerCase() === "nature" || m.toLowerCase() === "sleep"
167056
+ );
167057
+ if (hasWindModes) {
167058
+ features2.add("Wind");
167059
+ }
167060
+ let parentType = AirPurifierDevice.with(
167072
167061
  BasicInformationServer2,
167073
167062
  IdentifyServer2,
167074
- HomeAssistantEntityBehavior
167063
+ HomeAssistantEntityBehavior,
167064
+ FanOnOffServer,
167065
+ FanFanControlServer.with(...features2)
167075
167066
  );
167067
+ const hasFilterLife = airPurifierAttributes.filter_life != null || airPurifierAttributes.filter_life_remaining != null || airPurifierAttributes.filter_life_level != null || !!config10.mapping?.filterLifeEntity;
167068
+ if (hasFilterLife) {
167069
+ parentType = parentType.with(AirPurifierHepaFilterMonitoringServer);
167070
+ }
167076
167071
  const mapping = {
167077
167072
  entityId: primaryEntityId,
167078
167073
  ...config10.batteryEntityId ? { batteryEntity: config10.batteryEntityId } : {},
@@ -167092,22 +167087,6 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
167092
167087
  const endpointId = createEndpointId2(primaryEntityId, config10.customName);
167093
167088
  const parts = [];
167094
167089
  const subEndpointMap = /* @__PURE__ */ new Map();
167095
- const airPurifierAttributes = primaryPayload.state.attributes;
167096
- const airPurifierSubType = buildAirPurifierSubType(
167097
- airPurifierAttributes,
167098
- config10.mapping
167099
- );
167100
- const airPurifierSub = new Endpoint(
167101
- airPurifierSubType.set({
167102
- homeAssistantEntity: {
167103
- entity: primaryPayload,
167104
- mapping
167105
- }
167106
- }),
167107
- { id: `${endpointId}_purifier` }
167108
- );
167109
- parts.push(airPurifierSub);
167110
- subEndpointMap.set(primaryEntityId, airPurifierSub);
167111
167090
  let tempSub;
167112
167091
  if (config10.temperatureEntityId) {
167113
167092
  const tempPayload = buildEntityPayload(
@@ -167173,7 +167152,7 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
167173
167152
  endpoint.subEndpoints.set(entityId, sub);
167174
167153
  }
167175
167154
  const subLabels = [
167176
- "AirPurifier",
167155
+ "AirPurifier(parent)",
167177
167156
  tempSub ? "+Temp" : "",
167178
167157
  humSub ? "+Hum" : "",
167179
167158
  climateSub ? "+Therm" : "",