thlucas1 / homeassistantcomponent_spotifyplus

Home Assistant integration for Spotify Player control, services, and soundtouchplus integration support.
MIT License
56 stars 4 forks source link

Spotify+ stopped working #43

Closed BartoszZabawa closed 1 month ago

BartoszZabawa commented 1 month ago

System Health details

System Information

version core-2024.9.2
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.4
os_name Linux
os_version 6.6.46-haos
arch aarch64
timezone Europe/Zurich
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok HACS Data | ok GitHub API Calls Remaining | 5000 Installed Version | 2.0.1 Stage | running Available Repositories | 1412 Downloaded Repositories | 2
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 13.1 -- | -- update_channel | stable supervisor_version | supervisor-2024.09.1 agent_version | 1.6.0 docker_version | 26.1.4 disk_total | 28.0 GB disk_used | 5.7 GB healthy | true supported | true host_connectivity | true supervisor_connectivity | true ntp_synchronized | true virtualization | board | green supervisor_api | ok version_api | ok installed_addons | Matter Server (6.5.1), File editor (5.8.0), Terminal & SSH (9.14.0)
Dashboards dashboards | 2 -- | -- resources | 0 views | 0 mode | storage
Recorder oldest_recorder_run | September 17, 2024 at 05:27 -- | -- current_recorder_run | September 20, 2024 at 08:18 estimated_db_size | 111.93 MiB database_engine | sqlite database_version | 3.45.3
Spotify api_endpoint_reachable | ok -- | --
SpotifyPlus error | failed to load: unknown -- | --

Checklist

Describe the issue

Spotify Plus stopped working few days ago. Previously it was working spotless. I didn't make any changes. I can't use spotify plus in the automations and it is not visible on the "Overview" dashboard in HA. "Standard" spotify addIn works fine.

Thanks for help!

Error message:

Screenshot

Reproduction steps

1. 2. 3. ...

Debug logs

2024-09-20 08:18:10.214 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration spotifyplus which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-09-20 08:18:10.217 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-09-20 08:18:33.045 WARNING (MainThread) [async_upnp_client.profiles.dlna] Only InstanceID 0 is supported
2024-09-20 08:18:33.083 WARNING (MainThread) [async_upnp_client.profiles.dlna] Only InstanceID 0 is supported
2024-09-20 08:18:43.398 WARNING (MainThread) [homeassistant.components.light] Setup of light platform hue is taking over 10 seconds.
2024-09-20 08:18:47.734 ERROR (MainThread) [custom_components.spotifyplus] unsupported operand type(s) for &: 'str' and 'tuple'
Traceback (most recent call last):
  File "/config/custom_components/spotifyplus/__init__.py", line 2470, in _update_devices
    _logsi.LogDictionary(SILevel.Verbose, "'%s': Component DataUpdateCoordinator update results" % entry.title, scDevices.ToDictionary(), prettyPrint=True)
                                                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/spotifywebapipython/models/spotifyconnectdevices.py", line 295, in ToDictionary
    'Items': [ item.ToDictionary() for item in self._Items ],
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/spotifywebapipython/models/spotifyconnectdevice.py", line 132, in ToDictionary
    'DeviceInfo': self._DeviceInfo.ToDictionary(),
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/spotifywebapipython/zeroconfapi/zeroconfgetinfo.py", line 476, in ToDictionary
    'Aliases': [ item.ToDictionary() for item in self._Aliases ],
                 ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/spotifywebapipython/zeroconfapi/zeroconfgetinfoalias.py", line 85, in ToDictionary
    'Title': self.Title,
             ^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/spotifywebapipython/zeroconfapi/zeroconfgetinfoalias.py", line 73, in Title
    return '"%s" (%s)' & (self._Name, self._Id)
           ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for &: 'str' and 'tuple'
2024-09-20 11:21:20.251 DEBUG (MainThread) [custom_components.spotifyplus] Finished fetching SpotifyPlus bartosz.zabawa Devices data in 2.134 seconds (success: False)

Diagnostics dump

No response

thlucas1 commented 1 month ago

@BartoszZabawa I think I found the problem here - there appears to be a bug in the underlying spotifywebapiPython code that gathers information for Spotify Connect devices that utilizes Alias definitions.

To confirm, did you recently define / change alias definitions in any of your Spotify Connect devices? This would probably take the form of grouping your devices via a manufacturer's app, or something similar.

UPDATE: never mind on my question. This looks like a bug that I introduced with the v1.0.93 release of the underlying spotifywebapiPython code. It only manifests itself for Spotify Connect devices that define aliases. I will have it corrected within the hour.

Thank you for bringing this to my attention.

thlucas1 commented 1 month ago

@BartoszZabawa The 1.0.57 release should fix the issue. Please let me know either way. Thanks!

FYI - just released a new version of the SpotifyPlus integration

[ 1.0.57 ] - 2024/09/20

This release fixes a bug related to Spotify Connect devices that define aliases (introduced with v1.0.93). This was causing TypeError: unsupported operand type(s) for &: 'str' and 'tuple' exceptions if a device had aliases defined.

thlucas1 commented 1 month ago

Closing this issue, assuming the issue is fixed. Please re-open if not and we will look into it further. Thanks.

BartoszZabawa commented 1 month ago

@thlucas1 I just tested it quickly and it works fine. I will run the automation again on Monday and let you know if anything is not working. Thank you for amazingly quick reaction and your work on the integration!