alexmohr / media_player.sony

Custom component for Home Assistant to control Sony devices
Apache License 2.0
16 stars 8 forks source link

Home Assistant can't find sonyapilib when using media_player.sony #9

Closed dickschoeller closed 4 years ago

dickschoeller commented 4 years ago

On Ubuntu I installed sonyaplib with pip3 Modified the configuration as prescribed Getting the following error

Log Details (ERROR) Logger: homeassistant.components.media_player Source: custom_components/sony/media_player.py:66 Integration: Media player (documentation, issues) First occurred: 12:14:07 AM (1 occurrences) Last logged: 12:14:07 AM

Error while setting up sony platform for media_player Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 179, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for return fut.result() 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 66, in setup_platform from sonyapilib.device import SonyDevice ModuleNotFoundError: No module named 'sonyapilib'

alexmohr commented 4 years ago

Please make sure that you've installed the sonyapilib in the same virtual env in which home assistant is running. If you are using the docker image you have to use the provided updater. Using the updater could solve this issue even for a non docker installation

dickschoeller commented 4 years ago

Alex,

Thanks for the quick response.

I set things up with the supervised installer script, which runs things in docker. I suspected that the containers it set up would isolate the environment, but wasn't sure what to do about it.

When you mention the provided updater, do you mean https://github.com/custom-components/custom_updater ? Or was there some other thing that I hadn't found yet?

This is a brand new experiment for me. So, if I've set things up badly, I don't have a problem knocking it down and starting over. This is something I will do eventually when I move onto a dedicated RPi.

Regards, Dick

dickschoeller commented 4 years ago

One more thing. I am very experienced with docker and java, but have 0 python experience. So, I will be completely oblivious to things that you might find obvious.

alexmohr commented 4 years ago

I did mean the updater you've linked but it might be the case that it isn't working anymore as it has been replaced by https://hacs.xyz I'll look into replacing the custom installer. Another option would be to create a new docker image with docker compose to include a pip install. ( In case you did not already knew the error you got is basically the ClassNotFoundException in java )

Could you link the home assistant documentation you've used to install?

dickschoeller commented 4 years ago

I followed the instructions in the linked page, specifically in the section "Installation of Home Assistant Supervised", where it describes executing the script.

https://www.home-assistant.io/hassio/installation/#alternative-install-home-assistant-supervised-on-a-generic-linux-host

alexmohr commented 4 years ago

Thanks I took a brief look at the supervised mode as this was new to me as well. I'll provide a configuration for the addon browser but it'll take a couple of days.

alexmohr commented 4 years ago

When using Home assistant supervised put the custom_components folder in /usr/share/hassio/homeassistant home assistant will install all dependencies into the containers. Please let me know if this solves your issue. Unfortunately I'm currently not at home so I cannot test it myself but my home assistant instance does not report any errors when doing so.

dickschoeller commented 4 years ago

That's where I had put it. It isn't pulling the dependency.

dickschoeller commented 4 years ago

It seems like the only place that has sonyapilib is in ~/.cache/pip/... Might I need to tell it to install elsewhere?

alexmohr commented 4 years ago

Installing via pip does not help as it must be installed in the docker container. The repository was missing a file which tells home assistant which dependencies to install. I've added it and tested it in a supervised installation. It should work for you as well. Please let me know if you have any further issues.

dickschoeller commented 4 years ago

Ah! Got it. I missed that I needed to pull.

Now it starts up and finds my device, but it won't pair. The log is showing the following 404 error.

2020-04-12 08:59:11 ERROR (SyncWorker_91) [sonyapilib.device] HTTPError: 404 Client Error: Not Found for url: http://192.168.2.202:10000/sony/accessControl

My recollection, from trying other IP based remote software, is that the UBP-X1000ES doesn't do the whole PIN on the screen thing the way some of the older devices do.

alexmohr commented 4 years ago

See for https://github.com/alexmohr/sonyapilib/ supported devices. Unfortunately the UBP-X1000ES is not supported

dickschoeller commented 4 years ago

Thanks. I guess will have I do some more hunting around. Worse comes to worst, I can try to put a network monitor on while pairing the Video & TV SideView app and see how the handshake is different from other Sony players.

In any case, thanks again for the very quick responses. Be well.