Native PlayStation 4 Component Discussion

Tags: #<Tag:0x00007fd078a168c8>


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


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


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


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.



I saw this note on the new PS4 component when using 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



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


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?


@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.


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


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.


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?


I’ve got some log

Error handling request

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/", line 119, in impl
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/", line 33, in real_ip_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/", line 98, in auth_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/", line 112, in handle
    result = await result
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/config/", line 144, in post
    return await super().post(request, flow_id)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/", line 46, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/", line 86, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/", line 80, in async_configure
    flow, step_id, user_input)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/", 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/", line 72, in async_step_link
  File "/usr/local/lib/python3.7/concurrent/futures/", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/pyps4_homeassistant/", line 21, in has_devices
    devices =
  File "/usr/local/lib/python3.7/site-packages/pyps4_homeassistant/", line 100, in search
    data, addr = _send_recv_msg(host, broadcast, msg)
  File "/usr/local/lib/python3.7/site-packages/pyps4_homeassistant/", line 89, in _send_recv_msg
    return sock.recvfrom(1024)
socket.timeout: timed out


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


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!


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.


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.


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.



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



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.


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?



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.