diff --git a/CHANGELOG.md b/CHANGELOG.md index 566d0fc8e..687496b2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## v0.31.8: Improve typing as per Core PR #96915 + ## v0.31.7: Various small updates - Repair coverage/fix testing - #294 diff --git a/package.json b/package.json index 2a3ef850e..830142af6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "package.json": "^2.0.1", - "prettier": "^3.0.0-alpha.9-for-vscode" + "package.json": "^0.0.0", + "prettier": "^3.0.0" } } diff --git a/plugwise/constants.py b/plugwise/constants.py index 4afdecc40..c2a0ab2fa 100644 --- a/plugwise/constants.py +++ b/plugwise/constants.py @@ -5,7 +5,7 @@ from dataclasses import dataclass import datetime as dt import logging -from typing import Final, TypedDict +from typing import Final, Literal, TypedDict, get_args LOGGER = logging.getLogger(__name__) @@ -246,7 +246,7 @@ # All available Binary Sensor, Sensor, and Switch Types -BINARY_SENSORS: Final[tuple[str, ...]] = ( +BinarySensorType = Literal[ "cooling_enabled", "compressor_state", "cooling_state", @@ -255,9 +255,10 @@ "heating_state", "plugwise_notification", "slave_boiler_state", -) +] +BINARY_SENSORS: Final[tuple[str, ...]] = get_args(BinarySensorType) -SENSORS: Final[tuple[str, ...]] = ( +SensorType = Literal[ "battery", "cooling_activation_outdoor_temperature", "cooling_deactivation_threshold", @@ -309,14 +310,16 @@ "voltage_phase_three", "water_pressure", "water_temperature", -) +] +SENSORS: Final[tuple[str, ...]] = get_args(SensorType) -SWITCHES: Final[tuple[str, ...]] = ( +SwitchType = Literal[ "cooling_ena_switch", "dhw_cm_switch", "lock", "relay", -) +] +SWITCHES: Final[tuple[str, ...]] = get_args(SwitchType) class ApplianceData(TypedDict, total=False): diff --git a/pyproject.toml b/pyproject.toml index cba901aba..7f431ec5e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise" -version = "0.31.7" +version = "0.31.8" license = {file = "LICENSE"} description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3." readme = "README.md"