alexmohr / sonyapilib

Contains a python api to control sony devices.
MIT License
20 stars 11 forks source link

error 'SonyDevice' object has no attribute 'get_action' (BDV-N9100W) #38

Closed gohlas closed 5 years ago

gohlas commented 5 years ago

Hei, I am trying to make it to work on my home assitant. on a BDV-N9100W I manage to pip install the sonyapilib and copied the sony custom component into home assistant config folder.

The problem is when I try to put the 0000 pin during the configuration, it does not work. I get the message below, then nothing happens.

'SonyDevice' object has no attribute 'get_action'
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service
    connection.context(msg))
  File "/usr/src/app/homeassistant/core.py", line 1150, in async_call
    self._execute_service(handler, service_call))
  File "/usr/src/app/homeassistant/core.py", line 1172, in _execute_service
    await handler.func(service_call)
  File "/usr/src/app/homeassistant/components/configurator/__init__.py", line 221, in async_handle_service_call
    call.data.get(ATTR_FIELDS, {}))
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/sony/media_player.py", line 120, in sony_configuration_callback
    auth_mode = sony_device.get_action("register").mode
AttributeError: 'SonyDevice' object has no attribute 'get_action'

Any idea on how to precede?

Thanks

alexmohr commented 5 years ago

Hi, sorry for your issues. I assume you used this integration for home assistant https://github.com/dilruacs/media_player.sony/

Sadly @dilruacs has not merged the PR I've opened a while ago which fixes this issue. Just take the master branch of https://github.com/alexmohr/media_player.sony to solve this.

Let me know if this solves your issue.

gohlas commented 5 years ago

Hei Alex, Thanks for the quick reply. Just tested and its working fine with this repo.

Just wondering, I cannot see any source option on the player. Is there any limitation for this in this component?

alexmohr commented 5 years ago

The device I'm using does not support reading back the selected source. Some devices do support that but it is currently neither implemented in the api lib nor in the home assistant component.

I'd be happy to accept a PR implementing this feature. The readme links to sources documenting the api a bit.

gohlas commented 5 years ago

Hei Alex, I am not really familiar with this programming but I can try to make some research and try to test in my device. But it will take some time for me to understand how it works and also find time to it. So can't promisse anything but I will at least try. :) I can see there are some features in the api lib that are not in HA component, but source change is not one of them. But it might be able to find in the API documentation, because I do have this option on my TV shows app.

Thanks for the help.