From 60060be8a1ae76df9e5b7c6d0cf692762df4d4a1 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Sat, 26 Apr 2025 01:04:14 +0200 Subject: [PATCH] Fix: handle missing sample_bytes in esphome config --- music_assistant/providers/hass_players/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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] -- 2.34.1