@riddix/hamh 2.1.0-alpha.405 → 2.1.0-alpha.407
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
|
@@ -167590,6 +167590,8 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
167590
167590
|
logger164.debug(
|
|
167591
167591
|
`update: limits heat=[${minHeatLimit}, ${maxHeatLimit}], cool=[${minCoolLimit}, ${maxCoolLimit}], systemMode=${systemMode}, runningMode=${runningMode}`
|
|
167592
167592
|
);
|
|
167593
|
+
const controlSequence = config10.getControlSequence(entity.state, this.agent);
|
|
167594
|
+
this.internal.controlSequenceOfOperation = controlSequence;
|
|
167593
167595
|
applyPatchState(this.state, {
|
|
167594
167596
|
...this.features.heating ? {
|
|
167595
167597
|
minHeatSetpointLimit: minHeatLimit,
|
|
@@ -167604,10 +167606,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
167604
167606
|
absMaxCoolSetpointLimit: maxCoolLimit
|
|
167605
167607
|
} : {},
|
|
167606
167608
|
localTemperature,
|
|
167607
|
-
controlSequenceOfOperation:
|
|
167608
|
-
entity.state,
|
|
167609
|
-
this.agent
|
|
167610
|
-
),
|
|
167609
|
+
controlSequenceOfOperation: controlSequence,
|
|
167611
167610
|
thermostatRunningState: this.getRunningState(systemMode, runningMode),
|
|
167612
167611
|
systemMode,
|
|
167613
167612
|
// thermostatRunningMode: Only set for Auto mode. Matter.js's reactor handles
|
|
@@ -168013,6 +168012,21 @@ var hvacModeToSystemMode = {
|
|
|
168013
168012
|
function isHeatCoolOnly(modes) {
|
|
168014
168013
|
return modes.includes(ClimateHvacMode.heat_cool) && !modes.includes(ClimateHvacMode.heat) && !modes.includes(ClimateHvacMode.cool);
|
|
168015
168014
|
}
|
|
168015
|
+
var lastHvacDirection = /* @__PURE__ */ new Map();
|
|
168016
|
+
function getHeatCoolOnlyDirection(entity, agent) {
|
|
168017
|
+
const action = attributes4(entity).hvac_action;
|
|
168018
|
+
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
168019
|
+
const entityId = homeAssistant.entityId;
|
|
168020
|
+
if (action === ClimateHvacAction.heating || action === ClimateHvacAction.preheating || action === ClimateHvacAction.defrosting || action === ClimateHvacAction.drying) {
|
|
168021
|
+
lastHvacDirection.set(entityId, "heating");
|
|
168022
|
+
return "heating";
|
|
168023
|
+
}
|
|
168024
|
+
if (action === ClimateHvacAction.cooling) {
|
|
168025
|
+
lastHvacDirection.set(entityId, "cooling");
|
|
168026
|
+
return "cooling";
|
|
168027
|
+
}
|
|
168028
|
+
return lastHvacDirection.get(entityId) ?? "heating";
|
|
168029
|
+
}
|
|
168016
168030
|
var config4 = {
|
|
168017
168031
|
// Temperature range (target_temp_low/high) only works in heat_cool mode.
|
|
168018
168032
|
// In heat or cool mode, HA expects a single "temperature" value.
|
|
@@ -168031,13 +168045,14 @@ var config4 = {
|
|
|
168031
168045
|
getCurrentTemperature: (entity, agent) => getTemp(agent, entity, "current_temperature"),
|
|
168032
168046
|
getTargetHeatingTemperature: (entity, agent) => getTemp(agent, entity, "target_temp_low") ?? getTemp(agent, entity, "target_temperature") ?? getTemp(agent, entity, "temperature"),
|
|
168033
168047
|
getTargetCoolingTemperature: (entity, agent) => getTemp(agent, entity, "target_temp_high") ?? getTemp(agent, entity, "target_temperature") ?? getTemp(agent, entity, "temperature"),
|
|
168034
|
-
getSystemMode: (entity) => {
|
|
168048
|
+
getSystemMode: (entity, agent) => {
|
|
168035
168049
|
const hvacMode = entity.state;
|
|
168036
168050
|
const systemMode = hvacModeToSystemMode[hvacMode] ?? Thermostat3.SystemMode.Off;
|
|
168037
168051
|
if (systemMode === Thermostat3.SystemMode.Auto) {
|
|
168038
168052
|
const modes = attributes4(entity).hvac_modes ?? [];
|
|
168039
168053
|
if (isHeatCoolOnly(modes)) {
|
|
168040
|
-
|
|
168054
|
+
const direction = getHeatCoolOnlyDirection(entity, agent);
|
|
168055
|
+
return direction === "cooling" ? Thermostat3.SystemMode.Cool : Thermostat3.SystemMode.Heat;
|
|
168041
168056
|
}
|
|
168042
168057
|
const hasHeatCool = modes.includes(ClimateHvacMode.heat_cool);
|
|
168043
168058
|
if (hasHeatCool) {
|
|
@@ -168066,16 +168081,13 @@ var config4 = {
|
|
|
168066
168081
|
if (!action) {
|
|
168067
168082
|
return Thermostat3.ThermostatRunningMode.Off;
|
|
168068
168083
|
}
|
|
168069
|
-
|
|
168070
|
-
if (runningMode === Thermostat3.ThermostatRunningMode.Cool && isHeatCoolOnly(attributes4(entity).hvac_modes ?? [])) {
|
|
168071
|
-
return Thermostat3.ThermostatRunningMode.Heat;
|
|
168072
|
-
}
|
|
168073
|
-
return runningMode;
|
|
168084
|
+
return hvacActionToRunningMode[action] ?? Thermostat3.ThermostatRunningMode.Off;
|
|
168074
168085
|
},
|
|
168075
|
-
getControlSequence: (entity) => {
|
|
168086
|
+
getControlSequence: (entity, agent) => {
|
|
168076
168087
|
const modes = attributes4(entity).hvac_modes ?? [];
|
|
168077
168088
|
if (isHeatCoolOnly(modes)) {
|
|
168078
|
-
|
|
168089
|
+
const direction = getHeatCoolOnlyDirection(entity, agent);
|
|
168090
|
+
return direction === "cooling" ? Thermostat3.ControlSequenceOfOperation.CoolingOnly : Thermostat3.ControlSequenceOfOperation.HeatingOnly;
|
|
168079
168091
|
}
|
|
168080
168092
|
const hasCooling = modes.some(
|
|
168081
168093
|
(m) => m === ClimateHvacMode.cool || m === ClimateHvacMode.heat_cool
|
|
@@ -168202,8 +168214,9 @@ function ClimateDevice(homeAssistantEntity) {
|
|
|
168202
168214
|
const hasBatteryAttr = attributes7.battery_level != null || attributes7.battery != null;
|
|
168203
168215
|
const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
|
|
168204
168216
|
const hasBattery = hasBatteryAttr || hasBatteryEntity;
|
|
168205
|
-
const
|
|
168206
|
-
|
|
168217
|
+
const supportsCooling = coolingModes.some(
|
|
168218
|
+
(mode) => attributes7.hvac_modes.includes(mode)
|
|
168219
|
+
);
|
|
168207
168220
|
const hasExplicitHeating = heatingModes.some(
|
|
168208
168221
|
(mode) => attributes7.hvac_modes.includes(mode)
|
|
168209
168222
|
);
|