PlayStation 5 Command Line Sensor Help - Command Failed/Empty JSON

I am trying to make a command line sensor from the output of this:

My best guess is that because after running the command it will say


(with cycling periods) before it displays the result, and that they may somehow be preventing it from getting the data

I always get “command failed” (or “Empty reply found when expecting JSON data”) and have tried countless variations/locations, value_templates etc… the sensor just comes up as Unknown in Dev/Tools/States

The result of the command is usually:

Device found: PS5-952 [PS5/MY_PS5_MACID]: Home Screen


Device found: PS5-952 [PS5/MY_PS5_MACID]: Standby


No Device found.

also, there is an option for JSON output but that is preceded by the “Device found: PS5-952 [PS5/MY_PS5_MACID]: Standby”, then the curly braces and json… So I’m not sure if that is why that doesn’t work either…

Device found: PS5-952 [PS5/MY_PS5_MACID]: Home Screen

My next best guess is that I may have to make some sort of Python Script to get the data…
but here is my last configs for the sensor/test sensor… They may not be in a proper state at the moment because I have tried 600 variations of template/value_template/json etc… I am just hoping I am missing some super simple way to get the data/wait for the output before trying to get the data etc…

- platform: command_line
  name: "PlayStation 5"
  command: "/srv/homeassistant/bin/ps5-wake -vP -H"
  value_template: {{ value }}
  # value_template: >-
  #     {%- if value == "No Device found." -%}
  #       Off
  #     {%- elif value == "Device found: PS5-952 [PS5/MY_PS5_MACID]: Home Screen" -%}
  #       On
  #     {%- elif value == "Device found: PS5-952 [PS5/MY_PS5_MACID]: Standby" -%}
  #       Standby
  #     {% else %}
  #       WTF-POOP
  #     {%- endif -%}
  scan_interval: 20
  command_timeout: 30

- platform: command_line
  name: "PlayStation 5 Test"
  command: "/srv/homeassistant/bin/ps5-wake -vP -H -j"
    - code
    - host_id
    - host_name
    - host_type
    - running_app_name
    - running_app_titleid
    - version
    - host_request_port
    - timestamp
    - fingerprint
  value_template: {{ value_json.code }}
  command_timeout: 30
  scan_interval: 20

Okay, so I was able to get this to work with 2 sensors, one for the JSON and a regular template. The JSON one suddenly had values in it as of last night…(it may have been a result of “Reload Command Line Entities” not working as it’s supposed to right now.) I also then found that the code has a verbose option as well which ends up having a better response every time except JSON wasn’t always in the result when off or in Standby before, just “No Device found.”…

Also there may be a more elegant way to do this to combine it into one sensor but I’m not sure how to accomplish that.

- platform: template
      friendly_name: PlayStation 5
      value_template: >-
        {%- if states('sensor.playstation_5_json') == "200" -%}
        {%- elif states('sensor.playstation_5_json') == "620" -%}
          Rest Mode
        {%- else -%}
        {%- endif -%}

- platform: command_line
  name: "PlayStation 5 JSON"
  command: "/home/homeassistant/.homeassistant/ps5-wake-master/ps5-wake -vP -H -j -v"
    - code
    - host_id
    - host_name
    - host_type
    - running_app_name
    - running_app_titleid
    - version
    - host_request_port
    - timestamp
    - fingerprint
  value_template: '{{ value_json.code }}'
  command_timeout: 30
  scan_interval: 20

Also, the running app title/running app name doesn’t seem to work.

1 Like

EDIT: update with standby

Thanks @Bartem

Here’s the sensors combined

  - platform: command_line
    name: Playstation
    command: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [email protected] 'cd ~/ps5-wake && ./ps5-wake -vP -H -j -v'
      ['code', 'host_id', 'host_name', 'host_type', 
      'running_app_name', 'running_app_titleid', 'version', 
      'host_request_port', 'timestamp', 'fingerprint']
    value_template: >
      {% if value_json.code == '200' | int %}
      {% elif value_json.code == '620' | int %}
      {% else %}
      {% endif %}
    scan_interval: 300

and for anyone who needs a “guide”

1. install “ps5-wake

ssh [email protected]
git clone
cd ps5-wake/
sudo make install
./ps5-wake -vP -B

2. If you want to be able to wake, install “PS Remote Play” on desktop

3. sniff ps remote with “Wireshark” when you connect, I used my ps5 ip as a filter

ip.addr ==


copy user-credential

4. ./ps5-wake -vW -394... -H


Thank you! I knew there was a way to do that as one sensor somehow!

Have you seen the “running_app_name” or “running_app_titleid” populate at all yet?

Nope. I wouldn’t get my hopes up.

Whilst this has been an interesting few hours, I’ve been unable to get any packet capture to show anything with “user-credential” in it.

I’ve tried Windows > PS5, Mac > PS5 and Android > PS5, with captures on the gateway, on the access point and on Window and Mac. Not a thing.

Everything on port 9302 is identical, regardless of capture point or client:


If there are any ideas, I’d greatly appreciate it if you shared them :slight_smile:

Edit: Switched from wired to WiFi. guess what’s working now? This makes no sense to me at face value, so I’ll dig some more and update my post.

Yup, looks like the ethernet NIC does not remain connected during sleep. I cannot see it in my Unifi Controller, the port itself has no link lights and it certainly is not responding to the official Remote Play apps on any platform nor PS5-waker.

Switching to WiFi (same network segment as wired), I can see that the wireless connection is maintained in rest mode via Unifi, and PS5 waker can see the device in standby mode. Whilst in WiFi mode I’m able to capture the user-credential data needed via TCPDUMP.

This is beyond dumb, but given the rest of the rest mode “quirks” that exist I’m not entirely surprised. I’ll see if I can send a bug report to Sony, but would be interested in hearing if you’re using ethernet or WiFi.

Anyone want to explain to a newbie how to make this work? I have a wifi fan i’d like to start and turn of whenever i start or turn of my ps5. Is there a way to do that easily with this?

How to make which part work? Did you install it and try the command?

Managed to get it working!

Im having issues waking my ps5 I have got my user cred’s but just doesn’t wake
using ./ps5-wake -vW -939XXXXXX -B any ideas?

Did you try the direct wake command with -H and IP address? I had trouble at first with the broadcast one, but it has since started working

Also, my particular credentials did not actually have the preceding hyphen, did you verify yours actually did have the hyphen before it?

Hi yes I also tried ./ps5-wake -vW -939XXXXXX -H 192.168.x.x With no luck, so I should try ./ps5-wake -vW 939XXXXXX -H 192.168.x.x?

What response do you get from it? Also add -v to the end for verbose mode and you may see a little more

Also, have you enabled remote play and tried connecting with the remote play app? I would put it in rest mode and open remote play from your phone or computer and make sure it is still waking up that way… (sorry I don’t remember off hand if those steps are in iharosi’s instructions)

What do you get when you just do the search and not try to wake it? Does it see your ps5

the commands find my ps5, I can wake it via remote play, the ps5 is set up correctly but only get “Sending Wake-up…” but doesnt wake the Ps5

Any chance you are using an EU PS5? I noticed an issue in the GitHub repo related to that… otherwise I have no idea what would be going on… do you think a firewall could be blocking something?

Ah yea thats probably my issue as I’m in New Zealand, whats the issue? Was there a workaround?

Yes I made this change also but still the same thing…

I just yesterday moved to HA Supervised and I’m not super familiar with all the quirks of using docker containers just yet, I’m assuming that’s where the ssh command comes in to execute this from container, but I’m having trouble figuring out where/how you did the ssh keygen…is that config/.ssh folder one you just created inside the Hassio dir or is that somewhere else?