diff --git a/.devcontainer.json b/.devcontainer.json index 56b3290..a770f6f 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -1,6 +1,6 @@ { "name": "ludeeus/integration_blueprint", - "image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.11-bullseye", + "image": "mcr.microsoft.com/vscode/devcontainers/python:3.12-bullseye", "postCreateCommand": "scripts/setup", "forwardPorts": [ 8123 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 221a48d..3cf0986 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.11"] + python-version: ["3.12"] steps: - name: Check out repository uses: actions/checkout@v4.1.1 diff --git a/custom_components/schluter/climate.py b/custom_components/schluter/climate.py index aaf357a..aee7d11 100644 --- a/custom_components/schluter/climate.py +++ b/custom_components/schluter/climate.py @@ -24,7 +24,8 @@ HVACMode, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS +from homeassistant.const import ATTR_TEMPERATURE +from homeassistant.const import UnitOfTemperature from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryAuthFailed from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -57,7 +58,12 @@ class SchluterThermostat(CoordinatorEntity[DataUpdateCoordinator], ClimateEntity """Define an Schluter Thermostat Entity.""" _attr_hvac_modes = [HVACMode.HEAT, HVACMode.AUTO, HVACMode.OFF] - _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE + _attr_supported_features = ( + ClimateEntityFeature.TARGET_TEMPERATURE + | ClimateEntityFeature.TURN_ON + | ClimateEntityFeature.TURN_OFF + ) + _enable_turn_on_off_backwards_compatibility: bool = False coordinator: DataUpdateCoordinator[dict[str, dict[str, Thermostat]]] @@ -116,7 +122,7 @@ def name(self): @property def temperature_unit(self): """Schluter API always uses celsius.""" - return TEMP_CELSIUS + return UnitOfTemperature.CELSIUS @property def current_temperature(self): diff --git a/custom_components/schluter/sensor.py b/custom_components/schluter/sensor.py index 4e9799e..cdccc43 100644 --- a/custom_components/schluter/sensor.py +++ b/custom_components/schluter/sensor.py @@ -6,7 +6,7 @@ SensorEntity, SensorStateClass, ) -from homeassistant.const import ENERGY_KILO_WATT_HOUR, POWER_WATT, TEMP_CELSIUS +from homeassistant.const import UnitOfTemperature, UnitOfEnergy, UnitOfPower from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, DataUpdateCoordinator, @@ -56,7 +56,7 @@ class SchluterTargetTemperatureSensor( ): """Representation of a Sensor.""" - _attr_native_unit_of_measurement = TEMP_CELSIUS + _attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS _attr_device_class = SensorDeviceClass.TEMPERATURE _attr_state_class = SensorStateClass.MEASUREMENT @@ -94,7 +94,7 @@ def native_value(self) -> float: class SchluterTemperatureSensor(CoordinatorEntity[DataUpdateCoordinator], SensorEntity): """Representation of a Sensor.""" - _attr_native_unit_of_measurement = TEMP_CELSIUS + _attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS _attr_device_class = SensorDeviceClass.TEMPERATURE _attr_state_class = SensorStateClass.MEASUREMENT @@ -132,7 +132,7 @@ def native_value(self) -> float: class SchluterPowerSensor(CoordinatorEntity[DataUpdateCoordinator], SensorEntity): """Representation of a Sensor.""" - _attr_native_unit_of_measurement = POWER_WATT + _attr_native_unit_of_measurement = UnitOfPower.WATT _attr_device_class = SensorDeviceClass.POWER _attr_state_class = SensorStateClass.MEASUREMENT @@ -172,7 +172,7 @@ def native_value(self) -> int: class SchluterEnergySensor(CoordinatorEntity[DataUpdateCoordinator], SensorEntity): """Representation of a PowerSensor.""" - _attr_native_unit_of_measurement = ENERGY_KILO_WATT_HOUR + _attr_native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR _attr_device_class = SensorDeviceClass.ENERGY _attr_state_class = SensorStateClass.TOTAL diff --git a/hacs.json b/hacs.json index 051d1e5..44b02a8 100644 --- a/hacs.json +++ b/hacs.json @@ -1,6 +1,6 @@ { "name": "AIO Schluter DITRA-HEAT-E WIFI", - "homeassistant": "2023.7.0", + "homeassistant": "2024.5.3", "render_readme": true, "zip_release": true, "filename": "ha-schluter.zip" diff --git a/pyproject.toml b/pyproject.toml index dfcc556..7b33037 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -94,5 +94,5 @@ line-length = 88 # Allow unused variables when underscore-prefixed. dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" -# Assume Python 3.11 -target-version = "py311" +# Assume Python 3.12 +target-version = "py312" diff --git a/requirements.txt b/requirements.txt index 3d34c9f..a5dbfbb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ colorlog==6.8.2 -homeassistant==2023.8.1 +homeassistant==2024.5.3 pip>=23.0 ruff==0.2.2