mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-07-21 01:08:12 +00:00
fix: energy charts bidding zone in request (#948)
Some checks failed
Bump Version / Bump Version Workflow (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
docker-build / platform-excludes (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled
docker-build / build (push) Has been cancelled
docker-build / merge (push) Has been cancelled
Close stale pull requests/issues / Find Stale issues and PRs (push) Has been cancelled
Some checks failed
Bump Version / Bump Version Workflow (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
docker-build / platform-excludes (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled
docker-build / build (push) Has been cancelled
docker-build / merge (push) Has been cancelled
Close stale pull requests/issues / Find Stale issues and PRs (push) Has been cancelled
Ensure that the bidding zone in the request is correctly set to a string value (not an enum). This seems to be also an issue with python version < 3.11. Add safeguards to only use python >= 3.11. Still keep a regression test for the enum conversion to string. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import traceback
|
||||
from asyncio import Lock, get_running_loop
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from enum import Enum
|
||||
from enum import StrEnum
|
||||
from functools import partial
|
||||
from typing import ClassVar, Optional
|
||||
|
||||
@@ -30,7 +30,7 @@ from akkudoktoreos.utils.datetimeutil import DateTime, to_datetime
|
||||
executor = ThreadPoolExecutor(max_workers=1)
|
||||
|
||||
|
||||
class EnergyManagementStage(Enum):
|
||||
class EnergyManagementStage(StrEnum):
|
||||
"""Enumeration of the main stages in the energy management lifecycle."""
|
||||
|
||||
IDLE = "IDLE"
|
||||
@@ -39,10 +39,6 @@ class EnergyManagementStage(Enum):
|
||||
OPTIMIZATION = "OPTIMIZATION"
|
||||
CONTROL_DISPATCH = "CONTROL_DISPATCH"
|
||||
|
||||
def __str__(self) -> str:
|
||||
"""Return the string representation of the stage."""
|
||||
return self.value
|
||||
|
||||
|
||||
async def ems_manage_energy() -> None:
|
||||
"""Repeating task for managing energy.
|
||||
@@ -193,7 +189,7 @@ class EnergyManagement(
|
||||
None
|
||||
"""
|
||||
# Ensure there is only one optimization/ energy management run at a time
|
||||
if not EnergyManagementMode.is_valid(mode):
|
||||
if not mode in EnergyManagementMode._value2member_map_:
|
||||
raise ValueError(f"Unknown energy management mode {mode}.")
|
||||
if mode == EnergyManagementMode.DISABLED:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user