Skip to content

Commit

Permalink
Update to pyblu 0.5.2 for typing support
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisChrist committed Aug 13, 2024
1 parent cacf016 commit 924c61a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
4 changes: 3 additions & 1 deletion homeassistant/components/bluesound/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ async def async_step_zeroconf(
)
return await self.async_step_confirm()

async def async_step_confirm(self, user_input: dict[str, Any] | None=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
2 changes: 1 addition & 1 deletion homeassistant/components/bluesound/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/bluesound",
"iot_class": "local_polling",
"requirements": ["pyblu==0.4.0"],
"requirements": ["pyblu==0.5.2"],
"zeroconf": [
{
"type": "_musc._tcp.local."
Expand Down
13 changes: 7 additions & 6 deletions homeassistant/components/bluesound/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def __init__(
self._muted = False
self._master: BluesoundPlayer | None = None
self._is_master = False
self._group_name = None
self._group_name: str | None = None

Check warning on line 250 in homeassistant/components/bluesound/media_player.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/bluesound/media_player.py#L250

Added line #L250 was not covered by tests
self._group_list: list[str] = []
self._bluesound_device_name = sync_status.name
self._player = player
Expand Down Expand Up @@ -495,9 +495,7 @@ def media_position(self) -> int | None:
if self._last_status_update is None or mediastate == MediaPlayerState.IDLE:
return None

position = self._status.seconds
if position is None:
return None
position = float(self._status.seconds)

Check warning on line 498 in homeassistant/components/bluesound/media_player.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/bluesound/media_player.py#L498

Added line #L498 was not covered by tests

if mediastate == MediaPlayerState.PLAYING:
position += (dt_util.utcnow() - self._last_status_update).total_seconds()
Expand All @@ -514,7 +512,7 @@ def media_duration(self) -> int | None:
if duration is None:
return None

return duration
return int(duration)

Check warning on line 515 in homeassistant/components/bluesound/media_player.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/bluesound/media_player.py#L515

Added line #L515 was not covered by tests

@property
def media_position_updated_at(self) -> datetime | None:
Expand Down Expand Up @@ -650,7 +648,7 @@ def shuffle(self) -> bool:

return shuffle

async def async_join(self, master) -> None:
async def async_join(self, master: str) -> None:
"""Join the player to a group."""
master_device = [
device
Expand Down Expand Up @@ -745,6 +743,9 @@ async def async_select_source(self, source: str) -> None:
if preset.name == source:
url = preset.url

if url is None:
raise ServiceValidationError(f"Source {source} not found")

Check warning on line 747 in homeassistant/components/bluesound/media_player.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/bluesound/media_player.py#L746-L747

Added lines #L746 - L747 were not covered by tests

await self._player.play_url(url)

async def async_clear_playlist(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1747,7 +1747,7 @@ pybbox==0.0.5-alpha
pyblackbird==0.6

# homeassistant.components.bluesound
pyblu==0.4.0
pyblu==0.5.2

# homeassistant.components.neato
pybotvac==0.0.25
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,7 @@ pybalboa==1.0.2
pyblackbird==0.6

# homeassistant.components.bluesound
pyblu==0.4.0
pyblu==0.5.2

# homeassistant.components.neato
pybotvac==0.0.25
Expand Down

0 comments on commit 924c61a

Please sign in to comment.