Skip to content

Commit

Permalink
fix: make away configuration more home assistant friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
EuleMitKeule committed Nov 12, 2024
1 parent f4943a5 commit cb9799e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions eq3btsmart/thermostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,18 @@ async def async_configure_window_open_temperature(self, temperature: float) -> N
temperature, self.status.presets.window_open_time.value
)

async def async_configure_window_open_duration(self, duration: timedelta) -> None:
async def async_configure_window_open_duration(
self,
duration: timedelta | float,
) -> None:
"""Configures the window open duration."""

if self.status is None or self.status.presets is None:
return

if isinstance(duration, float):
duration = timedelta(minutes=duration)

await self.async_configure_window_open(
self.status.presets.window_open_temperature.value, duration
)
Expand Down Expand Up @@ -251,10 +257,10 @@ async def async_configure_away_temperature(self, temperature: float) -> None:
if self.status is not None and self.status.is_away:
await self.async_set_temperature(temperature)

async def async_configure_away_hours(self, hours: int) -> None:
async def async_configure_away_hours(self, hours: int | float) -> None:
"""Sets the thermostat's away hours."""

self.thermostat_config.away_hours = hours
self.thermostat_config.away_hours = round(hours)

if self.status is not None and self.status.is_away:
await self.async_set_away(True)
Expand Down

0 comments on commit cb9799e

Please sign in to comment.