Cleanup update/async_update typing in Entities ()

pull/72793/head^2
epenet 2022-06-28 00:48:56 +02:00 committed by GitHub
parent 21b842cf9c
commit e8917af823
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 7 deletions
homeassistant/components

View File

@ -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")

View File

@ -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

View File

@ -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()

View File

@ -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()

View File

@ -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))

View File

@ -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()