mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Fix invalid type hints in netgear switch (#145226)
* Fix invalid type hints in netgear switch * Adjust
This commit is contained in:
parent
e491629143
commit
366f592a8a
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user