PS5-MQTT: Control PlayStation 5 devices using MQTT

Could not resolve host: supervisor

This tells me it’s running the startup script for HA Add-ons. Not the one for docker standalone.

I can’t make it work (and it used to)…

Did something in your volume setup or run.sh script change?

P.s. If you make an issue on GitHub please fill out the whole template. Logs like these make it 1.000.000 times easier to figure out what is going wrong.

not sure about the first comment re supervisor, the startup script has been the same the whole time (as per your docs) and it is working now

re issue - funnily enough, I tried a moment ago and it seems to be working now, i.e. shows activity on both accounts (btw. I wonder what happens if two users play at the same time, will test and let you know). I will close the issue for now (btw. I know logs are helpful, but opened issue from my mobile…)

the only errors I see in the log now are:

2023-04-17T05:57:44.154Z @ha:ps5:error config could not be read from 'undefined'

and:

2023-04-17T06:00:15.728Z @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)

Hi, thanks for the amazing plugin! :clap:
Everything is working fine, but the only problem I have is that the npsso token (for retreiving game data) expires after I put the PS5 in rest mode… and when I start the PS again the plugin tells me the token is not valid… I than retrive a new token and it works again till I finish gaming and put the PS5 in rest mode again.

Can you please help me resolve the problem?

hello there, i added the addon and everything working correctly.
just activity it shows me IDLE all the time!!
anyway to fix that

Thanks in advance.

Please read the docs… You need NPSSO to see your PSN activity. It needs renewal.

Great job buddy!!!
I was already thinking about the console power control to somehow make it work. You are a lifesaver for the gamer :wink:

1 Like

After couple months (i set up from February) i think stop working the game name and icon. While play a game it says “open” and not game icon and icon controller

type: custom:mushroom-template-card
primary: PlayStation 5
secondary: |-
  {% if is_state('sensor.ps5_activity', 'playing') %}
   Playing:
    {{ state_attr('sensor.ps5_activity','title_name')}}
  {%- elif is_state('sensor.ps5_activity', 'idle') -%}
    On
  {%- elif is_state('sensor.ps5_activity', 'none') -%}
    Sleep
  {%- elif is_state('sensor.ps5_activity', 'unavailable') -%}
    Off
  {%- endif -%}
icon: mdi:sony-playstation
entity: switch.ps5_power
picture: '{{state_attr(''sensor.ps5_activity'', ''title_image'')}}'
badge_icon: |-
  {% if is_state('sensor.s_ps5_activity', 'playing') %}
  mdi:controller
  {%- elif is_state('sensor.ps5_activity', 'idle') -%}
  mdi:menu
  {%- elif is_state('sensor.ps5_activity', 'none') -%}
  mdi:sleep
  {%- elif is_state('sensor.ps5_activity', 'unavailable') -%}
  mdi:power
  {%- endif -%}
badge_color: |-
  {% if is_state('sensor.ps5_activity', 'playing') %}
  green
  {%- elif is_state('sensor.ps5_activity', 'idle') -%}
  purple
  {%- elif is_state('sensor.ps5_activity', 'none') -%}
  orange
  {%- elif is_state('sensor.ps5_activity', 'unavailable') -%}
  red
  {%- endif -%}
icon_color: blue
tap_action:
  action: more-info
hold_action:
  action: toggle
layout: vertical

Any ideas?

Have you verified that all entities are behaving as expected? You can easily check entities states and attributes using the HA developer tools.

I’m thinking your NPSSO expired. Unfortunately, it only works for a couple of months.

I re-authandicate with URL and CODE from PS5 because I was thought that too. But it’s only AWAKE and CLOSE.

The web-ui will not display game state. Refer to the entities attributes in HA instead.

It’s not refer either to entities. I’m getting only awake…

  • Is the log showing any errors?
  • are your PSN accounts privacy settings “open” enough?
  • is your PSN account set to “online”?

Thanks for this great add-on, works perfectly fine. Have you any idea we can retrieve the Controller battery status and perhaps get controls working?

1 Like

Awesome add-on. A bit of work to set-up, but in the end it looks great:

PS5HA

I’m using media player template as custom component for this with the following in my configuration.yaml:

media_player:
  - platform: media_player_template
    media_players:
      playstation_5:
        device_class: tv
        unique_id: media_player.playstation_5
        friendly_name: "PS5"
        media_image_url_template: >
          {% if states('sensor.ps5_activity') == "playing" %}
            {{ state_attr('sensor.ps5_activity','title_image') }}
          {% endif %}
        turn_off:
          data_template:
            entity_id: switch.ps5_power
          service: switch.turn_off
        turn_on:
          data_template:
            entity_id: switch.ps5_power
          service: switch.turn_on
        volume_up:
          service: media_player.volume_up
          data_template:
            entity_id: media_player.onkyo
        volume_down:
          service: media_player.volume_down
          data_template:
            entity_id: media_player.onkyo                   
        current_source_template: "{{ state_attr('sensor.ps5_activity','title_name') }}"
        value_template: "{{ states('switch.ps5_power') }}"
        title_template: "{{ state_attr('sensor.ps5_activity','title_name') }}"
    
10 Likes
  • No
  • Yes
  • Yes

It works and just stopped…

Starting PS5-MQTT...
2023-05-14T23:39:39.454Z @ha:ps5:webserver Server listening on PORT: 62496
2023-05-14T23:39:39.481Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/5C9666253542
2023-05-14T23:46:20.860Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/5C9666253542
2023-05-14T23:47:50.888Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/5C9666253542
2023-05-14T23:54:42.520Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/5C9666253542

Am I right in thinking there’s no way to get media playing info from the PS5? I’d like to bring up my lights when I pause Netflix etc. TIA

Correct; non game activity information isn’t exposed by the Sony apis.

Thanks for the info

Hello!

I want to install it but, when I try to add repository, I get message that my setup is not good (I installed HA over with Python virtual environment).

Is there any way to setup this add-on?

Thanks a lot!
Claudio

Hi Guys!

I need help! I’m lost on how to get the NPSSO to a token… i was able to get my ssocookie by don’t know how to run does commands that the document talk about to get the token from the ssocookie! any help will be appreciated…