From 366f592a8ae0170a9c91280b38eb491fd349c174 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 19 May 2025 17:52:23 +0200 Subject: [PATCH] Fix invalid type hints in netgear switch (#145226) * Fix invalid type hints in netgear switch * Adjust --- homeassistant/components/netgear/switch.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/netgear/switch.py b/homeassistant/components/netgear/switch.py index dd8468df099..712475b9b34 100644 --- a/homeassistant/components/netgear/switch.py +++ b/homeassistant/components/netgear/switch.py @@ -41,8 +41,8 @@ class NetgearSwitchEntityDescriptionRequired: class NetgearSwitchEntityDescription(SwitchEntityDescription): """Class describing Netgear Switch entities.""" - update: Callable[[NetgearRouter], bool] - action: Callable[[NetgearRouter], bool] + update: Callable[[NetgearRouter], Callable[[], bool | None]] + action: Callable[[NetgearRouter], Callable[[bool], bool]] ROUTER_SWITCH_TYPES = [ @@ -200,12 +200,12 @@ class NetgearRouterSwitchEntity(NetgearRouterEntity, SwitchEntity): self._attr_is_on = None self._attr_available = False - async def async_added_to_hass(self): + async def async_added_to_hass(self) -> None: """Fetch state when entity is added.""" await self.async_update() await super().async_added_to_hass() - async def async_update(self): + async def async_update(self) -> None: """Poll the state of the switch.""" async with self._router.api_lock: response = await self.hass.async_add_executor_job( @@ -217,14 +217,14 @@ class NetgearRouterSwitchEntity(NetgearRouterEntity, SwitchEntity): self._attr_is_on = response self._attr_available = True - async def async_turn_on(self, **kwargs): + async def async_turn_on(self, **kwargs: Any) -> None: """Turn the switch on.""" async with self._router.api_lock: await self.hass.async_add_executor_job( self.entity_description.action(self._router), True ) - async def async_turn_off(self, **kwargs): + async def async_turn_off(self, **kwargs: Any) -> None: """Turn the switch off.""" async with self._router.api_lock: await self.hass.async_add_executor_job(