Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing deprecation warnings for 2025.1 #74

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 .devcontainer.json
Original file line number Diff line number Diff line change
@@ -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",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2024.5.3 was complaining it needed python 3.12

"postCreateCommand": "scripts/setup",
"forwardPorts": [
8123
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know if this is required

steps:
- name: Check out repository
uses: actions/[email protected]
Expand Down
12 changes: 9 additions & 3 deletions custom_components/schluter/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]]]

Expand Down Expand Up @@ -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):
Expand Down
10 changes: 5 additions & 5 deletions custom_components/schluter/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Comment on lines +97 to +98
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know if this is required

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
colorlog==6.8.2
homeassistant==2023.8.1
homeassistant==2024.5.3
pip>=23.0
ruff==0.2.2

Expand Down