Skip to content

Commit

Permalink
Fix Beosound Level not reconnecting
Browse files Browse the repository at this point in the history
Bump API
Tweaks
  • Loading branch information
mj23000 committed Oct 25, 2023
1 parent b9c7b6f commit 7418832
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion custom_components/bangolufsen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Scene,
)
from mozart_api.mozart_client import MozartClient
from mozart_api.exceptions import ServiceException
from urllib3.exceptions import MaxRetryError

from homeassistant.config_entries import ConfigEntry
Expand Down Expand Up @@ -138,7 +139,7 @@ async def init_entities(hass: HomeAssistant, entry: ConfigEntry) -> bool:
_request_timeout=3,
),
).get()
except MaxRetryError:
except (MaxRetryError, ServiceException):
return False

# Get whether or not the device has a battery.
Expand Down
2 changes: 0 additions & 2 deletions custom_components/bangolufsen/const.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Constants for the Bang & Olufsen integration."""

from __future__ import annotations

from enum import Enum, StrEnum
Expand Down Expand Up @@ -331,7 +330,6 @@ class SUPPORT_ENUM(Enum):


# Misc.
NO_METADATA: Final[tuple] = (None, "", 0)
WEBSOCKET_CONNECTION_DELAY: Final[float] = 3.0

# Valid commands and their expected parameter type for beolink_command service
Expand Down
5 changes: 3 additions & 2 deletions custom_components/bangolufsen/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"name": "Bang & Olufsen",
"codeowners": ["@mj23000"],
"config_flow": true,
"dependencies": ["zeroconf"],
"documentation": "https://github.com/bang-olufsen/bangolufsen-hacs",
"iot_class": "local_push",
"issue_tracker": "https://github.com/bang-olufsen/bangolufsen-hacs/issues",
"requirements": ["mozart-api==3.2.1.150.1"],
"version": "1.5.4",
"requirements": ["mozart-api==3.2.1.150.2"],
"version": "1.5.5",
"zeroconf": ["_bangolufsen._tcp.local."]
}
3 changes: 2 additions & 1 deletion custom_components/bangolufsen/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ async def _update_source_change(self, data: Source) -> None:
async def _update_volume(self, data: VolumeState) -> None:
"""Update _volume."""
self._volume = data

self.async_write_ha_state()

@property
Expand Down Expand Up @@ -850,7 +851,7 @@ def source(self) -> str | None:
):
if (
len(self._playback_metadata.art) == 0
and self._playback_source.name == SOURCE_ENUM.bluetooth
and self._source_change.name == SOURCE_ENUM.bluetooth
):
return SOURCE_ENUM.bluetooth

Expand Down

0 comments on commit 7418832

Please sign in to comment.