@riddix/hamh 2.1.0-alpha.399 → 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.
package/dist/backend/cli.js
CHANGED
|
@@ -166940,41 +166940,6 @@ function buildEntityPayload(registry2, entityId) {
|
|
|
166940
166940
|
deviceRegistry
|
|
166941
166941
|
};
|
|
166942
166942
|
}
|
|
166943
|
-
function buildAirPurifierSubType(attributes7, mapping) {
|
|
166944
|
-
const supportedFeatures = attributes7.supported_features ?? 0;
|
|
166945
|
-
const features2 = /* @__PURE__ */ new Set();
|
|
166946
|
-
if (testBit(supportedFeatures, FanDeviceFeature.SET_SPEED)) {
|
|
166947
|
-
features2.add("MultiSpeed");
|
|
166948
|
-
features2.add("Step");
|
|
166949
|
-
}
|
|
166950
|
-
if (testBit(supportedFeatures, FanDeviceFeature.PRESET_MODE)) {
|
|
166951
|
-
features2.add("Auto");
|
|
166952
|
-
}
|
|
166953
|
-
if (testBit(supportedFeatures, FanDeviceFeature.DIRECTION)) {
|
|
166954
|
-
features2.add("AirflowDirection");
|
|
166955
|
-
}
|
|
166956
|
-
if (testBit(supportedFeatures, FanDeviceFeature.OSCILLATE)) {
|
|
166957
|
-
features2.add("Rocking");
|
|
166958
|
-
}
|
|
166959
|
-
const presetModes = attributes7.preset_modes ?? [];
|
|
166960
|
-
const hasWindModes = presetModes.some(
|
|
166961
|
-
(m) => m.toLowerCase() === "natural" || m.toLowerCase() === "nature" || m.toLowerCase() === "sleep"
|
|
166962
|
-
);
|
|
166963
|
-
if (hasWindModes) {
|
|
166964
|
-
features2.add("Wind");
|
|
166965
|
-
}
|
|
166966
|
-
let device = AirPurifierDevice.with(
|
|
166967
|
-
IdentifyServer2,
|
|
166968
|
-
HomeAssistantEntityBehavior,
|
|
166969
|
-
FanOnOffServer,
|
|
166970
|
-
FanFanControlServer.with(...features2)
|
|
166971
|
-
);
|
|
166972
|
-
const hasFilterLife = attributes7.filter_life != null || attributes7.filter_life_remaining != null || attributes7.filter_life_level != null || !!mapping?.filterLifeEntity;
|
|
166973
|
-
if (hasFilterLife) {
|
|
166974
|
-
device = device.with(AirPurifierHepaFilterMonitoringServer);
|
|
166975
|
-
}
|
|
166976
|
-
return device;
|
|
166977
|
-
}
|
|
166978
166943
|
var coolingModes = [
|
|
166979
166944
|
ClimateHvacMode.heat_cool,
|
|
166980
166945
|
ClimateHvacMode.cool
|
|
@@ -167069,11 +167034,40 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
|
|
|
167069
167034
|
const { registry: registry2, primaryEntityId } = config10;
|
|
167070
167035
|
const primaryPayload = buildEntityPayload(registry2, primaryEntityId);
|
|
167071
167036
|
if (!primaryPayload) return void 0;
|
|
167072
|
-
|
|
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(
|
|
167073
167061
|
BasicInformationServer2,
|
|
167074
167062
|
IdentifyServer2,
|
|
167075
|
-
HomeAssistantEntityBehavior
|
|
167063
|
+
HomeAssistantEntityBehavior,
|
|
167064
|
+
FanOnOffServer,
|
|
167065
|
+
FanFanControlServer.with(...features2)
|
|
167076
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
|
+
}
|
|
167077
167071
|
const mapping = {
|
|
167078
167072
|
entityId: primaryEntityId,
|
|
167079
167073
|
...config10.batteryEntityId ? { batteryEntity: config10.batteryEntityId } : {},
|
|
@@ -167093,22 +167087,6 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
|
|
|
167093
167087
|
const endpointId = createEndpointId2(primaryEntityId, config10.customName);
|
|
167094
167088
|
const parts = [];
|
|
167095
167089
|
const subEndpointMap = /* @__PURE__ */ new Map();
|
|
167096
|
-
const airPurifierAttributes = primaryPayload.state.attributes;
|
|
167097
|
-
const airPurifierSubType = buildAirPurifierSubType(
|
|
167098
|
-
airPurifierAttributes,
|
|
167099
|
-
config10.mapping
|
|
167100
|
-
);
|
|
167101
|
-
const airPurifierSub = new Endpoint(
|
|
167102
|
-
airPurifierSubType.set({
|
|
167103
|
-
homeAssistantEntity: {
|
|
167104
|
-
entity: primaryPayload,
|
|
167105
|
-
mapping
|
|
167106
|
-
}
|
|
167107
|
-
}),
|
|
167108
|
-
{ id: `${endpointId}_purifier` }
|
|
167109
|
-
);
|
|
167110
|
-
parts.push(airPurifierSub);
|
|
167111
|
-
subEndpointMap.set(primaryEntityId, airPurifierSub);
|
|
167112
167090
|
let tempSub;
|
|
167113
167091
|
if (config10.temperatureEntityId) {
|
|
167114
167092
|
const tempPayload = buildEntityPayload(
|
|
@@ -167174,7 +167152,7 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
|
|
|
167174
167152
|
endpoint.subEndpoints.set(entityId, sub);
|
|
167175
167153
|
}
|
|
167176
167154
|
const subLabels = [
|
|
167177
|
-
"AirPurifier",
|
|
167155
|
+
"AirPurifier(parent)",
|
|
167178
167156
|
tempSub ? "+Temp" : "",
|
|
167179
167157
|
humSub ? "+Hum" : "",
|
|
167180
167158
|
climateSub ? "+Therm" : "",
|