Skip to content

Commit e2041ad

Browse files
committed
Fixes for away preset
1 parent 993d561 commit e2041ad

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

custom_components/cometblue/climate.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,7 @@ def current_temperature(self) -> float | None:
7474
@property
7575
def target_temperature(self) -> float | None:
7676
"""Return the temperature currently set to be reached."""
77-
# if holiday mode is active (i.e. temperature is available), return holiday temperature
78-
return (
79-
self.coordinator.data["holiday"].get("temperature")
80-
or self.coordinator.data["manualTemp"]
81-
)
77+
return self.coordinator.data["manualTemp"]
8278

8379
@property
8480
def target_temperature_high(self) -> float | None:
@@ -105,21 +101,20 @@ def hvac_action(self) -> HVACAction | None:
105101

106102
if self.coordinator.data["manualTemp"] == 7.5:
107103
return HVACAction.OFF
108-
if (
109-
self.coordinator.data["currentTemp"] + 0.5
110-
< self.coordinator.data["manualTemp"]
111-
):
104+
if (self.target_temperature or 0.0) > (self.target_temperature_low or 0.0):
112105
return HVACAction.HEATING
113106
return HVACAction.IDLE
114107

115108
@property
116109
def preset_mode(self) -> str | None:
117110
"""Return the current preset mode, e.g., home, away, temp."""
118111
# presets have an order in which they are displayed on TRV:
119-
# away, comfort, eco, none (or manual)
112+
# away, comfort, eco, none (manual)
120113
if (
121114
self.coordinator.data["holiday"].get("start") is None
122115
and self.coordinator.data["holiday"].get("end") is not None
116+
and self.coordinator.data["manualTemp"]
117+
== self.coordinator.data["holiday"].get("temperature")
123118
):
124119
return PRESET_AWAY
125120
if self.target_temperature == self.target_temperature_high:
@@ -131,11 +126,9 @@ def preset_mode(self) -> str | None:
131126
async def async_set_temperature(self, **kwargs: Any) -> None:
132127
"""Set new target temperatures."""
133128

134-
# Not sure if actually the case. Maybe set vacation mode to really hot and check
135-
# what happens when changing it manually
136129
if self.preset_mode == PRESET_AWAY:
137130
raise ValueError(
138-
"Cannot adjust TRV remotely, manually disable 'away' mode on TRV first"
131+
"Cannot adjust TRV remotely, manually disable 'holiday' mode on TRV first"
139132
)
140133

141134
await self.coordinator.send_command(
@@ -159,7 +152,7 @@ async def async_set_preset_mode(self, preset_mode: str) -> None:
159152
if self.preset_modes and preset_mode not in self.preset_modes:
160153
raise ValueError(f"Unsupported preset_mode '{preset_mode}'")
161154
if preset_mode in [PRESET_NONE, PRESET_AWAY]:
162-
raise ValueError(f"Setting preset '{preset_mode}' is not supported.")
155+
raise ValueError(f"Unable to set preset '{preset_mode}', display only.")
163156
if preset_mode == PRESET_ECO:
164157
return await self.async_set_temperature(
165158
temperature=self.target_temperature_low
@@ -180,3 +173,4 @@ async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
180173
return await self.async_set_temperature(
181174
temperature=self.target_temperature_low
182175
)
176+
raise ValueError(f"Unknown HVAC mode '{hvac_mode}'")

custom_components/cometblue/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
"requirements": [
1818
"git+https://github.com/rikroe/eurotronic-cometblue.git@ha-component#eurotronic-cometblue==1.0"
1919
],
20-
"version": "20231028.1"
20+
"version": "20231030.1"
2121
}

0 commit comments

Comments
 (0)