jjlawren / sonos_cloud

Sonos cloud API integration for Home Assistant with improved TTS/alerts handling
121 stars 5 forks source link

Error adding entities #23

Closed rasmusbe closed 2 years ago

rasmusbe commented 2 years ago

Getting this on boot

Logger: homeassistant.components.media_player
Source: custom_components/sonos_cloud/media_player.py:58 
Integration: Media Player (documentation, issues) 
First occurred: 00:56:21 (2 occurrences) 
Last logged: 00:56:21

Error adding entities for domain media_player with platform sonos_cloud
Error while setting up sonos_cloud platform for media_player
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 614, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 781, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/config/custom_components/sonos_cloud/media_player.py", line 58, in async_added_to_hass
    if volume := last_state.attributes.get("volume_level"):
AttributeError: 'NoneType' object has no attribute 'attributes'
jjlawren commented 2 years ago

Thanks for reporting. Fixed in 0.1.2.