mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Use typed ConfigEntry in SamsungTV (#143627)
This commit is contained in:
parent
347c1a2141
commit
5cd4a0ced6
@ -10,7 +10,6 @@ from urllib.parse import urlparse
|
|||||||
import getmac
|
import getmac
|
||||||
|
|
||||||
from homeassistant.components import ssdp
|
from homeassistant.components import ssdp
|
||||||
from homeassistant.config_entries import ConfigEntry
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_MAC,
|
CONF_MAC,
|
||||||
@ -66,7 +65,7 @@ def _async_get_device_bridge(
|
|||||||
class DebouncedEntryReloader:
|
class DebouncedEntryReloader:
|
||||||
"""Reload only after the timer expires."""
|
"""Reload only after the timer expires."""
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
|
def __init__(self, hass: HomeAssistant, entry: SamsungTVConfigEntry) -> None:
|
||||||
"""Init the debounced entry reloader."""
|
"""Init the debounced entry reloader."""
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
self.entry = entry
|
self.entry = entry
|
||||||
@ -79,7 +78,9 @@ class DebouncedEntryReloader:
|
|||||||
function=self._async_reload_entry,
|
function=self._async_reload_entry,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_call(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
|
async def async_call(
|
||||||
|
self, hass: HomeAssistant, entry: SamsungTVConfigEntry
|
||||||
|
) -> None:
|
||||||
"""Start the countdown for a reload."""
|
"""Start the countdown for a reload."""
|
||||||
if (new_token := entry.data.get(CONF_TOKEN)) != self.token:
|
if (new_token := entry.data.get(CONF_TOKEN)) != self.token:
|
||||||
LOGGER.debug("Skipping reload as its a token update")
|
LOGGER.debug("Skipping reload as its a token update")
|
||||||
@ -99,7 +100,9 @@ class DebouncedEntryReloader:
|
|||||||
await self.hass.config_entries.async_reload(self.entry.entry_id)
|
await self.hass.config_entries.async_reload(self.entry.entry_id)
|
||||||
|
|
||||||
|
|
||||||
async def _async_update_ssdp_locations(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
async def _async_update_ssdp_locations(
|
||||||
|
hass: HomeAssistant, entry: SamsungTVConfigEntry
|
||||||
|
) -> None:
|
||||||
"""Update ssdp locations from discovery cache."""
|
"""Update ssdp locations from discovery cache."""
|
||||||
updates = {}
|
updates = {}
|
||||||
for ssdp_st, key in (
|
for ssdp_st, key in (
|
||||||
@ -171,7 +174,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: SamsungTVConfigEntry) ->
|
|||||||
|
|
||||||
|
|
||||||
async def _async_create_bridge_with_updated_data(
|
async def _async_create_bridge_with_updated_data(
|
||||||
hass: HomeAssistant, entry: ConfigEntry
|
hass: HomeAssistant, entry: SamsungTVConfigEntry
|
||||||
) -> SamsungTVBridge:
|
) -> SamsungTVBridge:
|
||||||
"""Create a bridge object and update any missing data in the config entry."""
|
"""Create a bridge object and update any missing data in the config entry."""
|
||||||
updated_data: dict[str, str | int] = {}
|
updated_data: dict[str, str | int] = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user