@riddix/hamh 2.1.0-alpha.666 → 2.1.0-alpha.668
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
|
@@ -148898,6 +148898,7 @@ function entityMappingApi(mappingStorage) {
|
|
|
148898
148898
|
coverSliderDebounceMs: body.coverSliderDebounceMs,
|
|
148899
148899
|
disableClimateOnOff: body.disableClimateOnOff,
|
|
148900
148900
|
disableClimateFanControl: body.disableClimateFanControl,
|
|
148901
|
+
climateKeepModeOnIdle: body.climateKeepModeOnIdle,
|
|
148901
148902
|
composedEntities: body.composedEntities
|
|
148902
148903
|
};
|
|
148903
148904
|
const config10 = await mappingStorage.setMapping(request);
|
|
@@ -149363,7 +149364,8 @@ function configToProfileEntry(config10) {
|
|
|
149363
149364
|
coverSwapOpenClose: config10.coverSwapOpenClose,
|
|
149364
149365
|
coverSliderDebounceMs: config10.coverSliderDebounceMs,
|
|
149365
149366
|
disableClimateOnOff: config10.disableClimateOnOff,
|
|
149366
|
-
disableClimateFanControl: config10.disableClimateFanControl
|
|
149367
|
+
disableClimateFanControl: config10.disableClimateFanControl,
|
|
149368
|
+
climateKeepModeOnIdle: config10.climateKeepModeOnIdle
|
|
149367
149369
|
};
|
|
149368
149370
|
}
|
|
149369
149371
|
function mappingProfileApi(mappingStorage) {
|
|
@@ -149487,7 +149489,8 @@ function mappingProfileApi(mappingStorage) {
|
|
|
149487
149489
|
coverSwapOpenClose: entry.coverSwapOpenClose,
|
|
149488
149490
|
coverSliderDebounceMs: entry.coverSliderDebounceMs,
|
|
149489
149491
|
disableClimateOnOff: entry.disableClimateOnOff,
|
|
149490
|
-
disableClimateFanControl: entry.disableClimateFanControl
|
|
149492
|
+
disableClimateFanControl: entry.disableClimateFanControl,
|
|
149493
|
+
climateKeepModeOnIdle: entry.climateKeepModeOnIdle
|
|
149491
149494
|
});
|
|
149492
149495
|
applied++;
|
|
149493
149496
|
} catch (e) {
|
|
@@ -153459,9 +153462,10 @@ var EntityMappingStorage = class extends Service {
|
|
|
153459
153462
|
coverSliderDebounceMs: sanitizeDebounceMs(request.coverSliderDebounceMs),
|
|
153460
153463
|
disableClimateOnOff: request.disableClimateOnOff || void 0,
|
|
153461
153464
|
disableClimateFanControl: request.disableClimateFanControl || void 0,
|
|
153465
|
+
climateKeepModeOnIdle: request.climateKeepModeOnIdle || void 0,
|
|
153462
153466
|
composedEntities: request.composedEntities?.filter((e) => e.entityId?.trim()) ?? void 0
|
|
153463
153467
|
};
|
|
153464
|
-
if (!config10.matterDeviceType && !config10.customName && !config10.customProductName && !config10.customVendorName && !config10.customSerialNumber && config10.customVendorId === void 0 && config10.disabled !== true && !config10.filterLifeEntity && !config10.cleaningModeEntity && !config10.temperatureEntity && !config10.humidityEntity && !config10.batteryEntity && !config10.roomEntities && !config10.disableLockPin && !config10.powerEntity && !config10.energyEntity && !config10.pressureEntity && !config10.suctionLevelEntity && !config10.mopIntensityEntity && (!config10.customServiceAreas || config10.customServiceAreas.length === 0) && (!config10.customFanSpeedTags || Object.keys(config10.customFanSpeedTags).length === 0) && !config10.currentRoomEntity && !config10.valetudoIdentifier && !config10.coverSwapOpenClose && !config10.coverSliderDebounceMs && !config10.disableClimateOnOff && !config10.disableClimateFanControl && (!config10.composedEntities || config10.composedEntities.length === 0)) {
|
|
153468
|
+
if (!config10.matterDeviceType && !config10.customName && !config10.customProductName && !config10.customVendorName && !config10.customSerialNumber && config10.customVendorId === void 0 && config10.disabled !== true && !config10.filterLifeEntity && !config10.cleaningModeEntity && !config10.temperatureEntity && !config10.humidityEntity && !config10.batteryEntity && !config10.roomEntities && !config10.disableLockPin && !config10.powerEntity && !config10.energyEntity && !config10.pressureEntity && !config10.suctionLevelEntity && !config10.mopIntensityEntity && (!config10.customServiceAreas || config10.customServiceAreas.length === 0) && (!config10.customFanSpeedTags || Object.keys(config10.customFanSpeedTags).length === 0) && !config10.currentRoomEntity && !config10.valetudoIdentifier && !config10.coverSwapOpenClose && !config10.coverSliderDebounceMs && !config10.disableClimateOnOff && !config10.disableClimateFanControl && !config10.climateKeepModeOnIdle && (!config10.composedEntities || config10.composedEntities.length === 0)) {
|
|
153465
153469
|
bridgeMap.delete(request.entityId);
|
|
153466
153470
|
} else {
|
|
153467
153471
|
bridgeMap.set(request.entityId, config10);
|
|
@@ -171928,6 +171932,7 @@ function isHeatCoolOnly(modes) {
|
|
|
171928
171932
|
return modes.includes(ClimateHvacMode.heat_cool) && !modes.includes(ClimateHvacMode.heat) && !modes.includes(ClimateHvacMode.cool);
|
|
171929
171933
|
}
|
|
171930
171934
|
var lastHvacDirection = /* @__PURE__ */ new Map();
|
|
171935
|
+
var climateFreezeState = /* @__PURE__ */ new Map();
|
|
171931
171936
|
function getHeatCoolOnlyDirection(entity, agent) {
|
|
171932
171937
|
const action = attributes4(entity).hvac_action;
|
|
171933
171938
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
@@ -171942,6 +171947,60 @@ function getHeatCoolOnlyDirection(entity, agent) {
|
|
|
171942
171947
|
}
|
|
171943
171948
|
return lastHvacDirection.get(entityId) ?? "heating";
|
|
171944
171949
|
}
|
|
171950
|
+
function computeSystemMode(entity, agent) {
|
|
171951
|
+
const hvacMode = entity.state;
|
|
171952
|
+
const systemMode = hvacModeToSystemMode[hvacMode] ?? Thermostat3.SystemMode.Off;
|
|
171953
|
+
if (systemMode === Thermostat3.SystemMode.Auto) {
|
|
171954
|
+
const modes = attributes4(entity).hvac_modes ?? [];
|
|
171955
|
+
if (isHeatCoolOnly(modes)) {
|
|
171956
|
+
const direction = getHeatCoolOnlyDirection(entity, agent);
|
|
171957
|
+
return direction === "cooling" ? Thermostat3.SystemMode.Cool : Thermostat3.SystemMode.Heat;
|
|
171958
|
+
}
|
|
171959
|
+
const hasMatterAuto = modes.includes(ClimateHvacMode.heat_cool) && (modes.includes(ClimateHvacMode.heat) || modes.includes(ClimateHvacMode.cool));
|
|
171960
|
+
if (hasMatterAuto) {
|
|
171961
|
+
return systemMode;
|
|
171962
|
+
}
|
|
171963
|
+
const hasCooling = modes.some((m) => m === ClimateHvacMode.cool);
|
|
171964
|
+
const hasHeating = modes.some(
|
|
171965
|
+
(m) => m === ClimateHvacMode.heat || m === ClimateHvacMode.auto
|
|
171966
|
+
);
|
|
171967
|
+
if (hasHeating && !hasCooling) {
|
|
171968
|
+
return Thermostat3.SystemMode.Heat;
|
|
171969
|
+
}
|
|
171970
|
+
if (hasCooling && !hasHeating) {
|
|
171971
|
+
return Thermostat3.SystemMode.Cool;
|
|
171972
|
+
}
|
|
171973
|
+
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
171974
|
+
const entityId = homeAssistant.entityId;
|
|
171975
|
+
const action = attributes4(entity).hvac_action;
|
|
171976
|
+
if (action === ClimateHvacAction.cooling) {
|
|
171977
|
+
lastHvacDirection.set(entityId, "cooling");
|
|
171978
|
+
return Thermostat3.SystemMode.Cool;
|
|
171979
|
+
}
|
|
171980
|
+
if (action === ClimateHvacAction.heating) {
|
|
171981
|
+
lastHvacDirection.set(entityId, "heating");
|
|
171982
|
+
return Thermostat3.SystemMode.Heat;
|
|
171983
|
+
}
|
|
171984
|
+
const remembered = lastHvacDirection.get(entityId);
|
|
171985
|
+
if (remembered) {
|
|
171986
|
+
return remembered === "cooling" ? Thermostat3.SystemMode.Cool : Thermostat3.SystemMode.Heat;
|
|
171987
|
+
}
|
|
171988
|
+
const current = attributes4(entity).current_temperature;
|
|
171989
|
+
const target = attributes4(entity).temperature;
|
|
171990
|
+
if (typeof current === "number" && typeof target === "number") {
|
|
171991
|
+
if (current > target) {
|
|
171992
|
+
lastHvacDirection.set(entityId, "cooling");
|
|
171993
|
+
return Thermostat3.SystemMode.Cool;
|
|
171994
|
+
}
|
|
171995
|
+
if (current < target) {
|
|
171996
|
+
lastHvacDirection.set(entityId, "heating");
|
|
171997
|
+
return Thermostat3.SystemMode.Heat;
|
|
171998
|
+
}
|
|
171999
|
+
}
|
|
172000
|
+
return Thermostat3.SystemMode.Cool;
|
|
172001
|
+
}
|
|
172002
|
+
return systemMode;
|
|
172003
|
+
}
|
|
171945
172004
|
var config4 = {
|
|
171946
172005
|
// Temperature range (target_temp_low/high) only works in heat_cool mode.
|
|
171947
172006
|
// In heat or cool mode, HA expects a single "temperature" value.
|
|
@@ -171961,58 +172020,37 @@ var config4 = {
|
|
|
171961
172020
|
getTargetHeatingTemperature: (entity, agent) => getTemp(agent, entity, "target_temp_low") ?? getTemp(agent, entity, "target_temperature") ?? getTemp(agent, entity, "temperature"),
|
|
171962
172021
|
getTargetCoolingTemperature: (entity, agent) => getTemp(agent, entity, "target_temp_high") ?? getTemp(agent, entity, "target_temperature") ?? getTemp(agent, entity, "temperature"),
|
|
171963
172022
|
getSystemMode: (entity, agent) => {
|
|
171964
|
-
const
|
|
171965
|
-
const
|
|
171966
|
-
|
|
171967
|
-
|
|
171968
|
-
|
|
171969
|
-
|
|
171970
|
-
|
|
171971
|
-
|
|
171972
|
-
|
|
171973
|
-
|
|
171974
|
-
|
|
171975
|
-
|
|
171976
|
-
|
|
171977
|
-
const hasHeating = modes.some(
|
|
171978
|
-
(m) => m === ClimateHvacMode.heat || m === ClimateHvacMode.auto
|
|
171979
|
-
);
|
|
171980
|
-
if (hasHeating && !hasCooling) {
|
|
171981
|
-
return Thermostat3.SystemMode.Heat;
|
|
171982
|
-
}
|
|
171983
|
-
if (hasCooling && !hasHeating) {
|
|
171984
|
-
return Thermostat3.SystemMode.Cool;
|
|
171985
|
-
}
|
|
171986
|
-
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
171987
|
-
const entityId = homeAssistant.entityId;
|
|
171988
|
-
const action = attributes4(entity).hvac_action;
|
|
171989
|
-
if (action === ClimateHvacAction.cooling) {
|
|
171990
|
-
lastHvacDirection.set(entityId, "cooling");
|
|
171991
|
-
return Thermostat3.SystemMode.Cool;
|
|
171992
|
-
}
|
|
171993
|
-
if (action === ClimateHvacAction.heating) {
|
|
171994
|
-
lastHvacDirection.set(entityId, "heating");
|
|
171995
|
-
return Thermostat3.SystemMode.Heat;
|
|
172023
|
+
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
172024
|
+
const entityId = homeAssistant.entityId;
|
|
172025
|
+
const computed = computeSystemMode(entity, agent);
|
|
172026
|
+
if (computed !== Thermostat3.SystemMode.Off) {
|
|
172027
|
+
const existing = climateFreezeState.get(entityId);
|
|
172028
|
+
if (existing) {
|
|
172029
|
+
existing.lastNonOffMode = computed;
|
|
172030
|
+
existing.pending = true;
|
|
172031
|
+
} else {
|
|
172032
|
+
climateFreezeState.set(entityId, {
|
|
172033
|
+
lastNonOffMode: computed,
|
|
172034
|
+
pending: true
|
|
172035
|
+
});
|
|
171996
172036
|
}
|
|
171997
|
-
|
|
171998
|
-
|
|
171999
|
-
|
|
172037
|
+
return computed;
|
|
172038
|
+
}
|
|
172039
|
+
const action = attributes4(entity).hvac_action;
|
|
172040
|
+
if (action === ClimateHvacAction.off) {
|
|
172041
|
+
const existing = climateFreezeState.get(entityId);
|
|
172042
|
+
if (existing) {
|
|
172043
|
+
existing.pending = false;
|
|
172000
172044
|
}
|
|
172001
|
-
|
|
172002
|
-
|
|
172003
|
-
|
|
172004
|
-
|
|
172005
|
-
|
|
172006
|
-
|
|
172007
|
-
}
|
|
172008
|
-
if (current < target) {
|
|
172009
|
-
lastHvacDirection.set(entityId, "heating");
|
|
172010
|
-
return Thermostat3.SystemMode.Heat;
|
|
172011
|
-
}
|
|
172045
|
+
return computed;
|
|
172046
|
+
}
|
|
172047
|
+
if (homeAssistant.state.mapping?.climateKeepModeOnIdle === true) {
|
|
172048
|
+
const existing = climateFreezeState.get(entityId);
|
|
172049
|
+
if (existing?.pending) {
|
|
172050
|
+
return existing.lastNonOffMode;
|
|
172012
172051
|
}
|
|
172013
|
-
return Thermostat3.SystemMode.Cool;
|
|
172014
172052
|
}
|
|
172015
|
-
return
|
|
172053
|
+
return computed;
|
|
172016
172054
|
},
|
|
172017
172055
|
getRunningMode: (entity) => {
|
|
172018
172056
|
const action = attributes4(entity).hvac_action;
|