From e6e69bac74eaaad650f478d9b7e4c19ae79ba78e Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Sun, 27 Oct 2024 10:38:50 -0700 Subject: [PATCH] Restore support for Python 3.9 Fixes: #16 --- README.md | 3 ++- plugin.py | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5c0061d..7d301e8 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,8 @@ Currently supported: - Before installing, you need to have `python3` installed, with a working `venv` module. - - On Debian/Ubuntu/Raspbian, this means installing the `python3-venv` package. + - On Debian/Ubuntu/Raspberry Pi OS, this means installing the `python3-venv` package. + - Supported Python 3 versions: >= 3.9 - Install this plugin through SignalK / npm. - Use the native Victron app to obtain advertisement keys for communicating with your Victron devices. diff --git a/plugin.py b/plugin.py index 5ae4784..1e3e51c 100644 --- a/plugin.py +++ b/plugin.py @@ -5,7 +5,7 @@ import json import logging import sys -from typing import Any, Callable, TypeAlias +from typing import Any, Callable, Union from bleak.backends.device import BLEDevice from victron_ble.devices import ( @@ -26,8 +26,9 @@ logger = logging.getLogger("signalk-victron-ble") -SignalKDelta: TypeAlias = dict[str, list[dict[str, Any]]] -SignalKDeltaValues: TypeAlias = list[dict[str, int | float | str | None]] +# 3.9 compatible TypeAliases +SignalKDelta = dict[str, list[dict[str, Any]]] +SignalKDeltaValues = list[dict[str, Union[int, float, str, None]]] @dataclasses.dataclass @@ -35,7 +36,7 @@ class ConfiguredDevice: id: str mac: str advertisement_key: str - secondary_battery: str | None + secondary_battery: Union[str, None] class SignalKScanner(Scanner):