Hello,
I am working with the spotcast integration. I have it working great with the primary account, but I am so far unable to get it to work with other configured accounts.
I have the accounts defined in the configuration.yaml and the proper creds in the secrets.yaml. I also have all of the accounts added to the official Spotify integration.
Starting playback for the primary account works great, but I get the following error on all 4 of the additional accounts I have defined.
AttributeError: ‘NoneType’ object has no attribute ‘get’
There are actually two logs that get generated when I execute this, they seem very similar, but since it does log twice, I thought I would include them both here.
Here is the first log:
Logger: homeassistant.components.automation.name_current_bedroom
Source: components/automation/__init__.py:743
integration: Automation (documentation, issues)
First occurred: 5:08:20 PM (2 occurrences)
Last logged: 5:58:04 PM
While executing automation automation.name_current_bedroom
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/homeassistant/components/automation/__init__.py", line 743, in async_trigger
return await self.action_script.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 1801, in async_run
return await asyncio.shield(create_eager_task(run.async_run()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 464, in async_run
await self._async_step(log_exceptions=False)
File "/usr/local/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 528, in _async_step
self._handle_exception(
File "/usr/local/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 558, in _handle_exception
raise exception
File "/usr/local/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 526, in _async_step
await getattr(self, handler)()
File "/usr/local/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 764, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 727, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/homeassistant/core.py", line 2802, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/homeassistant/core.py", line 2852, in _execute_service
return await self._hass.async_add_executor_job(target, service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/__init__.py", line 378, in start_casting
raise exc
File "/config/custom_components/spotcast/__init__.py", line 243, in start_casting
client = spotcast_controller.get_spotify_client(account)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/spotcast_controller.py", line 270, in get_spotify_client
return spotipy.Spotify(auth=self.get_token_instance(account).access_token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/spotcast_controller.py", line 260, in get_token_instance
dc = self.accounts.get(account).get(CONF_SP_DC)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
Here is the second:
Logger: homeassistant.components.automation.name_current_bedroom
Source: helpers/script.py:526
integration: Automation (documentation, issues)
First occurred: 5:08:20 PM (2 occurrences)
Last logged: 5:58:04 PM
name - Current - Bedroom: Error executing script. Unexpected error for call_service at pos 3: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 526, in _async_step
await getattr(self, handler)()
File "/usr/local/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 764, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 727, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/homeassistant/core.py", line 2802, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/homeassistant/core.py", line 2852, in _execute_service
return await self._hass.async_add_executor_job(target, service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/__init__.py", line 378, in start_casting
raise exc
File "/config/custom_components/spotcast/__init__.py", line 243, in start_casting
client = spotcast_controller.get_spotify_client(account)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/spotcast_controller.py", line 270, in get_spotify_client
return spotipy.Spotify(auth=self.get_token_instance(account).access_token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/spotcast_controller.py", line 260, in get_token_instance
dc = self.accounts.get(account).get(CONF_SP_DC)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'