Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
magnuselden authored and magnuselden committed Jan 20, 2024
1 parent b8f3376 commit c690920
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
7 changes: 3 additions & 4 deletions custom_components/peaqhvac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ async def servicehandler_set_mode(call):
await hub.call_set_mode(mode)

async def servicehandler_boost_water(call):
timeout_in_minutes = call.data.get("timeout")
if 10 < timeout_in_minutes < 60:
timeout = timeout_in_minutes * 60
hub.observer.broadcast("water boost start", timeout)
target = call.data.get("targettemp")
if 10 < target < 60:
hub.observer.broadcast("water boost start", target)

hass.services.async_register(DOMAIN, "enable", servicehandler_enable)
hass.services.async_register(DOMAIN, "disable", servicehandler_disable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


async def async_cycle_waterboost(target_temp:float, async_update_system: callable, hub) -> bool:
end_time = time.time() + 1200
end_time = time.time() + 1800
await async_update_system(operation=HvacOperations.WaterBoost, set_val=1)
while all([
time.time() < end_time,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, hvac, hub):
self._wait_timer = WaitTimer(timeout=WAITTIMER_TIMEOUT, init_now=False)
self._wait_timer_peak = WaitTimer(timeout=WAITTIMER_TIMEOUT, init_now=False)
self.temp_trend = Gradient(
max_age=3600, max_samples=100, precision=2, ignore=0, outlier=20, smoothing_average=3
max_age=900, max_samples=5, precision=2, ignore=0, outlier=20
)
self.model = WaterBoosterModel(self._hub.state_machine)
self.booster = NextWaterBoost(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def _get_temperature_at_datetime(now_dt, target_dt, current_temp, temp_trend) ->
def get_next_start(prices: list, demand_hours: list, non_hours: list, current_temp: float, temp_trend: float,
latest_boost: datetime = None) -> tuple[datetime,float|None]:
water_limit = 40
now_dt = datetime(2024, 1, 16, 10, 50, 0)
now_dt = datetime.now()
trend = -0.5 if -0.5 < temp_trend < 0 else temp_trend
if latest_boost is not None:
if now_dt - latest_boost < timedelta(hours=2):
if now_dt - latest_boost < timedelta(hours=1):
return datetime.max, TARGET_TEMP

start_idx = now_dt.hour
Expand Down Expand Up @@ -72,6 +72,9 @@ def get_next_start(prices: list, demand_hours: list, non_hours: list, current_te
break

if selected is None:
# for d in data:
#if d.is_cold:
#_LOGGER.debug(d)
return datetime.max, None

# cheaper in the vicinity?
Expand Down
4 changes: 2 additions & 2 deletions custom_components/peaqhvac/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ set_mode:

boost_water:
fields:
timeout:
example: 1200
targettemp:
example: 47

0 comments on commit c690920

Please sign in to comment.