PS5-MQTT: Control PlayStation 5 devices using MQTT

Thanks for quick reply. But the power on / off only turns the console off, does not turn it on and activity shows no more than this (image)

I used npsso authentication as well…

I also see this in the logs:

2022-08-31T20:42:07.628Z @ha:ps5:error SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at /app/server/dist/redux/sagas/check-devices-state.js:75: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)

Got it, I thought we had to run the code on the psn-api site to get the access/refresh code. My activity wasn’t showing initially however after deleting from mqtt and readding it is now showing thanks!

For activity:
Check that your privacy settings aren’t too strict, I think you have to set Game activity or something to public. Someone ran into this issue on the GitHub issues/discord. Can’t quite remember.

For turning on:
Check that all required remote play features are enabled as mentioned in the Docs.

As for the error:
the error you’re receiving occasionally occurs when checking device state and should recover automatically. A device scan interval of at least 3000ms is recommended as it will limit the chance of this error occuring.
This isn’t related to the issues mentioned above.

2 Likes

Thanks again. I sorted power on/off.

I changed game activity to public (everyone) but still no luck in getting the status. I only have the same two sensors and no info on games that are being played.

For people still looking for an example of how to use the entities with a Custom Button Card refer to
this message from the Discord.

The templates used originate from @Mattias_Persson’s project.

Hello, thanks for the integration of the PS5. It runs so far everything wonderfully only I hang a little on the CustomCard to display the current games. Has anyone had any success here and likes to share their code?

I also had problems between idle and playing, you have to be displayed on the PS5 as online or busy, then the display also changes from idle to playing. If you are displayed as offline, this does not work.

this was it! thank you very much.

the only last thing I noticed is that when I turn the console via the button, the console turns on but the TV does not (I have LG TV). If I press a button on the controller - the TV turns on. Weird.

That’s because the Remote Play protocol is used to turn on the console. You probably don’t want to to turn on the tv when using that feature :wink:

1 Like

But turning on the console only works from sleep mode, doesn’t it? If I turn off the console completely, it will be displayed as unavailable in HA

Yes, another limitation of the remote Play protocol. :grin:

Thanks. Now I’m fighting with card config but that’s another matter :smile:

1 Like

Easiest solution is probably using a mushroom template card :sunglasses:

Thanks, tried it but reverted back to the custom button card.

On another note, can you authenticate multiple users?

[EDIT] I tried separating ‘PSN_ACCOUNTS’ environmental variable by comma, but it did not work

[{"username": "username1", "npsso": "npsso1"}, {"username": "username2", "npsso": "npsso2"}]

That does seem to be the correct way. I’m assuming you’re running on docker?

If the issue persists you can create an issue on GitHub.

Hi! I have configurated it correctly (I think), copied even the npsso code. But when I add the addon on my dashboard, there are no entity i can use, except for the update.ps5_mqtt_update

What I have to do now to add more entity? (the image, the turn on/off button and so on).

Sorry but im new in the HA world :smiley:

Do you have an MQTT broker installed? Is the add-on logging any errors?

I’ve installed mosquitto broker, this is the code in my dashboard.
In the log there is no error :frowning:

Hi, I’ve installed this add-on according to instructions and it works fine except for the activity title attribute. It only shows game titles, not app titles. Am i missing something?

Is your PS5 called “ps5”? Usually the (default) name is something like “PS5-087”. That will be the “prefix” for the activity and power entities.