mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-03-16 03:26:18 +00:00
fix: energy charts bidding zone in request (#948)
Some checks are pending
Bump Version / Bump Version Workflow (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
docker-build / platform-excludes (push) Waiting to run
docker-build / build (push) Blocked by required conditions
docker-build / merge (push) Blocked by required conditions
pre-commit / pre-commit (push) Waiting to run
Run Pytest on Pull Request / test (push) Waiting to run
Some checks are pending
Bump Version / Bump Version Workflow (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
docker-build / platform-excludes (push) Waiting to run
docker-build / build (push) Blocked by required conditions
docker-build / merge (push) Blocked by required conditions
pre-commit / pre-commit (push) Waiting to run
Run Pytest on Pull Request / test (push) Waiting to run
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:
@@ -2,6 +2,7 @@
|
||||
|
||||
import calendar
|
||||
import os
|
||||
import sys
|
||||
from typing import Any, ClassVar, Iterator, Optional, Union
|
||||
|
||||
import numpy as np
|
||||
@@ -27,6 +28,28 @@ def is_home_assistant_addon() -> bool:
|
||||
return "HASSIO_TOKEN" in os.environ or "SUPERVISOR_TOKEN" in os.environ
|
||||
|
||||
|
||||
def runtime_environment() -> str:
|
||||
"""Return a human-readable description of the runtime environment."""
|
||||
python_version = sys.version.split()[0]
|
||||
|
||||
# Home Assistant add-on
|
||||
if is_home_assistant_addon():
|
||||
ha_version = os.getenv("HOMEASSISTANT_VERSION", "unknown")
|
||||
return f"Home Assistant add-on (HA {ha_version}, Python {python_version})"
|
||||
|
||||
# Home Assistant Core integration
|
||||
if "HOMEASSISTANT_CONFIG" in os.environ:
|
||||
ha_version = os.getenv("HOMEASSISTANT_VERSION", "unknown")
|
||||
return f"Home Assistant Core (HA {ha_version}, Python {python_version})"
|
||||
|
||||
# Docker container
|
||||
if os.path.exists("/.dockerenv"):
|
||||
return f"Docker container (Python {python_version})"
|
||||
|
||||
# Default
|
||||
return f"Standalone Python (Python {python_version})"
|
||||
|
||||
|
||||
class SettingsBaseModel(PydanticBaseModel):
|
||||
"""Base model class for all settings configurations."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user