Native PlayStation 4 Component Discussion

media_player
Tags: #<Tag:0x00007fd078a168c8>

#62

Support for that will be released soon. Hopefully 0.89.1. You can only use one as of now.


#63

how do i go about setting this up for 2 or more ps4s?


#64

The path you need should not be in your venv/homeassistant directory as mentioned by some. Run whereis python3. One of the outputted paths is correct. Should look something like /usr/bin/python3.5


#65

Hi Ktnrg45,
Thanks for your reply.
The output of:

whereis python3

Gives me:

python3: /usr/bin/python3 /usr/bin/python3.4m-config /usr/bin/python3.4m /usr/bin/python3.4 /usr/bin/python3.4-config /etc/python3 /etc/python3.4 /usr/lib/python3 /usr/lib/python3.4 /usr/bin/X11/python3 /usr/bin/X11/python3.4m-config /usr/bin/X11/python3.4m /usr/bin/X11/python3.4 /usr/bin/X11/python3.4-config /usr/local/bin/python3 /usr/local/bin/python3.6-config /usr/local/bin/python3.6m-config /usr/local/bin/python3.6 /usr/local/bin/python3.6m /usr/local/lib/python3.6 /usr/local/lib/python3.4 /usr/include/python3.4m /usr/include/python3.4 /usr/share/python3 /usr/share/man/man1/python3.1.gz

Still a bit puzzled because i ran:

sudo setcap ‘cap_net_bind_service=+ep’ /usr/bin/python3.4

Which seems to work, but i still get a:

Could not bind to port 987

Error when i use the integrations page.

br,
Raymond


#66

I saw this note on the new PS4 component when using Docker.

DOCKER

When running Home Assistant using Docker, make sure that the Home Assistant container is discoverable by the PS4. This can be achieved by ensuring that the Home Assistant container uses the host network driver (by passing --net=host to the container when creating, or adding network_mode: "host" to your compose file when using docker-compose ).

I’ve followed this guide to install.
How can I know if the HA container uses the host network driver?
I’m using Portainer and I see that there is an homeassistant container and an hassio-supervisor.
The first one is connected to network host, the second one to bridge and hassio netwok and it’s not possible to connect to host, even if the container is stopped.

I’m getting the Failed to pair message to PS4.

What else can I check?

Hassio is version 0.89

Thanks


#67

Do i perhaps have to upgrade python to a minimum 3.5.
I am om Ubuntu 14.04 LTS for armhf


#68

Working perfect with Hassio and PS4 Pro except no art work. Not a biggie but would be cool to get it working. Any idea where to start troubleshooting/solve that?


#69

@fillilutten Post an issue here. Be sure to list your region, country, and the title and sku id for the art work. Go to the states menu in HA and under your ps4 entity and copy the attributes: media_content_id, media_title for title and sku.


#70

Try this one. /usr/bin/python3
HA requires python 3.5 so I’d definitely update that as well.


#71

If you make it to the form with fields to enter info. Your ports are good. If you could post your debug logs that would be great.


#72

I’ve added this row under logger

homeassistant.components.ps4: debug

and restarted, but I don’t see any debug in log with ps4 and neither with playstation

When I enter the PIN on the PS4 it adds the Home-Assistant row, but in HA I get the Pairing error and check if the PIN is correct.
I entered the PIN without any space.

Is the logger row correct?

PS:

I’ve got some log

Error handling request

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/real_ip.py", line 33, in real_ip_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/auth.py", line 98, in auth_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/view.py", line 112, in handle
    result = await result
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/config/config_entries.py", line 144, in post
    return await super().post(request, flow_id)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/data_validator.py", line 46, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/data_entry_flow.py", line 86, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/data_entry_flow.py", line 80, in async_configure
    flow, step_id, user_input)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/data_entry_flow.py", line 98, in _async_handle_step
    result = await getattr(flow, method)(user_input)  # type: Dict
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/ps4/config_flow.py", line 72, in async_step_link
    self.helper.has_devices)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/pyps4_homeassistant/helpers.py", line 21, in has_devices
    devices = ddp.search()
  File "/usr/local/lib/python3.7/site-packages/pyps4_homeassistant/ddp.py", line 100, in search
    data, addr = _send_recv_msg(host, broadcast, msg)
  File "/usr/local/lib/python3.7/site-packages/pyps4_homeassistant/ddp.py", line 89, in _send_recv_msg
    return sock.recvfrom(1024)
socket.timeout: timed out

#73

Still stuck on binding port 987 can’t find alternative to setcap for mac


#75

Hey @Ktnrg45, just wanted to say thanks a lot for making this, it works really well and is so much easier to deal with. Great job!


#76

It seems that you are not getting a response from the ps4 fast enough. The integration searches for the ps4 twice once before and once after entering the pin. It finds the ps4 correctly in the first search oddly enough.

I should be able to address this in a future release. Do you happen to have multiple ps4s? If so, disconnect the others. Otherwise you can try setting up the Integration again until it works for now.


#77

Unfortunately auth_bind may be the simplest/ideal solution at the moment if you plan to stick with OSX. If you can find a way to reroute traffic correctly it could be feasible but I do not know how to accomplish that.


#78

Does anybody have a example of a working script?

I can’t seem to figure out past media_player.turn_on

Adding the 2nd screen commands.

Thanks


#79

I have only one PS4.
I’ll try again to see if it works, as fast as I can… :wink:

Thanks


#80

I’m getting this exact same log output, but it doesn’t even get to the point of entering a PIN. About five seconds after I click the Home-Assistant entry in the PS4 Second Screen app, the dialog box in home assistant gives a red “Unknown error occurred” message. This will keep happening no matter what. I run in docker and I’ve already done the --net=host switch, but it didn’t change anything.


#81

Hi Ktnrg45,
Thanks for all your effort.
When i do:

sudo setcap ‘cap_net_bind_service=+ep’ /usr/bin/python3

I get:

Failed to set capabilities on file `/usr/bin/python3’ (Invalid argument)
The value of the capability argument is not permitted for a file. Or the file is not a regular (non-symlink) file

My HA install in my Vert Inv is using python 3.6:

/srv/homeassistant/bin# ls -al | grep python3
lrwxrwxrwx 1 homeassistant nogroup 9 jan 19 2018 python3 -> python3.6

So i am still a bit confused.
HA is functioning fine in its vert. inv. but for some reason i can’t seem to give it access to the needed ports.

Can i update the main python from 3.4 to 3.7 without issues or is there something to keep in mind/i need to consider?

br,
Raymond


#82

I don’t see why not but you’re probably going to have to compile it from source files. I believe Rassbian Stretch has python 3.5 as a package you can get by running sudo apt-get install python3. Make sure to run python -V inside your activated venv to check if your version is correct after install.