From: Marcel van der Veldt Date: Fri, 25 Apr 2025 23:04:14 +0000 (+0200) Subject: Fix: handle missing sample_bytes in esphome config X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=60060be8a1ae76df9e5b7c6d0cf692762df4d4a1;p=music-assistant-server.git Fix: handle missing sample_bytes in esphome config --- diff --git a/music_assistant/providers/hass_players/__init__.py b/music_assistant/providers/hass_players/__init__.py index 60b307bb..bbdcb4fa 100644 --- a/music_assistant/providers/hass_players/__init__.py +++ b/music_assistant/providers/hass_players/__init__.py @@ -223,10 +223,10 @@ class HomeAssistantPlayers(PlayerProvider): codec = supported_format["format"] if supported_format["sample_rate"] not in supported_sample_rates: supported_sample_rates.append(supported_format["sample_rate"]) - bit_depth = supported_format["sample_bytes"] * 8 + bit_depth = (supported_format["sample_bytes"] or 2) * 8 if bit_depth not in supported_bit_depths: supported_bit_depths.append(bit_depth) - if not supported_sample_rates: + if not supported_sample_rates or not supported_bit_depths: # esphome device with no media pipeline configured # simply use the default config of the media pipeline supported_sample_rates = [48000]