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

FIX deprecated errors #21

Open
wants to merge 2 commits 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
7 changes: 3 additions & 4 deletions custom_components/speedport/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import HomeAssistantType
from speedport import Speedport

from .const import DOMAIN
Expand All @@ -29,7 +28,7 @@ async def async_setup_entry(
class SpeedportReconnectButton(ButtonEntity, SpeedportEntity):
_attr_device_class = ButtonDeviceClass.RESTART

def __init__(self, hass: HomeAssistantType, speedport: Speedport) -> None:
def __init__(self, hass: HomeAssistant, speedport: Speedport) -> None:
"""Initialize the button entity."""
super().__init__(hass, speedport)
self._attr_name = "Reconnect"
Expand All @@ -44,7 +43,7 @@ async def async_press(self) -> None:
class SpeedportRebootButton(ButtonEntity, SpeedportEntity):
_attr_device_class = ButtonDeviceClass.RESTART

def __init__(self, hass: HomeAssistantType, speedport: Speedport) -> None:
def __init__(self, hass: HomeAssistant, speedport: Speedport) -> None:
"""Initialize the button entity."""
super().__init__(hass, speedport)
self._attr_name = "Reboot"
Expand All @@ -59,7 +58,7 @@ async def async_press(self) -> None:
class SpeedportWPSButton(ButtonEntity, SpeedportEntity):
_attr_device_class = ButtonDeviceClass.IDENTIFY

def __init__(self, hass: HomeAssistantType, speedport: Speedport) -> None:
def __init__(self, hass: HomeAssistant, speedport: Speedport) -> None:
"""Initialize the button entity."""
super().__init__(hass, speedport)
self._attr_name = "WPS on"
Expand Down
10 changes: 4 additions & 6 deletions custom_components/speedport/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from datetime import timedelta

from homeassistant.core import callback
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.helpers.update_coordinator import (
DataUpdateCoordinator,
CoordinatorEntity,
Expand All @@ -17,7 +17,7 @@


class SpeedportCoordinator(DataUpdateCoordinator[None]):
def __init__(self, hass: HomeAssistantType, device: Speedport):
def __init__(self, hass: HomeAssistant, device: Speedport):
"""Initialize my coordinator."""

super().__init__(
Expand All @@ -38,7 +38,7 @@ class SpeedportEntity(CoordinatorEntity[SpeedportCoordinator]):
_attr_has_entity_name = True

def __init__(
self, hass: HomeAssistantType, speedport: Speedport, description=None
self, hass: HomeAssistant, speedport: Speedport, description=None
) -> None:
coordinator = get_coordinator(hass, speedport)
super().__init__(coordinator)
Expand All @@ -65,9 +65,7 @@ def _handle_coordinator_update(self) -> None:
self.async_write_ha_state()


def get_coordinator(
hass: HomeAssistantType, speedport: Speedport
) -> SpeedportCoordinator:
def get_coordinator(hass: HomeAssistant, speedport: Speedport) -> SpeedportCoordinator:
coordinators = hass.data[DOMAIN]["coordinators"]
if speedport.serial_number in coordinators:
coordinator: SpeedportCoordinator = hass.data[DOMAIN]["coordinators"][
Expand Down
7 changes: 3 additions & 4 deletions custom_components/speedport/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import HomeAssistantType
from speedport import Speedport

from .const import DOMAIN
Expand All @@ -34,7 +33,7 @@ async def async_setup_entry(
class SpeedportWifiSwitch(SwitchEntity, SpeedportEntity):
_attr_is_on: bool | None = False

def __init__(self, hass: HomeAssistantType, speedport: Speedport) -> None:
def __init__(self, hass: HomeAssistant, speedport: Speedport) -> None:
super().__init__(hass, speedport)
self._speedport: Speedport = speedport
self._attr_icon = "mdi:wifi"
Expand All @@ -57,7 +56,7 @@ async def async_turn_off(self, **kwargs: Any) -> None:
class SpeedportGuestWifiSwitch(SwitchEntity, SpeedportEntity):
_attr_is_on: bool | None = False

def __init__(self, hass: HomeAssistantType, speedport: Speedport) -> None:
def __init__(self, hass: HomeAssistant, speedport: Speedport) -> None:
super().__init__(hass, speedport)
self._speedport: Speedport = speedport
self._attr_icon = "mdi:wifi"
Expand All @@ -80,7 +79,7 @@ async def async_turn_off(self, **kwargs: Any) -> None:
class SpeedportOfficeWifiSwitch(SwitchEntity, SpeedportEntity):
_attr_is_on: bool | None = False

def __init__(self, hass: HomeAssistantType, speedport: Speedport) -> None:
def __init__(self, hass: HomeAssistant, speedport: Speedport) -> None:
super().__init__(hass, speedport)
self._speedport: Speedport = speedport
self._attr_icon = "mdi:wifi"
Expand Down