Skip to content

Commit

Permalink
Cleanup update/async_update typing in Entities (#74035)
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Jun 27, 2022
1 parent 21b842c commit e8917af
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/garadget/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def stop_cover(self, **kwargs: Any) -> None:
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")
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/lutron/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def set_cover_position(self, **kwargs: Any) -> None:
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
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/soma/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def set_cover_tilt_position(self, **kwargs: Any) -> None:
)
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()

Expand Down Expand Up @@ -172,7 +172,7 @@ def set_cover_position(self, **kwargs: Any) -> None:
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()

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/zha/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ async def async_stop_cover(self, **kwargs: Any) -> None:
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()
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/zha/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ async def _async_set_fan_mode(self, fan_mode: int) -> None:
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))
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/zha/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ async def async_unlock(self, **kwargs: Any) -> None:
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()
Expand Down

0 comments on commit e8917af

Please sign in to comment.