Skip to content

Commit

Permalink
3.0.0b1
Browse files Browse the repository at this point in the history
  • Loading branch information
magnuselden authored and magnuselden committed Jul 11, 2023
1 parent 008e21e commit 848bcde
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion custom_components/peaqev/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"iot_class": "calculated",
"issue_tracker": "https://github.com/elden1337/hass-peaq/issues",
"requirements": [
"peaqevcore==19.0.0a38"
"peaqevcore==19.0.0a41"
],
"version": "3.0.0b1"
}
11 changes: 6 additions & 5 deletions custom_components/peaqev/peaqservice/hub/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,12 @@ def charger_done(self) -> bool:
async def async_update_prices(self, prices: list) -> None:
if self.options.price.price_aware:
await self.hours.async_update_prices(prices[0], prices[1])
await self.hours.async_update_max_min(
max_charge=self.max_min_controller.max_charge,
car_connected=self.chargecontroller.connected,
session_energy=self.chargecontroller.session.session_energy,
)
if self.max_min_controller.is_on:
await self.hours.async_update_max_min(
max_charge=self.max_min_controller.max_charge,
car_connected=self.chargecontroller.connected,
session_energy=self.chargecontroller.session.session_energy,
)

async def async_update_average_monthly_price(self, val) -> None:
if self.options.price.price_aware and isinstance(val, float):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class MaxMinController:
def __init__(self, hub: HomeAssistantHub):
self.hub: HomeAssistantHub = hub
self.active: bool = hub.options.price.price_aware
self.is_on:bool = False
self._override_max_charge = None
self._original_total_charge = 0
self.override_max_charge: bool = False
Expand All @@ -28,9 +29,11 @@ def max_charge(self) -> int:
if self.active:
if self._override_max_charge is not None:
"""overridden by frontend"""
self.is_on = True
return self._override_max_charge
if self.hub.options.max_charge > 0:
"""set in config flow"""
self.is_on = True
return self.hub.options.max_charge
return self._original_total_charge

Expand Down

0 comments on commit 848bcde

Please sign in to comment.