PS5-MQTT: Control PlayStation 5 devices using MQTT

Good to know, I’ll try and get an update out somewhere this week! For future cases: feel free to create a GitHub issue for any bugs! :purple_heart:

2 Likes

Hi there,

I’ve set up PS5-MQTT with Home Assistant and most things are working great. However, I’ve noticed that the game title and game image are not being displayed, even though I’ve followed all the setup steps carefully. Here’s what I’ve done so far:

  1. Adjusted my PlayStation Network profile’s privacy settings to make game activity visible.
  2. Retrieved a valid NPSSO token and configured it in secrets.yaml.
  3. Authorized the integration using Remote Play with my PS5 (successfully connected and authenticated).
  4. Verified that MQTT messages are being sent and received (other device states like power status are working perfectly).

Despite all this, the game title and game image just don’t show up in Home Assistant.

sensor.ps5_512_activity:
power: AWAKE
device_status: online
activity: idle
friendly_name: PS5-512 activity

Starting PS5-MQTT...
2024-11-22T20:50:52.009Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/0C7043751C7E
2024-11-22T20:50:52.080Z @ha:ps5:webserver Server listening on PORT: 64605
2024-11-22T20:50:55.082Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/0C7043751C7E
2024-11-22T20:51:13.257Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/0C7043751C7E/set/power
2024-11-22T20:51:18.294Z @ha:ps5:turnOnDevice 
2024-11-22T20:51:18.311Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/0C7043751C7E
2024-11-22T20:51:28.281Z @ha:ps5:checkDevicesState Resume polling
2024-11-22T20:56:31.065Z @ha:ps5:checkDevicesState Update HA
2024-11-22T20:56:31.078Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/0C7043751C7E
Received 21:36:43
QoS: 0
Payload: power: AWAKE
device_status: online
activity: idle
Received 21:41:56
QoS: 0
Payload: power: STANDBY
device_status: online
activity: none
Received 21:42:30
QoS: 0
Payload: power: UNKNOWN
device_status: offline
activity: none
Received 21:42:37
QoS: 0
Payload: power: STANDBY
device_status: online
activity: none
Received 21:50:55
QoS: 0
Payload: power: STANDBY
device_status: online
activity: none

mqtt:
  host: XXX
  port: 1883           
  user: !secret mqtt_user
  pass: !secret mqtt_password

psn_accounts:
  - username: "USERNAME"
    npsso: !secret my_npsso
    preferred_ps5: "70C881D600B0" 

device_check_interval: 5000         
device_discovery_interval: 60000    
account_check_interval: 5000       

include_ps4_devices: false        
logger: @ha:ps5:*              

Hi,

Plase, can you help me? Im just starting use the HomeAssistant and I try use Fusion, plase who can help me? I try show the image game playing and show the game name.

but I cant fix it.

theme: godis
views:
  - name: Visão geral
    id: 7802388379271
    sections:
      - name: Seção
        items:
          - id: 539282401107
            type: conditional_media
            entity_id: sensor.ps5_activity
            media_players:
              - entity_id: media_player.tv_sala
        id: 927497525685
sidebar: []
hide_views: false
hide_sidebar: false

I did it.

- id: 4923422014200
                type: button
                entity_id: switch.ps5_power
                template:
                  state: |
                    {% if is_state('switch.ps5_power', 'on') %}
                      {{ state_attr('sensor.ps5_activity', 'title_name')
                        or states('sensor.ps5_activity')
                      }}
                    {%- else -%}
                      {{ states('switch.ps5_power') }}
                    {%- endif -%}
                  icon: |
                    {% if is_state('sensor.ps5_activity', 'playing') %}
                      {{state_attr('sensor.ps5_activity', 'title_image')}}
                    {%- elif is_state('sensor.ps5_activity', 'idle') -%}
                      mdi:sleep
                      
                    {%- endif -%}
                name: Playstation 5
                more_info: false```

Hi FunkeyFlo,

Thank you for all of your hard work to make this happen. I just purchased a PS5 Pro, and followed your instructions. I am now able to turn the PS5 Pro on and off using HomeAssistant!

However, when I turn it on, the PS5 Pro controller does not turn on, which means the PS5 Pro is not able to complete its process. It never turns on the TV (Sony XR-77A80L).

Instead, I have to press the PlayStation button on the controller. Then the TV immediately comes on.

I made an automation to turn the TV on 5 seconds after the PS5 Pro is turned on, but it would be nice to have the controller turned on, so this happens automatically.

Am I doing something wrong? Is there some other setting I need to configure?

Thanks in advance!

As far as I know, it is generally not possible to switch on the controller remotely.

OK, thank you for the response. Then I will rely on my automations to turn the TV on, and then push the PlayStation button on the controller.

Finally got this working on Unraid thanks to help from someone on Discord, only problem I can’t figure out now is I can’t see the entity in home assistant.

Basically it actually did originally show up in home assistant but the power toggle wasn’t working so I decided to remove it then try re-adding it, so It’s clearly connected via the MQTT side but… it won’t show up again in Home Assistant so Im not sure what to do tbh, I thought it would just come back via MQTT after I removed it but it doesn’t seem to be unfortunately…

I’m trying hard but still:

2024-12-03T14:21:16.983Z @ha:ps5:error Error:
There was a problem retrieving your PSN access code. Is your NPSSO code valid?
To get a new NPSSO code, visit https://ca.account.sony.com/api/v1/ssocookie.
(…)
2024-12-03T14:21:16.984Z @ha:ps5:error Account ‘moritz15’ retrieval failed. Activity for this account will not be tracked.

Of course, I doublechecked everything and it should be correct…
What am I missing here? Thx!

What was the solution for getting it working on Unraid?

edit: copy the run-standalone.sh file from github to your config directory. Extra Parameters: --entrypoint=“/config/run-standalone.sh”

1 Like

Anyone else seeing that this container is taking ~100MB of RAM? Sounds much more than I would expect

Yes, docker container stats is showing typical 85MiB, up to 105MiB at times.

I’ve set up PS5-MQTT with Home Assistant and I’m able to get discover my PS5 and get the two entities. However, there is something that is not quite clear to me:

  1. Does the PS5 have to be either On or in Rest Mode for the integration to work? (when the PS5 is off I’m only getting unavailable status).
  2. Does turning the PS5 off (from the MQTT entity) means putting it into Rest Mode or turning it off completely?

Also I am getting an error message when trying to power on or off the PS5:

I get this when trying to turn it on from rest mode:

Device PS5-401 must be awak2024-12-09T21:44:21.225Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/5C96664DA28E/set/power
2024-12-09T21:44:21.734Z @ha:ps5:error Error: Device PS5-401 must be awake for initial registration
    at CredentialManager.<anonymous> (/usr/local/lib/node_modules/playactor/dist/credentials.js:30:23)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/playactor/dist/credentials.js:5:58)
2024-12-09T21:44:32.731Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/5C96664DA28E/set/power
2024-12-09T21:44:33.405Z @ha:ps5:error Error: Device PS5-401 must be awake for initial registration
    at CredentialManager.<anonymous> (/usr/local/lib/node_modules/playactor/dist/credentials.js:30:23)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/playactor/dist/credentials.js:5:58)
2024-12-09T21:44:47.733Z @ha:ps5:checkDevicesState Resume polling

And this when trying to turn it off:

2024-12-09T21:58:08.780Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/5C96664DA28E/set/power
2024-12-09T21:58:09.234Z @ha:ps5:error Error: Not authenticated
    at RejectingCredentialRequester.<anonymous> (/usr/local/lib/node_modules/playactor/dist/credentials/rejecting-requester.js:24:19)
    at Generator.next (<anonymous>)
    at /usr/local/lib/node_modules/playactor/dist/credentials/rejecting-requester.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/usr/local/lib/node_modules/playactor/dist/credentials/rejecting-requester.js:4:12)
    at RejectingCredentialRequester.requestForDevice (/usr/local/lib/node_modules/playactor/dist/credentials/rejecting-requester.js:23:16)
    at CredentialManager.<anonymous> (/usr/local/lib/node_modules/playactor/dist/credentials.js:32:54)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/playactor/dist/credentials.js:5:58)
2024-12-09T21:58:23.786Z @ha:ps5:checkDevicesState Resume polling

Am I missing something? I have enabled the Remote Play settings in my PS5.

on the web ui for ps5-mqtt, did you click the Authenticate button on the bottom left corner (while ps5 is powered on)?