Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AppleDevice.play_sound() : AttributeError on 'with_family' #240

Merged
merged 1 commit into from
Mar 17, 2020

Conversation

bobcarroll
Copy link
Contributor

@bobcarroll bobcarroll commented Mar 15, 2020

Currently api.iphone.play_sound() raises an attribute error. This PR sets a default value when the device isn't being created from a response dictionary.

Traceback :

Traceback (most recent call last):
  File "/Users/pollet/dev/home-assistant/core/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
    connection.context(msg),
  File "/Users/pollet/dev/home-assistant/core/homeassistant/core.py", line 1223, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/Users/pollet/dev/home-assistant/core/homeassistant/core.py", line 1250, in _execute_service
    await self._hass.async_add_executor_job(handler.func, service_call)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/pollet/dev/home-assistant/core/homeassistant/components/icloud/__init__.py", line 151, in play_sound
    device.play_sound()
  File "/Users/pollet/dev/home-assistant/core/homeassistant/components/icloud/account.py", line 408, in play_sound
    self.device.play_sound()
  File "/Users/pollet/.homeassistant/deps/lib/python/site-packages/pyicloud/services/findmyiphone.py", line 138, in play_sound
    'fmly': self.with_family
  File "/Users/pollet/.homeassistant/deps/lib/python/site-packages/pyicloud/services/findmyiphone.py", line 204, in __getattr__
    return getattr(self.content, attr)
AttributeError: 'dict' object has no attribute 'with_family'

Copy link
Collaborator

@Quentame Quentame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put directly True to clientContext.fmly

I thought I removed that, thanks for fixing.

@bobcarroll
Copy link
Contributor Author

@Quentame fixed

@Quentame Quentame changed the title add 'with_family' class member on instantiation Fix AppleDevice.play_sound() : AttributeError on 'with_family' Mar 17, 2020
Copy link
Collaborator

@Quentame Quentame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working fine 🎉

@Quentame Quentame merged commit 1eb8ca2 into picklepete:master Mar 17, 2020
@Quentame Quentame added this to In progress in Dev via automation Mar 17, 2020
@Quentame Quentame moved this from In progress to Done in Dev Mar 17, 2020
@Quentame Quentame added this to the 0.9.5 milestone Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Dev
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants