From 983c5030f4c64a156410b63343bad325bb65def7 Mon Sep 17 00:00:00 2001 From: magnuselden Date: Sat, 14 Oct 2023 22:25:53 +0200 Subject: [PATCH] misc --- custom_components/peaqhvac/manifest.json | 4 ++-- .../peaqhvac/sensors/offsetsensor.py | 2 +- .../peaqhvac/service/hub/weather_prognosis.py | 2 +- .../hvac/house_heater/temperature_helper.py | 15 --------------- .../service/hvac/offset/offset_coordinator.py | 2 +- .../hvac/water_heater/water_heater_coordinator.py | 1 - 6 files changed, 5 insertions(+), 21 deletions(-) diff --git a/custom_components/peaqhvac/manifest.json b/custom_components/peaqhvac/manifest.json index 25a4c9af..567b5df6 100644 --- a/custom_components/peaqhvac/manifest.json +++ b/custom_components/peaqhvac/manifest.json @@ -20,8 +20,8 @@ "iot_class": "calculated", "issue_tracker": "https://github.com/elden1337/hass-peaqhvac/issues", "requirements": [ - "peaqevcore==19.5.1" + "peaqevcore==19.5.2" ], - "version": "2.0.0" + "version": "2.0.1" } diff --git a/custom_components/peaqhvac/sensors/offsetsensor.py b/custom_components/peaqhvac/sensors/offsetsensor.py index a720992e..9a677ff9 100644 --- a/custom_components/peaqhvac/sensors/offsetsensor.py +++ b/custom_components/peaqhvac/sensors/offsetsensor.py @@ -30,7 +30,7 @@ def state(self) -> int: def icon(self) -> str: return "mdi:stairs" - def update(self) -> None: + async def async_update(self) -> None: self._state = self._hub.hvac.current_offset self._offsets = self._offset_dict_to_list( self._hub.hvac.model.current_offset_dict diff --git a/custom_components/peaqhvac/service/hub/weather_prognosis.py b/custom_components/peaqhvac/service/hub/weather_prognosis.py index dfe75e63..6e05b474 100644 --- a/custom_components/peaqhvac/service/hub/weather_prognosis.py +++ b/custom_components/peaqhvac/service/hub/weather_prognosis.py @@ -123,7 +123,7 @@ def get_hvac_prognosis(self, current_temperature: float) -> list: self._hvac_prognosis_list = ret return ret - def get_weatherprognosis_adjustment(self, offsets) -> Tuple[dict, dict]: + def get_weatherprognosis_adjustment(self, offsets, min_price) -> Tuple[dict, dict]: self.update_weather_prognosis() ret = {}, offsets[1] for k, v in offsets[0].items(): diff --git a/custom_components/peaqhvac/service/hvac/house_heater/temperature_helper.py b/custom_components/peaqhvac/service/hvac/house_heater/temperature_helper.py index d4b9b180..41ad905a 100644 --- a/custom_components/peaqhvac/service/hvac/house_heater/temperature_helper.py +++ b/custom_components/peaqhvac/service/hvac/house_heater/temperature_helper.py @@ -11,21 +11,6 @@ def get_tempdiff_inverted(self, current_offset) -> int: _tolerance = self._determine_tolerance(diff, current_offset) return int(diff / _tolerance) * -1 - # def get_temp_extremas(self, current_offset) -> float: - # set_temp = self._hub.sensors.set_temp_indoors.adjusted_temp - # diffs = [set_temp - t for t in self._hub.sensors.average_temp_indoors.all_values] - # cold_diffs = [diff for diff in diffs if diff > 0] - # hot_diffs = [diff for diff in diffs if diff < 0] - # if len(cold_diffs) == len(hot_diffs): - # return 0 - # is_cold = len(cold_diffs) > len(hot_diffs) - # tolerance = self._determine_tolerance(is_cold, current_offset) - # if is_cold: - # ret = mean(cold_diffs) - tolerance - # else: - # ret = mean(hot_diffs) + tolerance - # return round(ret, 2) - def get_temp_extremas(self, current_offset) -> float: set_temp = self._hub.sensors.set_temp_indoors.adjusted_temp diffs = [set_temp - t for t in self._hub.sensors.average_temp_indoors.all_values] diff --git a/custom_components/peaqhvac/service/hvac/offset/offset_coordinator.py b/custom_components/peaqhvac/service/hvac/offset/offset_coordinator.py index 33531f6b..62438add 100644 --- a/custom_components/peaqhvac/service/hvac/offset/offset_coordinator.py +++ b/custom_components/peaqhvac/service/hvac/offset/offset_coordinator.py @@ -112,7 +112,7 @@ def _set_offset(self) -> None: self.model.raw_offsets = self._update_offset() try: _weather_dict = self._hub.prognosis.get_weatherprognosis_adjustment( - self.model.raw_offsets + self.model.raw_offsets, self._hub.sensors.peaqev_facade.min_price ) self.model.calculated_offsets = self._update_offset(_weather_dict[0]) except Exception as e: diff --git a/custom_components/peaqhvac/service/hvac/water_heater/water_heater_coordinator.py b/custom_components/peaqhvac/service/hvac/water_heater/water_heater_coordinator.py index e4a49464..544aa6bc 100644 --- a/custom_components/peaqhvac/service/hvac/water_heater/water_heater_coordinator.py +++ b/custom_components/peaqhvac/service/hvac/water_heater/water_heater_coordinator.py @@ -82,7 +82,6 @@ def demand(self) -> Demand: def _get_demand(self): temp = self.current_temperature ret = get_demand(temp) - _LOGGER.debug(f"Current demand is {ret} for temp {temp}") return ret @IHeater.demand.setter