Cleanup update/async_update typing in Entities (#74035)
parent
21b842cf9c
commit
e8917af823
|
@ -233,7 +233,7 @@ class GaradgetCover(CoverEntity):
|
|||
self._start_watcher("stop")
|
||||
return ret["return_value"] == 1
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Get updated status from API."""
|
||||
try:
|
||||
status = self._get_variable("doorStatus")
|
||||
|
|
|
@ -66,7 +66,7 @@ class LutronCover(LutronDevice, CoverEntity):
|
|||
position = kwargs[ATTR_POSITION]
|
||||
self._lutron_device.level = position
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Call when forcing a refresh of the device."""
|
||||
# Reading the property (rather than last_level()) fetches value
|
||||
level = self._lutron_device.level
|
||||
|
|
|
@ -102,7 +102,7 @@ class SomaTilt(SomaEntity, CoverEntity):
|
|||
)
|
||||
self.set_position(kwargs[ATTR_TILT_POSITION])
|
||||
|
||||
async def async_update(self):
|
||||
async def async_update(self) -> None:
|
||||
"""Update the entity with the latest data."""
|
||||
response = await self.get_shade_state_from_api()
|
||||
|
||||
|
@ -172,7 +172,7 @@ class SomaShade(SomaEntity, CoverEntity):
|
|||
f'Error while setting the cover position ({self.name}): {response["msg"]}'
|
||||
)
|
||||
|
||||
async def async_update(self):
|
||||
async def async_update(self) -> None:
|
||||
"""Update the cover with the latest data."""
|
||||
response = await self.get_shade_state_from_api()
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ class ZhaCover(ZhaEntity, CoverEntity):
|
|||
self._state = STATE_OPEN if self._current_position > 0 else STATE_CLOSED
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def async_update(self):
|
||||
async def async_update(self) -> None:
|
||||
"""Attempt to retrieve the open/close state of the cover."""
|
||||
await super().async_update()
|
||||
await self.async_get_state()
|
||||
|
|
|
@ -202,7 +202,7 @@ class FanGroup(BaseFan, ZhaGroupEntity):
|
|||
self.error("Could not set fan mode: %s", ex)
|
||||
self.async_set_state(0, "fan_mode", fan_mode)
|
||||
|
||||
async def async_update(self):
|
||||
async def async_update(self) -> None:
|
||||
"""Attempt to retrieve on off state from the fan."""
|
||||
all_states = [self.hass.states.get(x) for x in self._entity_ids]
|
||||
states: list[State] = list(filter(None, all_states))
|
||||
|
|
|
@ -137,7 +137,7 @@ class ZhaDoorLock(ZhaEntity, LockEntity):
|
|||
return
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def async_update(self):
|
||||
async def async_update(self) -> None:
|
||||
"""Attempt to retrieve state from the lock."""
|
||||
await super().async_update()
|
||||
await self.async_get_state()
|
||||
|
|
Loading…
Reference in New Issue