Skip to content

Commit

Permalink
Fix and remove deprecated typing
Browse files Browse the repository at this point in the history
  • Loading branch information
ollo69 committed May 4, 2024
1 parent ef1f63e commit d3c6011
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
8 changes: 7 additions & 1 deletion custom_components/melcloud_custom/binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Support for MelCloud device binary sensors."""

from __future__ import annotations

from dataclasses import dataclass
Expand All @@ -12,6 +13,9 @@
BinarySensorEntity,
BinarySensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity

from . import MelCloudDevice
Expand Down Expand Up @@ -46,7 +50,9 @@ class MelcloudBinarySensorEntityDescription(
_LOGGER = logging.getLogger(__name__)


async def async_setup_entry(hass, entry, async_add_entities):
async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
):
"""Set up MELCloud device binary sensors based on config_entry."""
entry_config = hass.data[DOMAIN][entry.entry_id]

Expand Down
5 changes: 3 additions & 2 deletions custom_components/melcloud_custom/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity

from . import MelCloudDevice
Expand Down Expand Up @@ -94,7 +95,7 @@


async def async_setup_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
):
"""Set up MelCloud device climate based on config_entry."""
mel_devices = hass.data[DOMAIN][entry.entry_id].get(MEL_DEVICES)
Expand Down
7 changes: 6 additions & 1 deletion custom_components/melcloud_custom/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
UnitOfEnergy,
UnitOfTemperature,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity

from . import MelCloudDevice
Expand Down Expand Up @@ -138,7 +141,9 @@ class MelcloudSensorEntityDescription(
_LOGGER = logging.getLogger(__name__)


async def async_setup_entry(hass, entry, async_add_entities):
async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
):
"""Set up MELCloud device sensors based on config_entry."""
entry_config = hass.data[DOMAIN][entry.entry_id]

Expand Down
6 changes: 4 additions & 2 deletions custom_components/melcloud_custom/water_heater.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Platform for water_heater integration."""

from __future__ import annotations

from typing import Any
Expand Down Expand Up @@ -45,6 +46,7 @@ class AtwWaterHeater(CoordinatorEntity, WaterHeaterEntity):

_attr_supported_features = (
WaterHeaterEntityFeature.TARGET_TEMPERATURE
| WaterHeaterEntityFeature.ON_OFF
| WaterHeaterEntityFeature.OPERATION_MODE
)
_attr_temperature_unit = UnitOfTemperature.CELSIUS
Expand All @@ -59,11 +61,11 @@ def __init__(self, api: MelCloudDevice, device: AtwDevice) -> None:
self._attr_unique_id = f"{device.serial}-WH"
self._attr_device_info = api.device_info

async def async_turn_on(self) -> None:
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the entity on."""
await self._api.async_set({PROPERTY_POWER: True})

async def async_turn_off(self) -> None:
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the entity off."""
await self._api.async_set({PROPERTY_POWER: False})

Expand Down

0 comments on commit d3c6011

Please sign in to comment.