Skip to content

Commit

Permalink
Update API
Browse files Browse the repository at this point in the history
Return complete result in async_beolink_join service
Fix async_beolink_set_volume not working if device volume is 0
  • Loading branch information
mj23000 committed Jan 17, 2025
1 parent c6afdcc commit f966825
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions custom_components/bang_olufsen/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"integration_type": "device",
"iot_class": "local_push",
"issue_tracker": "https://github.com/bang-olufsen/bang_olufsen-hacs/issues",
"requirements": ["mozart-api==4.1.1.116.4"],
"version": "3.4.1",
"requirements": ["mozart-api==4.1.1.116.5"],
"version": "3.4.2",
"zeroconf": ["_bangolufsen._tcp.local.", "_zenith._tcp.local."]
}
17 changes: 12 additions & 5 deletions custom_components/bang_olufsen/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ async def async_setup_entry(
},
func="async_beolink_leader_command",
)

platform.async_register_entity_service(
name="reboot",
schema=None,
Expand Down Expand Up @@ -1172,7 +1173,14 @@ async def async_beolink_join(
jid=beolink_jid, source=source_id
)

return response.dict()
retrieved_response = await self._client.async_get_beolink_join_result(
response.request_id
)
return (
retrieved_response.dict()
if retrieved_response is not None
else response.dict()
)

async def async_beolink_expand(
self, beolink_jids: list[str] | None = None, all_discovered: bool = False
Expand Down Expand Up @@ -1321,10 +1329,9 @@ async def async_beolink_set_volume(self, volume_level: str) -> None:

async def async_set_relative_volume_level(self, volume: float) -> None:
"""Set a volume level relative to the current level."""

if not self.volume_level:
_LOGGER.warning("Error setting volume")
return
# Handle if the volume level is not set
if self.volume_level is None:
self.volume_level = 0

# Ensure that volume level behaves as expected
if self.volume_level + volume >= 1.0:
Expand Down

0 comments on commit f966825

Please sign in to comment.