Skip to content

Commit

Permalink
19.10.12
Browse files Browse the repository at this point in the history
  • Loading branch information
magnuselden authored and magnuselden committed May 25, 2024
1 parent 0260a21 commit d57bf2b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions peaqevcore/services/scheduler/scheduler_facade.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ async def async_create_schedule(

async def async_update_facade(self, model: UpdateSchedulerDTO):
await self.async_update(model)
await self.async_check_states()
await self.async_check_states(model.chargecontroller_state)

async def async_cancel_facade(self):
await self.async_cancel()
self.schedule_created = False

async def async_check_states(self):
async def async_check_states(self, chargecontroller_state: ChargeControllerStates):
if not self.scheduler_active and self.schedule_created:
await self.async_cancel_facade()
elif (
self.hub.chargecontroller.status_string is ChargeControllerStates.Done.name
chargecontroller_state is ChargeControllerStates.Done
):
await self.async_cancel_facade()

Expand Down
4 changes: 4 additions & 0 deletions peaqevcore/services/scheduler/update_scheduler_dto.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from dataclasses import dataclass, field

from peaqevcore.models.chargecontroller_states import ChargeControllerStates


@dataclass
class UpdateSchedulerDTO:
moving_avg24: float
peak: float
chargecontroller_state: ChargeControllerStates
charged_amount: float = 0.0
prices: list|None = field(default_factory=lambda: None)
prices_tomorrow: list|None = field(default_factory=lambda: None)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setuptools.setup(
name="peaqevcore",
version="19.10.11",
version="19.10.12",
author="Magnus Eldén",
description="Core types for peaqev car charging",
url="https://github.com/elden1337/peaqev-core",
Expand Down

0 comments on commit d57bf2b

Please sign in to comment.