Native PlayStation 4 Component Discussion

Hello everyone,

I have recently migrated my HA Docker installation to a supervised HassOS VM installation.
Afterwards, I noticed that my PlayStation integration was no longer working.
I deleted the old HA connection on my PS4 and the PlayStation integration on my HA.
When I tried to add the PS4 integration again, my HA does not show up on the second screen app.
A reboot of the router also does not solve the issue.
I have read on the page of the integration about opening privileges ports.
Does this also have to be done in a VM HassOS (as this was nog the case on my old Docker installation)?
Also, does this have to be done in the router settings or in HA?

Many thanks for the feedback.

Kind regards,

Robin

I’m not familiar with HassOS but in the past when changing my HA system I have found it helpful to delete the old Home Assistant connection in the PS4 settings and Second Screen and start the process over from the beginning.

I have deleted the old connection in both the PS4 settings and the Second Screen app, but still no luck.
My HA installation just won’t show up in the second screen app.
Whether my PS4 is on or off, it makes no difference as the second screen app can not detect my HA installation… It used to work flawless in my Docker environment, but now, in the supported install, I can not even create the connection…

As I mentioned not familiar with HassOS but do you have to open port 987 or anything? I didn’t know if HassOS has a firewall or anything. Also are you doing discovery in the integration settings or manually entering ip?

Edit: udp 987 and tcp 997

Edit again… the bottom of the docs mention 2 other ports as well… I don’t remember ever doing anything with those though… https://www.home-assistant.io/integrations/ps4/

Did you delete the integration as well? Found this note from creator

Thanks for the reply. I do not get to the part in which I have to select auto discovery or manual input, as the second screen app does not find my HA installation. I also have deleted the integration and the PS4 games JSON file, but the second screen app is still not able to find my HA. Did you open the ports only for the IP address of your HA installation, or also for your PS4? Many thanks for looking into this. Kind regards

I figured I’d chime in here since I’ve been having the same issue and was finally able to get it working. My HA is running on Docker with a static IP, yet I could never get Home-Assistant to show up in the 2nd Screen App.

The 2nd Screen App uses a Broadcast request on UDP 687 to find a PS4, which means HASS and your mobile device need to be in the same Broadcast Domain. My issue was that even though my HASS had an IP in the same range as my WIFI, it was using the /16 (255.255.0.0) subnet and my phone was using /24 (255.255.255.0). That meant that broadcasts from my HASS was able to reach the rest of my network, but anything not running in Docker was unable to broadcast to the dockers. Changed the network config on the Docker host to /24 and now it works fine.

I hope this helps.

Hello guys :slight_smile:

I’m having an issue turning off the PlayStation. With automation and hitting the button in media player. Doesn’t do anything. I’m I missing something or it’s a feature?:slight_smile:

Thanks.

Regards

Rui

1 Like

Hello. As they open ports 987 and 997. I think it is the problem that home assistant does not appear in sencond screen

Run this and get no errors. But I still don’t see the open ports with netstat

pi@raspberrypi:/ $ sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/python3.8
pi@raspberrypi:/ $ readlink -f /usr/local/bin/python
/usr/local/bin/python
pi@raspberrypi:/ $
pi@raspberrypi:/ $ netstat -lnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:37457         0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8123            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:1883            0.0.0.0:*               LISTEN
tcp6       0      0 :::80                   :::*                    LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
tcp6       0      0 :::8123                 :::*                    LISTEN
tcp6       0      0 :::1883                 :::*                    LISTEN
tcp6       0      0 :::3306                 :::*                    LISTEN

Hey guys!

When the PS4 is off, using the PS4 integration, it shows as “Unknown” (see image below). How could I change the state from Unknown to Off?

Thank you!

image

Hey!

I was also having problems with my PS4 in standby mode. On Github I found several issues that focus on this topic (here and here).

I was able to tackle the problem of showing the false state by installing the HACS Integration ha-ps4-custom as discussed here.

I hope this helps you as well!

1 Like

Thank you!

Hey!
I’m using HA OS 8.2 (running as VM on my QNAP NAS) and PS4 integration and for now trying to solve such task as to trip PS4 Pro from Standby to PoweredOff Mode while on UPS battery but without success unfortunately. I stack at the start screen of my PS with an invitation to press PS button. All attempts to send such command were unsuccessful. Log is attached, there are other failures, but they look like pretty much the same. Btw my PS4 has several user accounts. Any help is appriciated

Logger: homeassistant.helpers.entity
Source: components/ps4/media_player.py:152
First occurred: June 27, 2022, 23:10:57 (8 occurrences)
Last logged: June 27, 2022, 23:16:56

Update for media_player.ps4_pro fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 515, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 743, in async_device_update
    raise exc
  File "/usr/src/homeassistant/homeassistant/components/ps4/media_player.py", line 152, in async_update
    await self._ps4.async_connect()
  File "/usr/local/lib/python3.9/site-packages/pyps4_2ndscreen/ps4.py", line 652, in async_connect
    await self.login()
  File "/usr/local/lib/python3.9/site-packages/pyps4_2ndscreen/ps4.py", line 513, in login
    await self.tcp_protocol.login(pin, power_on, self.login_delay)
  File "/usr/local/lib/python3.9/site-packages/pyps4_2ndscreen/connection.py", line 640, in login
    self.sync_send(_get_remote_control_open_request())  # Open RC
  File "/usr/local/lib/python3.9/site-packages/pyps4_2ndscreen/connection.py", line 595, in sync_send
    raise PSConnectionError("Encrypted connection not initialized")
pyps4_2ndscreen.errors.PSConnectionError: Encrypted connection not initialized

This.
A fair bit later on, but I had the integration working, and then migrated and was back to struggle street. I realised my router had a subnet mask of 255.255.0.0 so changed that to 255.255.255.0 so that my iPhone had the correct subnet mask thru DHCP. As soon as the subnet masks matched – bingo. Thanks simlaf!

hello ladies and gents. I am writing to you seeking help.
I have a strange situation where “home assistant” is added to the PlayStation upon entering the (correct) PIN, but on HASS I get an error message, as shown in the below picture. I tried 3 times, I know for sure that I’m typing the correct PIN. Alas, every time it’s the same outcome.

Any advice would be highly appreciated.
Thank you,
M.

Same situation here. In my case, my account(s) on PS4 are active, but not the console doesn’t have a connection to PSN at the moment. HA appears in Second Screen App, PS4 appears in 2nd screen app, PS4 is auto-discovered by HA, etc. But HA never marks the connection successful after entering PIN.

At the end of the day I really only need this for ON/OFF detection, so if I need to, I’ll make an external sensor to handle it like I did for XBOX One. But it would be nice to ALSO get this working.

yes, I think my problem is the console is not connected to PSN, because I get a similar error on the PS4 2nd screen app. Yeah, probably I will skip it as well (being on fw11) and try to find another solution for on/off features.
Thank you for writing back.