Skip to content

Commit

Permalink
chore: update deprecated HA APIs
Browse files Browse the repository at this point in the history
Fixes #177
  • Loading branch information
kodebach committed Jan 6, 2025
1 parent 1ee6b9f commit caac038
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 9 additions & 5 deletions custom_components/idm_heatpump/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Adds config flow for Blueprint."""

from copy import deepcopy
from datetime import timedelta
from typing import Any
from typing import Any, Self

import voluptuous as vol
from homeassistant.config import cv
Expand Down Expand Up @@ -116,7 +117,7 @@ async def async_step_zones(self, user_input=None):
@callback
def async_get_options_flow(config_entry: ConfigEntry):
"""Return options flow."""
return IdmHeatpumpOptionsFlowHandler(config_entry)
return IdmHeatpumpOptionsFlowHandler()

async def _test_hostname(self, hostname):
"""Return true if hostname is valid."""
Expand All @@ -126,14 +127,17 @@ async def _test_hostname(self, hostname):
pass
return False

def is_matching(self, other_flow: Self) -> bool:
"""Return True if other_flow is matching this flow."""
return self._data[CONF_HOSTNAME] == other_flow._data[CONF_HOSTNAME]


class IdmHeatpumpOptionsFlowHandler(OptionsFlow):
"""IDM heat pump config flow options handler."""

def __init__(self, config_entry: ConfigEntry):
def __init__(self):
"""Initialize HACS options flow."""
self.config_entry = config_entry
self.options = dict(config_entry.options)
self.options = deepcopy(dict(self.config_entry.options))

async def async_step_init(self, user_input=None):
"""Manage the options."""
Expand Down
4 changes: 3 additions & 1 deletion custom_components/idm_heatpump/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class IdmHeatpumpEntity(CoordinatorEntity, Generic[_T]):
coordinator: IdmHeatpumpDataUpdateCoordinator

def __init__(
self, coordinator: IdmHeatpumpDataUpdateCoordinator, config_entry: ConfigEntry
self,
coordinator: IdmHeatpumpDataUpdateCoordinator,
config_entry: ConfigEntry,
):
"""Create entity."""
super().__init__(coordinator)
Expand Down

0 comments on commit caac038

Please sign in to comment.