Native PlayStation 4 Component Discussion

Hi all,

This integration is great and i have been using it with joy for some time.
Recently i changed my config and use docker-compose for HA amongst other.
Everything worked like a charm.
Today i did rebuild the container to the latest HA version. (the config folder is linked outside the container, preserving the config) using this command:

docker-compose up --force-recreate --build -d

and all of a sudden i get this message:

2020-02-27 12:51:50 WARNING (MainThread) [homeassistant.components.ps4.media_player] PS4 could not be reached

Any ideas or help is much appreciated
thanks upfront,

br,
Raymond

I am attempting to get this setup and running, but I must be missing something. I have attempted to set it up on a Home Assistant instance running on a Proxmox VM. I have punched the appropriate holes in the firewall (TCP 997, UDP 987). I have also attempted to install it on a Home Assistant Core Docker instance (with appropriate net=host config). Neither works.

One thing I know I donā€™t understand is where am I supposed to ā€œRefresh Devicesā€ as referenced in the pic below?
image
I have installed the Second Screen app on an Android phone and an iPhone, and neither has a place to refresh devices and pulling down on the screen does nothing as well. I the Mobile App Connection Settings on the PS$, I can see where my 2 phones have connected, but clicking on Add Device only brings up another connection code.

What am I doing wrong? I know it has to be something stupid since it doesnā€™t appear from my search of the forum that others have run into this issue.

So for Android at least there is a button with 3 vertical dots at the top. And the refresh devices button should be there. Press this after you click on submit.

Hi iā€™m getting this wit latest home assistant : i managed to do the stuff using second screen app and see i the entry in mobile devices on ps4 but whenever i start my home assistant i get this error. Do note my home assistant is installed on windows 10 but iā€™m not sure itā€™s related

2020-03-05 16:59:34 ERROR (MainThread) [homeassistant.setup] Error during setup of component ps4
Traceback (most recent call last):
  File "c:\tools\python37\lib\site-packages\homeassistant\setup.py", line 170, in _async_setup_component
    hass, processed_config
  File "c:\tools\python37\lib\site-packages\homeassistant\components\ps4\__init__.py", line 56, in async_setup
    transport, protocol = await async_create_ddp_endpoint()
  File "C:\Users\Davy\AppData\Roaming\.homeassistant\deps\Python37\site-packages\pyps4_2ndscreen\ddp.py", line 134, in async_create_ddp_endpoint
    transport, protocol = await loop.create_task(connect)
  File "c:\tools\python37\lib\asyncio\base_events.py", line 1229, in create_datagram_endpoint
    _set_reuseport(sock)
  File "c:\tools\python37\lib\asyncio\base_events.py", line 89, in _set_reuseport
    raise ValueError('reuse_port not supported by socket module')
ValueError: reuse_port not supported by socket module

Hi, yes this is very much a windows issue. Iā€™ll look into this.

Did you receive any update on this? I am facing this messsage, too - after moving HA from one Docker host to a new one.

Oh yes, the problem solved itself at the first use of the ps4ā€¦ I did nothingā€¦

@Ktnrg45

Do you perhaps have any clue or could you perhaps give me a direction in where to start looking for a solution with my docker install problem.
I am really lost here and I would love to use your great integration.

Thanks upfront!

Br,
Raymond

@Ktnrg45

I have tried to setup this integration but I get this error in log:

Logger: aiohttp.server
Source: components/ps4/config_flow.py:71
First occurred: 11:49:02 PM (1 occurrences)
Last logged: 11:49:02 PM

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/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 123, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 163, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 50, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 92, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 130, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 172, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/components/ps4/config_flow.py", line 71, in async_step_creds
    self.helper.get_creds, DEFAULT_ALIAS
  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_2ndscreen/helpers.py", line 81, in get_creds
    return credentials.listen()
  File "/usr/local/lib/python3.7/site-packages/pyps4_2ndscreen/credential.py", line 102, in listen
    socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
OSError: [Errno 9] Bad file descriptor

Iā€™m running latest version 0.107.7 and hassio on rpi. I donā€™t see anything in PS4 2nd screen app (i can control PS4 from app). Can you help me please?

EDIT: also one more thing, I canā€™t seem to have that refresh devices button in 2nd screen app, when I tap on three dots there is only help and settings buttons. there is no refresh button in none of those two either.

Thanks

Hello, I have read this entire discussion but I suppose due to my novice understanding of docker, I cannot seem to make sense of how to get this integration working on my setup. I have set up a virtual machine using VirtualBox and the Home Assistant VMDK. On the second screen app, I can see my PS4 and connect to it but when I click submit in home assistant I cannot see Home-Assistant come up in the app no matter how many times I refresh or force close and then open the app. Can anyone let me know how I can get this integration working or point me to the right direction? Any help will be greatly appreciated.

same issue here. anyone figured out how to show ā€˜standbyā€™ as off? otherwise Iā€™ll go and create my own template switch

Not really, if you got your template switch please mind sharing to us :smiley:

this is working great so far

switch:
  - platform: template
    switches:
      ps4:
        friendly_name: "PS4"
        value_template: "{{ is_state('media_player.ps4', 'playing') or is_state('media_player.ps4', 'idle') }}"
        icon_template: 'mdi:sony-playstation'
        turn_on:
          service: media_player.turn_on
          data:
            entity_id: media_player.ps4
        turn_off:
          service: media_player.turn_off
          data:
            entity_id: media_player.ps4
2 Likes

Works great thank you very much!!! :+1:

Hello,

Iā€™m having trouble with PS4 integration.

I run HA on Hass.IO on a Raspberry Pi 4 with the 32 bit image.

Do I need to do anything with port 987 and 997?

I have done everything by following the procedure with Second App Screen, put the ps4 pin in HA, everything seems fine.

An entity media_player.playstation_4 have been created. But it remain inactive and I canā€™t see any source and the HA on Second Screen App doesnā€™t connect.

Anybody have the same problem or knows how to solve it?

Thanks a lot,
Guillaume

Anyone have any suggestions as to why my PS4 will no longer enter rest-mode or turn-off using media_player.turn_off? It worked for the longest time and for the last few weeks it does nothing, no errors in logsā€¦ will turn debug on in the meantime and report back if it shows anything.

Log Details (ERROR)
Logger: pyps4_2ndscreen.connection
Source: __main__.py:342 
First occurred: 7:01:12 PM (7 occurrences) 
Last logged: 7:07:45 PM

Failed to login, Closing connection

All fixed but Iā€™ll leave this here for the next person, I moved to a new systemā€¦ but it still turned on and showed the status so I assumed all was good, deleting the integration and home assistant from the second screen list on ps4, and re-adding is all good now.

Same error here. I was able to get it to stop by starting a game, and then closing it out. So apparently it is caused by the PS4 sitting idle. I have a hunch it will start generating an error when I restart HA and continue until I start a game again on the PS4.

Hi All,

I have been using the Playstation 4 integration quite successful in the past. However I made a change in my network: moved the Playstation to a different VLAN in my network than hassio. I have opened up all traffic (Unifi gear) from the Gaming VLAN to the LAN VLAN.

I am trying to reconfigure the companion app, which goes pretty well until the pincode

image

For some reason I am not able to provide a valid pincode now.

Any help is welcome.

Odd issue with this, I can send commands via services when Iā€™m on the main playstation menus, as soon as an app is open (Netflix, Disney+ etc) the commands no longer work? Iā€™ve tried this using the ps4.send_command and also via remote.send_command with remote.harmony_hub. Both sets of commands run fine until Iā€™m in an app.
Is there any known issues with this or can anyone point me at any suggestions??
Edit - the only command that works in app is ā€œpsā€ on both services