Skip to content

Commit

Permalink
fix: config_entry explicitly deprecated warnings #431
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Jan 3, 2025
1 parent e0b7d6b commit beb3bce
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions custom_components/localtuya/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
SelectOptionDict,
)
import voluptuous as vol
from homeassistant import config_entries, core, exceptions
from homeassistant import exceptions
from homeassistant.const import (
CONF_CLIENT_ID,
CONF_CLIENT_SECRET,
Expand All @@ -39,7 +39,8 @@
CONF_USERNAME,
EntityCategory,
)
from homeassistant.core import callback
from homeassistant.core import callback, HomeAssistant
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow

from .coordinator import pytuya, TuyaCloudApi
from .core.cloud_api import TUYA_ENDPOINTS
Expand Down Expand Up @@ -166,11 +167,10 @@ def col_to_select(
CUSTOM_DEVICE = {"Add Device Manually": "..."}


class LocaltuyaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
class LocaltuyaConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for LocalTuya integration."""

VERSION = ENTRIES_VERSION
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL

@staticmethod
@callback
Expand Down Expand Up @@ -235,12 +235,11 @@ async def async_step_import(self, user_input):
)


class LocalTuyaOptionsFlowHandler(config_entries.OptionsFlow):
class LocalTuyaOptionsFlowHandler(OptionsFlow):
"""Handle options flow for LocalTuya integration."""

def __init__(self, config_entry: config_entries.ConfigEntry):
def __init__(self, config_entry: ConfigEntry):
"""Initialize localtuya options flow."""
self.config_entry = config_entry
self._entry_id = config_entry.entry_id

self.selected_device = None
Expand Down Expand Up @@ -875,7 +874,7 @@ class EmptyDpsList(exceptions.HomeAssistantError):


async def setup_localtuya_devices(
hass: config_entries.HomeAssistant,
hass: HomeAssistant,
entry_id: str,
discovered_devices: dict,
devices_cloud_data: dict,
Expand Down Expand Up @@ -1144,7 +1143,7 @@ def merge_dps_manual_strings(manual_dps: list, dps_strings: list):


async def platform_schema(
hass: core.HomeAssistant, platform, dps_strings, allow_id=True, yaml=False
hass: HomeAssistant, platform, dps_strings, allow_id=True, yaml=False
):
"""Generate input validation schema for a platform."""
# decide default value of device by platform.
Expand Down Expand Up @@ -1184,7 +1183,7 @@ def flow_schema(platform, dps_strings):
return import_module("." + platform, integration_module).flow_schema(dps_strings)


async def validate_input(hass: core.HomeAssistant, entry_id, data):
async def validate_input(hass: HomeAssistant, entry_id, data):
"""Validate the user input allows us to connect."""
logger = pytuya.ContextualLogger()
logger.set_logger(_LOGGER, data[CONF_DEVICE_ID], True, data[CONF_FRIENDLY_NAME])
Expand Down

0 comments on commit beb3bce

Please sign in to comment.