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 Oct 14, 2023
1 parent 1b06cc9 commit 983c503
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 21 deletions.
4 changes: 2 additions & 2 deletions custom_components/peaqhvac/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

2 changes: 1 addition & 1 deletion custom_components/peaqhvac/sensors/offsetsensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 983c503

Please sign in to comment.