PS5-MQTT: Control PlayStation 5 devices using MQTT

Hi All,

I’m currently migrating my Smart Home onto HA and slowly getting the various Integrations configured and working. However I’m struggling to get this working.

Using the default configuration I can start to Add-on but as soon as I open the web ui, I get “The add-on is not running. Do you want to Start it now?” When I click on START ADD-ON, I get another message asking me retry. In addition in the back ground I have the message “502: Bad Gateway”

Can anyone assist me with getting this working?

Thanks,

Garry

Hi,

I am strugling with the authentication. Every time I try to authenticate through the web ui, I receive the same message: “the connection to the server timed out” I tried through different pcs, browsers and even an android phone. Always the same message. Is the url broken? Is there any way of getting to the redirected URL (some workaround)?

Thanks for your help

Thank you! I am very happy with the result.
Schermafbeelding 2024-05-28 225102

2 Likes

Hi,

Since some time this error appears on and on again and add on stops reporting the playing states:

2024-05-29T10:02:20.899Z @ha:ps5:error SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at /app/server/dist/redux/sagas/check-devices-state.js:78:38
    at step (/app/server/dist/redux/sagas/check-devices-state.js:35:23)
    at Object.next (/app/server/dist/redux/sagas/check-devices-state.js:16:53)
    at next (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1161:27)
    at currCb (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1255:7)
    at runSelectEffect (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:735:5)
    at runEffect (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1208:7)
    at digestEffect (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1275:5)
    at next (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1165:9)
2024-05-29T10:02:20.904Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/5C9666DDD1C3
2024-05-29T10:02:40.935Z @ha:ps5:error SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at /app/server/dist/redux/sagas/check-devices-state.js:78:38
    at step (/app/server/dist/redux/sagas/check-devices-state.js:35:23)
    at Object.next (/app/server/dist/redux/sagas/check-devices-state.js:16:53)
    at next (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1161:27)
    at currCb (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1255:7)
    at runSelectEffect (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:735:5)
    at runEffect (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1208:7)
    at digestEffect (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1275:5)
    at next (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1165:9)
2024-05-29T10:02:40.939Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/5C9666DDD1C

I know, that in some posts before it is said, that this will recover but it does not! I must restart the add on and than everything works again. I haven’t change a thing in my setting so what is wrong? Can anyone help?

thx,
Zavjah

Hi,
Can I ask you how did you manage to do it for the whole button pls?

I use Measure It integration MeasureIt: Measure all you need based on time and templates!

I’m having the same problem as you. Can’t get past the “The connection to the server timed out”

Hello,

Here is my configuration :slight_smile:

I’ve nothing in the web UI :

I miss something ?

OK find… My PS5 was in sleep mode…

By following this post:

I’ve been fighting with the same issue for some time. What helped me:

  1. Incognito window
  2. In one tab - log in to store first. If an error remains on this step - don’t close this tab, give it some time & retry.
  3. After logging into the store, follow the redirect link from the add-on pop-up in the same incognito window.

Is it also possible to read which color LED is on the PS5 controller?

I’m experiencing some problems with the sensor - after the last update on the ps5 it didn’t want to show when it was in a game - it only says idle or awake :melting_face:

1 Like

I have the same problem… tried to re-auth and still nothing…

I too am unable to reauthenicate.
The hyperlink provided is no longer valid, so the instructions are unable to be followed :frowning:

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.