Skip to content

Commit

Permalink
feat: allow changing the default away temperature
Browse files Browse the repository at this point in the history
  • Loading branch information
EuleMitKeule committed Nov 12, 2024
1 parent cfdb00d commit c051054
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
23 changes: 21 additions & 2 deletions eq3btsmart/thermostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from eq3btsmart.adapter.eq3_time import Eq3Time
from eq3btsmart.const import (
DEFAULT_AWAY_HOURS,
DEFAULT_AWAY_TEMP,
EQ3BT_MAX_TEMP,
EQ3BT_MIN_TEMP,
EQ3BT_OFF_TEMP,
Expand Down Expand Up @@ -205,6 +204,18 @@ async def async_configure_presets(
)
)

async def async_configure_eco_temperature(self, eco_temperature: float) -> None:
"""Sets the thermostat's eco temperature."""

await self.async_configure_presets(eco_temperature=eco_temperature)

async def async_configure_comfort_temperature(
self, comfort_temperature: float
) -> None:
"""Sets the thermostat's comfort temperature."""

await self.async_configure_presets(comfort_temperature=comfort_temperature)

async def async_configure_temperature_offset(
self, temperature_offset: float
) -> None:
Expand All @@ -215,6 +226,14 @@ async def async_configure_temperature_offset(
OffsetConfigureCommand(offset=eq3_temperature_offset)
)

async def async_configure_away_temperature(self, temperature: float) -> None:
"""Sets the thermostat's away temperature."""

self.thermostat_config.away_temperature = temperature

if self.status is not None and self.status.is_away:
await self.async_set_temperature(temperature)

async def async_set_mode(self, operation_mode: OperationMode) -> None:
"""Set new operation mode."""

Expand Down Expand Up @@ -269,7 +288,7 @@ async def async_set_away(
away_until = datetime.now() + timedelta(hours=DEFAULT_AWAY_HOURS)

if temperature is None:
temperature = DEFAULT_AWAY_TEMP
temperature = self.thermostat_config.away_temperature

eq3_away_until = Eq3AwayTime(away_until)
eq3_temperature = Eq3Temperature(temperature)
Expand Down
3 changes: 3 additions & 0 deletions eq3btsmart/thermostat_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from eq3btsmart.const import DEFAULT_AWAY_TEMP


@dataclass
class ThermostatConfig:
mac_address: str
away_temperature: float = DEFAULT_AWAY_TEMP

0 comments on commit c051054

Please sign in to comment.