Playstation 4/PS4 custom component

it sounds more like a ps4-waker problem, so you should probably look at their troubleshooting guide https://github.com/dhleong/ps4-waker/wiki/Troubleshooting#your-network-is-dropping-udp-packets

The games are designed to come from a url, but you can select any url you wanā€™t

I donā€™t really se any reason to change this, so unless someone has time to write a parser for the wiki page I donā€™t really plan on changing that behaviour right now

Nice!! would something like this be possible for Nintendo Switch as well?

Thanks for your reply. I thought it would be the ps4-waker too at first but it seems that ps4-waker is work correctly when I run the commands through SSH. But Iā€™ll look in to it again.

The switch has been out since 2 months. There are some apps for the switch on the google play store which could be reverse engineered. But I donā€™t think something like this is possible.

Also. The switch relies on battery, they would never want to be a network connection be running when not in use.

Something like a hardmod could be possible in a few years.

Edit 1:


Something like turn-off could be possible with a lot of work and tinkering.

If the hardware would be donated, Iā€™d look into it :stuck_out_tongue:

Iā€™m using 0.44.1 and installed according to instructions above. Iā€™m getting an error while checking syntax:
2017-05-14 19:10:02 ERROR (MainThread) [homeassistant.loader] Unable to find component media_player.ps4

I changed the owner of ps4.py from root to pi to homeassistant (and back and forth), but I continue to get the same error no matter who owns it. I also modified permissions by chmod 755 (and even tried 777 or a+x), but still getting the same issues.

Configuration.yaml includes:

  • platform: ps4
    host: 192.168.XX.XX

Am I missing something? Iā€™m relatively new to this and tried to follow directions but Iā€™m not great at troubleshooting.

In what directory does the file live in?

The ps4.py sits in custom_components/media_player. The configuration file sits out in the main directory.

maybe you should try looking at https://home-assistant.io/developers/component_loading/ and try creating the hello world component described here https://home-assistant.io/developers/creating_components/ to test that you are placing stuff correctly

I do seem to be having problems with Hello World as well (same issue of not finding the component), so fair point. Iā€™ll try a separate post to see if I can figure this out.

Iā€™m having similar problem, the ps4.py file is in the correct folder but it doesnā€™t load (no media players load with it in the config).

I donā€™t know if this helps but this is what my homeassistant.log puts out:

SyntaxError: invalid syntax
2017-05-21 11:02:53 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
    result = next(coro)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/discovery.py", line 111, in new_service_found
    hass, component, platform, info, config)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/discovery.py", line 155, in async_load_platform
    hass, component, hass_config)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/setup.py", line 49, in async_setup_component
    return (yield from setup_tasks[domain])
  File "/usr/lib/python3.4/asyncio/futures.py", line 390, in __iter__
    return self.result()  # May raise too.
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
    result = next(coro)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/discovery.py", line 111, in new_service_found
    hass, component, platform, info, config)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/discovery.py", line 155, in async_load_platform
    hass, component, hass_config)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/setup.py", line 49, in async_setup_component
    return (yield from setup_tasks[domain])
  File "/usr/lib/python3.4/asyncio/futures.py", line 390, in __iter__
    return self.result()  # May raise too.
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
    result = coro.throw(exc)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/setup.py", line 60, in async_setup_component
    return (yield from task)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
    result = next(coro)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/setup.py", line 155, in _async_setup_component
    conf_util.async_process_component_config(hass, config, domain)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/config.py", line 560, in async_process_component_config
    platform = get_platform(domain, p_name)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/loader.py", line 103, in get_platform
    return get_component(PLATFORM_FORMAT.format(domain, platform))
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/loader.py", line 141, in get_component
    module = importlib.import_module(path)
  File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1467, in exec_module
  File "<frozen importlib._bootstrap>", line 1572, in get_code
  File "<frozen importlib._bootstrap>", line 1532, in source_to_code
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/home/homeassistant/.homeassistant/custom_components/media_player/ps4.py", line 7
    <!DOCTYPE html>
    ^
1 Like

Hello!

I need some help. Im trying to install ps4waker but i get this error:

pi@hassbian:~ $ npm install ps4-waker -g
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
/usr/lib
ā””ā”€ā”¬ [email protected]
ā”œā”€ā”€ [email protected]
ā””ā”€ā”¬ [email protected]
ā””ā”€ā”€ [email protected]

npm ERR! Linux 4.9.24-v7+
npm ERR! argv ā€œ/usr/bin/nodejsā€ ā€œ/usr/bin/npmā€ ā€œinstallā€ ā€œps4-wakerā€ ā€œ-gā€
npm ERR! node v7.10.0
npm ERR! npm v4.2.0
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access ā€˜/usr/lib/node_modulesā€™
npm ERR! { Error: EACCES: permission denied, access ā€˜/usr/lib/node_modulesā€™
npm ERR! errno: -13,
npm ERR! code: ā€˜EACCESā€™,
npm ERR! syscall: ā€˜accessā€™,
npm ERR! path: ā€˜/usr/lib/node_modulesā€™ }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR! /home/pi/.npm/_logs/2017-07-06T19_41_31_667Z-debug.log
pi@hassbian:~ $

Any ideas?
Thanks

Try sudo npm install ps4-waker -g

Thank you!

1 Like

Hello, another problem:

pi@hassbian:~ $ sudo ps4-waker
No credentials; Use Playstation App and try to connect to PS4-Waker

Do I need to have my ps4 connected with ethernet cable or is wifi ok?

Thank you!

First time you need to connect in your ps4 mobile app to ps4 waker.
If you run into some trouble also check if you have this enabled:
PS4ā„¢: Select Settings > Power Save Settings > Set Function Available in Rest Mode > Enable turing On PS4 from Network.

1 Like

Thank you!

Any idea why I canā€™t see any files in homepi folder? Im using samba.

This is from putty:

root@hassbian:/home/pi# ls -l
total 0
root@hassbian:/home/pi#

thank you!

No sorry i donā€™t know. i can see files. youā€™re sure it is not empty? Maybe you can try WinSCP to see what files should be there.

How can I use media_player.turn_on? Everytime I use it in an automation HA doesnā€™t start.

Wow, this is great. I just got myself a PS4 last weekend and came across this. Easy enough to setup, though I had one issue that I just could not find an answer to anywhere. Once I paired my PS4 to PS4-waker, everything worked as expected. The problem I had was that I could not find my credentials file anywhere.

After a lot of searching, I found a reply to a post of GitHub somewhere that someone .ps4-wake.credentials.json file was stored under the /root/ directory. Sure enough, thatā€™s where mine was also located. No other places mentioned in any documentation mentioned the file could be here. Copying that file to my HA config directory and everything works great now.

So for anyone looking for their .ps4-wake.credentials.json file, have a look in the following. It could be there.

/root/.ps4-wake.credentials.json

Thanks for this great component. Just wish there was something similar for my XB1.

3 Likes