Bluesound provider: use ip_address not address (#2102)
authorBlake <bmatheny@mobocracy.net>
Fri, 4 Apr 2025 18:32:53 +0000 (13:32 -0500)
committerGitHub <noreply@github.com>
Fri, 4 Apr 2025 18:32:53 +0000 (20:32 +0200)
`music_assistant_models.player.DeviceInfo` has an `ip_address` field, not an `address` field. I had been getting the following exceptions in the bluesound provider for a while:

```
2025-04-04 09:00:47.446 ERROR (MainThread) [music_assistant] Error doing task: Task exception was never retrieved
Traceback (most recent call last):
  File "/app/venv/lib/python3.12/site-packages/music_assistant/mass.py", line 797, in process_mdns_state_change
    await prov.on_mdns_service_state_change(name, state_change, info)
  File "/app/venv/lib/python3.12/site-packages/music_assistant/providers/bluesound/__init__.py", line 251, in on_mdns_service_state_change
    if cur_address and cur_address != mass_player.device_info.address:
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DeviceInfo' object has no attribute 'address'. Did you mean: 'ip_address'?
```

This commit addresses that exception.

music_assistant/providers/bluesound/__init__.py

index 44873a9c67919daf6f1b00e25e9cca05745c58d1..4a2dd2727ebd6e61ee6c654fa40e85bed5bbad49 100644 (file)
@@ -248,7 +248,7 @@ class BluesoundPlayerProvider(PlayerProvider):
             if mass_player := self.mass.players.get(self.player_id):
                 cur_address = get_primary_ip_address_from_zeroconf(info)
                 cur_port = get_port_from_zeroconf(info)
-                if cur_address and cur_address != mass_player.device_info.address:
+                if cur_address and cur_address != mass_player.device_info.ip_address:
                     self.logger.debug(
                         "Address updated to %s for player %s", cur_address, mass_player.display_name
                     )