Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisChrist committed Aug 13, 2024
1 parent 589c1c6 commit cacf016
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/bluesound/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async def async_step_zeroconf(
)
return await self.async_step_confirm()

async def async_step_confirm(self, user_input=None) -> ConfigFlowResult:
async def async_step_confirm(self, user_input: dict[str, Any] | None=None) -> ConfigFlowResult:
"""Confirm the zeroconf setup."""
assert self._sync_status is not None
assert self._host is not None
Expand Down
28 changes: 10 additions & 18 deletions homeassistant/components/bluesound/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def __init__(
self.port = port
self._polling_task: Task[None] | None = None # The actual polling task.
self._id = sync_status.id
self._last_status_update = None
self._last_status_update: datetime | None = None
self._sync_status = sync_status
self._status: Status | None = None
self._inputs: list[Input] = []
Expand Down Expand Up @@ -273,14 +273,6 @@ def __init__(
via_device=(DOMAIN, format_mac(sync_status.mac)),
)

@staticmethod
def _try_get_index(string, search_string):
"""Get the index."""
try:
return string.index(search_string)
except ValueError:
return -1

async def force_update_sync_status(self) -> bool:
"""Update the internal status."""
sync_status = await self._player.sync_status()
Expand Down Expand Up @@ -309,7 +301,7 @@ async def force_update_sync_status(self) -> bool:

return True

async def _start_poll_command(self):
async def _start_poll_command(self) -> None:
"""Loop which polls the status of the player."""
while True:
try:
Expand Down Expand Up @@ -359,7 +351,7 @@ async def async_update(self) -> None:
await self.async_update_presets()
await self.async_update_captures()

async def async_update_status(self):
async def async_update_status(self) -> None:
"""Use the poll session to always get the status of the player."""
etag = None
if self._status is not None:
Expand Down Expand Up @@ -407,15 +399,15 @@ async def async_update_status(self):
)
raise

async def async_trigger_sync_on_all(self):
async def async_trigger_sync_on_all(self) -> None:
"""Trigger sync status update on all devices."""
_LOGGER.debug("Trigger sync status on all devices")

for player in self.hass.data[DATA_BLUESOUND]:
await player.force_update_sync_status()

@Throttle(SYNC_STATUS_INTERVAL)
async def async_update_sync_status(self):
async def async_update_sync_status(self) -> None:
"""Update sync status."""
await self.force_update_sync_status()

Expand Down Expand Up @@ -658,7 +650,7 @@ def shuffle(self) -> bool:

return shuffle

async def async_join(self, master):
async def async_join(self, master) -> None:
"""Join the player to a group."""
master_device = [
device
Expand Down Expand Up @@ -709,27 +701,27 @@ def rebuild_bluesound_group(self) -> list[str]:
if entity.bluesound_device_name in device_group
]

async def async_unjoin(self):
async def async_unjoin(self) -> None:
"""Unjoin the player from a group."""
if self._master is None:
return

_LOGGER.debug("Trying to unjoin player: %s", self.id)
await self._master.async_remove_slave(self)

async def async_add_slave(self, slave_device: BluesoundPlayer):
async def async_add_slave(self, slave_device: BluesoundPlayer) -> None:
"""Add slave to master."""
await self._player.add_slave(slave_device.host, slave_device.port)

async def async_remove_slave(self, slave_device: BluesoundPlayer):
async def async_remove_slave(self, slave_device: BluesoundPlayer) -> None:
"""Remove slave to master."""
await self._player.remove_slave(slave_device.host, slave_device.port)

async def async_increase_timer(self) -> int:
"""Increase sleep time on player."""
return await self._player.sleep_timer()

async def async_clear_timer(self):
async def async_clear_timer(self) -> None:
"""Clear sleep timer on player."""
sleep = 1
while sleep > 0:
Expand Down

0 comments on commit cacf016

Please sign in to comment.