Playstation 4/PS4 custom component

I deleted the “cmd” line and it works again

I’m having an error (running hass.io and beta) and not sure where to best put it. Should I open an issue in Github?
Error handling message: {‘type’: ‘call_service’, ‘domain’: ‘ps4’, ‘service’: ‘send_command’, ‘service_data’: {‘entity_id’: ‘media_player.george’, ‘command’: ‘enter’}, ‘id’: 32}
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/decorators.py”, line 17, in _handle_async_response
await func(hass, connection, msg)
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py”, line 147, in handle_call_service
connection.context(msg))
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1133, in async_call
self._execute_service(handler, service_call))
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1157, in _execute_service
await self._hass.async_add_executor_job(handler.func, service_call)
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/homeassistant/components/ps4/media_player.py”, line 82, in service_command
device.send_command(command)
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/ps4/media_player.py”, line 372, in send_command
self._ps4.remote_control(command)
File “/usr/local/lib/python3.7/site-packages/pyps4_homeassistant/ps4.py”, line 136, in remote_control
self._connection.login()
File “/usr/local/lib/python3.7/site-packages/pyps4_homeassistant/connection.py”, line 66, in login
self._send_login_request()
File “/usr/local/lib/python3.7/site-packages/pyps4_homeassistant/connection.py”, line 194, in _send_login_request
self._send_msg(msg, encrypted=True)
File “/usr/local/lib/python3.7/site-packages/pyps4_homeassistant/connection.py”, line 109, in _send_msg
self._socket.send(msg)
BrokenPipeError: [Errno 32] Broken pipe

Could you please share your entire ps4.py code ?
I think I used a older version and the changes you propose for hassio 0.88 do not work in my case.
Thanks !

Which original version of the ps4.py component did you use ?

Anyone else having problem with PS4 changing state from “playing” to “off” every 2-3 minute when playing games?

1 Like

I haven’t let mine run with someone playing games yet, but I’ll keep an eye out for this.

The original one I guess. I don’t remenber changed something else on the script.
But since 0.88, you also have to rename the script as media_player.py, move it to custom_components\ps4\ and create an empty file called __init__.py
( this is the match the new format of custom_components and to not have warning logs).

I read somewhere else in the forum that, in 0.89, a new ps4 component will be added as a standard component (ps4_waker will become obsolete) Native PlayStation 4 Component Discussion

Thank you,
I was not aware that the script had to be renamed and have its location changed.
Would you mind sharing your entire “media_player.py” code ? I tried to search on HMN’s github page, but it seems he removed the component. I also tried to modify the script I have and that used to work, but it’s not working in 0.88. At least, it will be a temporary solution until version 0.89 is available with an official ps4 component.

Here is the script I use : media_player.xml (15.4 KB)
Rename it to media_player.py (cannot upload a .py file)
0.89 will be available wedneday I guess :slight_smile:

The need to re-organize custom_components is explained in the dev blog https://developers.home-assistant.io/blog/2019/02/19/the-great-migration.html

Hope this will help you !

Hey guys,

I’ve been waiting for the official component. 0.89b1 is out but no PS4 component in the change log.

how come?

Thanks

It’s in there, I’m using it.

Without adding anything? How? I’m not saying it doesn’t work, I’m saying it is supposed to be included in 0.89 and we don’t need to do anything else than putting the information in the config file

I’ve noticed that this doesn’t work to well with more than one PS4 anymore. I have a Pro and a Slim, and both would be able to show their own status. Now if I’m playing on the Pro, both are showing as playing the same game even though the Slim is turned off.

Any ideas?

It’s an Integration, so you need to go to configuration > integrations and choose the PlayStation 4 option. Then it’ll walk you through setting it up. It doesn’t use a config entry any more.

Thanks, the component is working again now.
But it does not display covers anymore :frowning:
@abdel.elbel fixed it in a previous version (Playstation 4/PS4 custom component), but I am not good enough in python to know what’s wrong…
I guess i’ll have to wait for the release of 0.89, should not be too long :slight_smile: ! Do you know if there will be an online database to automatically fetch the covers ?

1 Like

I’m having the same issue where I can’t connect to the PS4 once it goes into Rest Mode.

For me it was because my router/switch seemed to be disconnecting, or at least losing access to, the PS4. It seems to have been fixed by just letting the PS4 have a dynamic IP instead of assigning it a static for some reason.

Same issue for me, mine is set on dynamic ip and still cant wake it up from rest mode using the app or home assistant.

Hi guys, I really like to thanks for the sharing and the great job for bringing PS4 integration to home assistant.

I managed to integrate it with Echo and my TV. it work like charm. Here is my final product. I noticed one thing, the best is to hook up the console with LAN cable to get a stable network connection, otherwise the status of the console won’t update back to Home Assistant UI

how did you do? can you send the configuration?