Skip to content

Commit 36f4723

Browse files
authored
Component asuswrt: Improve get_bridge parameters typing in asuswrt (home-assistant#154540)
1 parent 03bc698 commit 36f4723

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

homeassistant/components/asuswrt/bridge.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ class AsusWrtBridge(ABC):
125125

126126
@staticmethod
127127
def get_bridge(
128-
hass: HomeAssistant, conf: dict[str, Any], options: dict[str, Any] | None = None
128+
hass: HomeAssistant,
129+
conf: dict[str, str | int],
130+
options: dict[str, str | bool | int] | None = None,
129131
) -> AsusWrtBridge:
130132
"""Get Bridge instance."""
131133
if conf[CONF_PROTOCOL] in (PROTOCOL_HTTPS, PROTOCOL_HTTP):

homeassistant/components/asuswrt/config_flow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,12 @@ def _show_setup_form(self, error: str | None = None) -> ConfigFlowResult:
175175
)
176176

177177
async def _async_check_connection(
178-
self, user_input: dict[str, Any]
178+
self, user_input: dict[str, str | int]
179179
) -> tuple[str, str | None]:
180180
"""Attempt to connect the AsusWrt router."""
181181

182182
api: AsusWrtBridge
183-
host: str = user_input[CONF_HOST]
183+
host = user_input[CONF_HOST]
184184
protocol = user_input[CONF_PROTOCOL]
185185
error: str | None = None
186186

homeassistant/components/asuswrt/router.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
176176

177177
self._on_close: list[Callable] = []
178178

179-
self._options: dict[str, Any] = {
179+
self._options: dict[str, str | bool | int] = {
180180
CONF_DNSMASQ: DEFAULT_DNSMASQ,
181181
CONF_INTERFACE: DEFAULT_INTERFACE,
182182
CONF_REQUIRE_IP: True,
@@ -299,12 +299,10 @@ async def update_devices(self) -> None:
299299
_LOGGER.warning("Reconnected to ASUS router %s", self.host)
300300

301301
self._connected_devices = len(wrt_devices)
302-
consider_home: int = self._options.get(
303-
CONF_CONSIDER_HOME, DEFAULT_CONSIDER_HOME.total_seconds()
304-
)
305-
track_unknown: bool = self._options.get(
306-
CONF_TRACK_UNKNOWN, DEFAULT_TRACK_UNKNOWN
302+
consider_home = int(
303+
self._options.get(CONF_CONSIDER_HOME, DEFAULT_CONSIDER_HOME.total_seconds())
307304
)
305+
track_unknown = self._options.get(CONF_TRACK_UNKNOWN, DEFAULT_TRACK_UNKNOWN)
308306

309307
for device_mac, device in self._devices.items():
310308
dev_info = wrt_devices.pop(device_mac, None)

0 commit comments

Comments
 (0)