Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-pdm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Changes can be followed at [CHANGELOG.md](https://github.com/waldbaer/e3dc-cli/b

## Requirements ##

- [Python 3.9](https://www.python.org/)
- [Python 3.10](https://www.python.org/)
- [pip](https://pip.pypa.io/) or [pipx](https://pipx.pypa.io/stable/)

For development:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ authors = [{ name = "Sebastian Waldvogel", email = "sebastian@waldvogels.de" }]
license = { text = "MIT" }
readme = "README.md"

requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"pye3dc==0.9.3",
"pye3dc==0.10.0",
"tzlocal==5.3.1",
"jsonargparse==4.42.0",
"rich-argparse==1.7.2",
Expand Down
22 changes: 11 additions & 11 deletions src/e3dc_cli/argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# ---- Imports ----
import sys
from typing import Any, Dict, List, Optional
from typing import Any, Dict, List

from jsonargparse import ArgumentParser, DefaultHelpFormatter
from pydantic import SecretStr
Expand Down Expand Up @@ -86,7 +86,7 @@ def parse_config(prog: str, version: str, copy_right: str, author: str, arg_list
arg_parser.add_argument(
"-o",
"--output",
type=Optional[str],
type=str | None,
help="Path of JSON output file. If not set JSON output is written to console / stdout",
)

Expand All @@ -103,7 +103,7 @@ def parse_config(prog: str, version: str, copy_right: str, author: str, arg_list
)
arg_parser.add_argument(
"--connection.address",
type=Optional[str],
type=str | None,
help="""IP or DNS address of the E3/DC system.
Only relevant for connection type 'local'.
""",
Expand All @@ -120,14 +120,14 @@ def parse_config(prog: str, version: str, copy_right: str, author: str, arg_list
)
arg_parser.add_argument(
"--connection.rscp_password",
type=Optional[SecretStr],
type=SecretStr | None,
help="""RSCP password. Set on the device via Main Page -> Personalize -> User profile -> RSCP password.
Only relevant for connection type 'local',
""",
)
arg_parser.add_argument(
"--connection.serial_number",
type=Optional[SecretStr],
type=SecretStr | None,
help="""Serial number of the system (see 'SN' in E3/DC portal).
Only relevant for connection type 'web'.
""",
Expand Down Expand Up @@ -168,7 +168,7 @@ def parse_config(prog: str, version: str, copy_right: str, author: str, arg_list
# ---- Setter ----
arg_parser.add_argument(
"--set.power_limits.enable",
type=Optional[bool],
type=bool | None,
metavar="{true,false}",
help="""true: enable manual SmartPower limits. false: Use automatic mode.
Automatically set to 'true' if not explicitly set and any other manual limit
Expand All @@ -177,23 +177,23 @@ def parse_config(prog: str, version: str, copy_right: str, author: str, arg_list
)
arg_parser.add_argument(
"--set.power_limits.max_charge",
type=Optional[int],
type=int | None,
help="""SmartPower maximum charging power. Unit: Watt.
Automatically set to the systems max. battery charge power limit if not explicitly set.
Only relevant if set.power_limits.enable is 'true' or not explicitly configured.
""",
)
arg_parser.add_argument(
"--set.power_limits.max_discharge",
type=Optional[int],
type=int | None,
help="""SmartPower maximum discharging power. Unit: Watt.
Automatically set to the systems max. battery discharge power limit if not explicitly set.
Only relevant if set.power_limits.enable is 'true' or not explicitly configured.
""",
)
arg_parser.add_argument(
"--set.power_limits.discharge_start",
type=Optional[int],
type=int | None,
help="""SmartPower lower charge / discharge threshold. Unit: Watt.
Automatically set to the systems discharge default threshold if not explicitly set.
Only relevant if set.power_limits.enable is 'true' or not explicitly configured.
Expand All @@ -202,13 +202,13 @@ def parse_config(prog: str, version: str, copy_right: str, author: str, arg_list

arg_parser.add_argument(
"--set.powersave",
type=Optional[bool],
type=bool | None,
metavar="{true,false}",
help="Enable / Disable PowerSave of the inverter (inverter switches to standby mode when not in use).",
)
arg_parser.add_argument(
"--set.weather_regulated_charge",
type=Optional[bool],
type=bool | None,
metavar="{true,false}",
help="Enabled / Disable optimized charging based on the weather forecast.",
)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import os
import re
from typing import Optional

import pytest
from pytest_mock.plugin import MockerFixture
Expand Down Expand Up @@ -223,7 +222,7 @@ def test_ct_query_single(
@pytest.mark.parametrize("connection_type", [ConnectionType.local, ConnectionType.web])
@pytest.mark.parametrize("output_file", [None, "e3dc_cli_test.json"])
def test_ct_query_multi(
connection_type: ConnectionType, output_file: Optional[str], tmp_path: str, capsys: pytest.CaptureFixture[str]
connection_type: ConnectionType, output_file: str | None, tmp_path: str, capsys: pytest.CaptureFixture[str]
) -> None:
"""Test the --query option for multiple queries.

Expand Down
4 changes: 1 addition & 3 deletions tests/test_setter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Test of setter commands."""

from typing import Optional

import pytest

from e3dc_cli import setter
Expand Down Expand Up @@ -125,7 +123,7 @@ def test_ct_setter_boolean(
],
)
def test_ct_setter_power_limits(
enable: Optional[bool],
enable: bool | None,
expected_enable: bool,
max_charge: int,
max_discharge: int,
Expand Down
14 changes: 7 additions & 7 deletions tests/util_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import shlex
from ast import Dict
from dataclasses import dataclass
from typing import List, Optional
from typing import List

import pytest

Expand All @@ -22,21 +22,21 @@ class CliResult:
stdout: str
stderr: str
stdout_lines: List[str]
stdout_as_json: Optional[dict]
stdout_as_json: dict | None
fileout: str
fileout_lines: List[str]
fileout_as_json: Optional[dict]
fileout_as_json: dict | None

def __init__(
self,
exit_code: int,
stdout: str,
stderr: str,
stdout_lines: List[str],
stdout_as_json: Optional[dict] = None,
stdout_as_json: dict | None = None,
fileout: str = None,
fileout_lines: List[str] = None,
fileout_as_json: Optional[dict] = None,
fileout_as_json: dict | None = None,
) -> None:
"""Construct.

Expand All @@ -60,7 +60,7 @@ def __init__(
self.fileout_as_json = fileout_as_json


def run_cli(cli_args: str, capsys: pytest.CaptureFixture, output_path: Optional[str] = None) -> CliResult:
def run_cli(cli_args: str, capsys: pytest.CaptureFixture, output_path: str | None = None) -> CliResult:
"""Run the command line util with the passed arguments.

Arguments:
Expand All @@ -87,7 +87,7 @@ def run_cli(cli_args: str, capsys: pytest.CaptureFixture, output_path: Optional[
)


def run_cli_json(cli_args: str, capsys: pytest.CaptureFixture, output_path: Optional[str] = None) -> Dict:
def run_cli_json(cli_args: str, capsys: pytest.CaptureFixture, output_path: str | None = None) -> Dict:
"""Run the command line util with the passed arguments and capture the outputs from a JSON file.

Arguments:
Expand Down