Playstation 4/PS4 custom component

media_player
Tags: #<Tag:0x00007f47fb0eef30>

#41

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


#42

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


#43

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


#44

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.


#45

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:


#46

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.


#47

In what directory does the file live in?


#48

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


#49

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


#50

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.


#51

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>
    ^

#52

Hello!

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

[email protected]:~ $ 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
[email protected]:~ $

Any ideas?
Thanks


#53

Try sudo npm install ps4-waker -g


#54

Thank you!


#55

Hello, another problem:

[email protected]:~ $ 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!


#56

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.


#57

Thank you!

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

This is from putty:

[email protected]:/home/pi# ls -l
total 0
[email protected]:/home/pi#

thank you!


#58

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.


#59

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


#60

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.