diff --git a/music_assistant/providers/hass/__init__.py b/music_assistant/providers/hass/__init__.py index eb34f5ec3..c3c0a2662 100644 --- a/music_assistant/providers/hass/__init__.py +++ b/music_assistant/providers/hass/__init__.py @@ -388,14 +388,18 @@ async def _register_player_controls(self) -> None: control.power_off = partial(self._handle_player_control_power_off, entity_id) if entity_id in volume_controls: control.supports_volume = True - if entity_platform == "media_player": + if not hass_state: + control.volume_level = 0 + elif entity_platform == "media_player": control.volume_level = hass_state["attributes"].get("volume_level", 0) * 100 else: control.volume_level = try_parse_int(hass_state["state"]) or 0 control.volume_set = partial(self._handle_player_control_volume_set, entity_id) if entity_id in mute_controls: control.supports_mute = True - if entity_platform == "media_player": + if not hass_state: + control.volume_muted = False + elif entity_platform == "media_player": control.volume_muted = hass_state["attributes"].get("volume_muted") elif hass_state: control.volume_muted = hass_state["state"] not in OFF_STATES diff --git a/pyproject.toml b/pyproject.toml index 56603c76a..b041a3779 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ version = "0.0.0" test = [ "codespell==2.3.0", "isort==6.0.0", - "mypy==1.13.0", + "mypy==1.15.0", "pre-commit==4.1.0", "pre-commit-hooks==5.0.0", "pytest==8.3.4",