Native PlayStation 4 Component Discussion

Nothing is bound to 987 for me:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 10.0.0.201:8300         0.0.0.0:*               LISTEN      5482/python3
tcp        0      0 0.0.0.0:32400           0.0.0.0:*               LISTEN      556/Plex Media Serv
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      623/nginx: master p
tcp        0      0 127.0.0.1:40561         0.0.0.0:*               LISTEN      662/Plex Plug-in [c
tcp        0      0 127.0.0.1:32401         0.0.0.0:*               LISTEN      556/Plex Media Serv
tcp        0      0 0.0.0.0:32402           0.0.0.0:*               LISTEN      623/nginx: master p
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      552/sshd
tcp        0      0 127.0.0.1:32600         0.0.0.0:*               LISTEN      752/Plex Tuner Serv
tcp        0      0 127.0.0.1:8088          0.0.0.0:*               LISTEN      543/influxd
tcp        0      0 0.0.0.0:8123            0.0.0.0:*               LISTEN      5482/python3
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      623/nginx: master p
tcp6       0      0 :::8086                 :::*                    LISTEN      543/influxd
tcp6       0      0 :::22                   :::*                    LISTEN      552/sshd
tcp6       0      0 :::3000                 :::*                    LISTEN      6333/grafana-server

Same result here.

root@Up2:/usr/bin# ls -al | grep python
lrwxrwxrwx  1 root root          26 Sep 27 21:40 dh_pypy -> ../share/dh-python/dh_pypy
-rwxr-xr-x  1 root root        1056 Jan 18 10:56 dh_python2
lrwxrwxrwx  1 root root          29 Sep 27 21:40 dh_python3 -> ../share/dh-python/dh_python3
lrwxrwxrwx  1 root root          69 Jan  1 14:19 lirc-setup -> ../lib/x86_64-linux-gnu/python3.7/site-    packages/lirc-setup/lirc-setup
lrwxrwxrwx  1 root root          23 Feb 18 11:05 pdb2.7 -> ../lib/python2.7/pdb.py
lrwxrwxrwx  1 root root          23 Feb  2 14:31 pdb3.7 -> ../lib/python3.7/pdb.py
lrwxrwxrwx  1 root root          31 Jan 18 07:54 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx  1 root root          26 Sep 27 21:40 pybuild -> ../share/dh-python/pybuild
lrwxrwxrwx  1 root root           7 Jan 18 10:56 python -> python2
lrwxrwxrwx  1 root root           9 Jan 18 10:56 python2 -> python2.7
-rwxr-xr-x  1 root root     3689320 Feb 18 11:05 python2.7
lrwxrwxrwx  1 root root           9 Jan 18 07:54 python3 -> python3.7
-rwxr-xr-x  2 root root     4873728 Feb  2 14:31 python3.7
lrwxrwxrwx  1 root root          33 Feb  2 14:31 python3.7-config -> x86_64-linux-gnu-python3.7-config
-rwxr-xr-x  2 root root     4873728 Feb  2 14:31 python3.7m
lrwxrwxrwx  1 root root          34 Feb  2 14:31 python3.7m-config -> x86_64-linux-gnu-python3.7m-config
lrwxrwxrwx  1 root root          16 Jan 18 07:54 python3-config -> python3.7-config
lrwxrwxrwx  1 root root          10 Jan 18 07:54 python3m -> python3.7m
lrwxrwxrwx  1 root root          17 Jan 18 07:54 python3m-config -> python3.7m-config
lrwxrwxrwx  1 root root          29 Jan 18 10:56 pyversions -> ../share/python/pyversions.py
lrwxrwxrwx  1 root root          34 Feb  2 14:31 x86_64-linux-gnu-python3.7-config -> x86_64-linux-gnu-python3.7m-config
-rwxr-xr-x  1 root root        3291 Feb  2 14:31 x86_64-linux-gnu-python3.7m-config
lrwxrwxrwx  1 root root          33 Jan 18 07:54 x86_64-linux-gnu-python3-config -> x86_64-linux-gnu-    python3.7-config
lrwxrwxrwx  1 root root          34 Jan 18 07:54 x86_64-linux-gnu-python3m-config -> x86_64-linux-gnu-python3.7m-config

Can you post the output of

cd /use/bin
ls -al | grep python

bummer mate. Not sure what else to try. I’ve literally tried everything that points to python. This one finally worked for me. Maybe the path is slightly different from you. I’ve seen some setups use /srv/hass/bin. Maybe explore /srv/ and see what’s there and where you end up.

Interestingly enough this works in WSL Debian Buster running Python 3.7 with HA in a venv…

Do you guys have nginx set up too?

No I don’t.

Ran through the setup again with WSL Debian, the port bind seems to work but the config always fails:

image

Busted out an old Pi and completed a venv install using python 3.5 instead. The integration “works” after setcap command run but again the component fails to register:

image
image

I’m also getting the fail message,
But on the PS4 (as well as on the PS4 app) the HomeAssistant is shown and paired.

What can I check?

I have Hassio under docker and was activated with --net=host .

Do I need any open port on the router (I hope not)?

Thanks

No ports need to be opened, this is entirely local.

setcap 'cap_net_bind_service=+ep' /usr/local/bin/python3.7

This was the command that finally worked for me on python 3.7.2. Now to work out why the pin isn’t being accepted…

More logs: looks like there’s a problem with the credentials?

2019-03-07 17:04:29 DEBUG (SyncWorker_11) [pyps4_homeassistant.helpers] Searching for PS4 Devices
2019-03-07 17:04:29 DEBUG (SyncWorker_11) [pyps4_homeassistant.helpers] Found PS4 at: 10.0.0.210
2019-03-07 17:04:29 DEBUG (SyncWorker_4) [pyps4_homeassistant.connection] Connect
2019-03-07 17:04:29 DEBUG (SyncWorker_4) [pyps4_homeassistant.connection] TX: 28 b'1c0000007063636f0000020000000000000000000000000000000000'
2019-03-07 17:04:29 DEBUG (SyncWorker_4) [pyps4_homeassistant.connection] RX: 36 b'240000007063636f0000020000000000010000004c1e7badaf9cc5526d1cb8cedacce6e3'
2019-03-07 17:04:29 DEBUG (SyncWorker_4) [pyps4_homeassistant.connection] key b'c24bc2872e97ed9c1394f48fcfb6d7cb432f22ba42e1af75a5837d37cf6dcaf913dda5940931e30402d3230948e7a0451401ebfbc11f95f2189fad05517a044cdc3a144bd80d3d3373cf45342fe1$
2019-03-07 17:04:29 DEBUG (SyncWorker_4) [pyps4_homeassistant.connection] TX: 280 b'1801000020000000c24bc2872e97ed9c1394f48fcfb6d7cb432f22ba42e1af75a5837d37cf6dcaf913dda5940931e30402d3230948e7a0451401ebfbc11f95f2189fad05517a044cdc3a144b$
2019-03-07 17:04:29 DEBUG (SyncWorker_4) [pyps4_homeassistant.connection] Login
2019-03-07 17:04:29 DEBUG (SyncWorker_4) [pyps4_homeassistant.connection] config {'app_label': b'PlayStation\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00$
2019-03-07 17:04:29 DEBUG (SyncWorker_4) [pyps4_homeassistant.connection] TX: 384 b'800100001e0000000000000001020000646330653166353466633538303435653736636163633737373838336435613662613731626235313265326464373761393164326438383535333336$
2019-03-07 17:04:29 DEBUG (SyncWorker_4) [pyps4_homeassistant.connection] TX(cypted): 384 b'8b8c6b13c3325310a9d3e7e6043221fa736818ae22ce33a138421e33fc8a9918893c1162d225f5b61be176001bc664891158157c0a82072d9bb4411a26b61c16ed8feca7f9b7823f$
2019-03-07 17:04:30 DEBUG (SyncWorker_4) [pyps4_homeassistant.connection] RX: 16 b'6ec4b30a3e7e8d2347f83325c416502c'
2019-03-07 17:04:30 DEBUG (SyncWorker_4) [pyps4_homeassistant.connection] RX: 16 b'10000000070000001700000000000000'
2019-03-07 17:04:30 DEBUG (SyncWorker_4) [pyps4_homeassistant.connection] Login Failed

I’ve just setup the component and it seems to work very well! It looks like the PS4 Waker also supports login on the PS4 with a pincode (I like the extra security). Are you also going to add support for that?
Is there a way to request images for games? I would love to make something in Lovelace which shows all the cover arts of the games.
And what do I need to start a game? I saw that if I select a game in the source that it will start, but what if it’s not in the list yet. Is there a way to start the game?

@Ktnrg45 thanks for the awesome component!

Very nice. But how do i activate cover, change game, etc.

@Uppling I use the mini media player to show the artwork and you can select a source to start a game, but it only shows games that you’ve started.

1 Like

Native PS4 media player component working very nicely! The only hiccup I had was an error that the PIN was incorrect, but that seems like it was because I had a space similar to how it was displayed on-screen.

I made an automation to send a media_player.turn_on command whenever I start my PS4 Harmony activity, so it’s finally automated. Very happy about that. Also added a few buttons and some time tracking stuff as conditional lovelace cards.

1 Like

Nice! can you share your buttons config? Thanks!

Sure.

Lovelace UI part - https://pastebin.com/SAhwWXeR
PS4.yaml package (time tracking + automations) - https://pastebin.com/NnqFvTWE

It uses two custom cards, mini-media-player (https://github.com/kalkih/mini-media-player) and custom button card (https://github.com/custom-cards/button-card).

5 Likes

@anon12983141 Theres a post below which describes the probable cause of the pin issue. @SeanM. PIN is 8 digits no spaces. Ill add errors and docs for this.

Have you tried configuring yet? OSX might not need extra configuration.

@Ktnrg45 Perhaps instead of showing an error that PIN code can’t contain space, maybe the setup flow could just automatically strip out a space? Just a suggestion to make it a little more user friendly.

Aside from that I think it’d be helpful to display a link to the docs page on the setup screen. It’s pretty straightforward with the exception of the region dropdown.

Lastly, was also wondering could you think about displaying a generic fallback image if there’s no cover available? For example when browsing the XMB/Store or any apps it doesn’t have a cover (or media title) and seems to report the ps4 media player in an “idle” state. It seems not every game has a cover either (inFAMOUS First Light is one I noticed). Here is a mockup of what I mean: https://i.imgur.com/00v8EXQ.png

Thanks a ton for this component, it’s amazing.

I had an issue when entering the PIN code too. I typed in the numbers without any spaces, and “An unknown error occurred” message appeared. Tried typing in PIN code with a space, got the correct error message, then tried again without a space, and it magically worked. I used the same PIN code since I first received the error. I don’t have any logs to share for debugging unfortunately.

The component works great, but I’m still wondering why cover art for certain games don’t show up. I tested two games I downloaded from PSN: Wipeout Fusion Collection and Titanfall 2 – art didn’t show. Cover art did show up for a disc-based game I have, Ace Combat 7. If cover art is using a DB that needs to be manually, I’d be happy to add some entries.

So a cover for when state is idle? Ill look into that.