PS5-MQTT: Control PlayStation 5 devices using MQTT

Can we also get an unraid docker version in 2024? lol

1 Like

Hi, thanks. Im currently stuck here for some reason, I created the run.sh file but it says doesn’t exist, not sure what I did wrong I put the file in the same folder I made @FunkeyFlo


Any suggestions on those matters?

With regards to your device repeatedly becoming unavailable: this should only happen if the device can no longer be found on the specified network. Hence connectivity issues come to mind. I haven’t had any similar reports.

With regards to the template: I’m not quite sure what your asking. Could you be more specific?

Not sure either. I’m not familiar with unRAID so I can’t help you out with that.

I can tell you that the next update will most likely eliminate the need for the custom run.sh, so that might make things a little easier

1 Like

Sweet! I will wait for the next update then because I think the only problem I have after following the guide you gave is it just can’t find the run.sh file.

I will check the connectivity issues, but I dont think that this is the issue. Thanks for the advice though.

in the Template matter.
following your instructions i have created this:
image
I’m wandering how I can change the Black Circular Icon when the PS is off to show the PS logo instead.

Add a condition to the picture attribute of the card that returns your image if there is no entity picture available. (On my phone right now so can’t really type any (pseudo) code).

1 Like

For future noobs like myself, regarding this, it was easier than I imagine. all it took was to replace it with the mdi:sony.playstation icon

1 Like

I started a little experimenting with this yesterday. I’ve setup a very simple automation triggered by device. The automation:

  • Sets a light scene when the PS5 turns on (before sunset)
  • If before sunset it pulls up the curtains
    When the PS5 turns off:
  • If before sunset the curtains go back up
    The problem is with the second part. The addon is not picking up the PS5 being powered off but in the logs i can see “unavailable”. This is not a state that can be used in this automation so it’s not triggered. Any suggestions how to make the second part work?

Create a template sensor that interprets unavailable as off, etc.

LOL that is not as obvious as you make it seem if you just started with all this a few days ago :smiley:

anyway i figured it out. PS5 in rest mode=powered off. Doesn’t make sense to me but this is reported in the logbook. So with the minimum power it uses the solution i guess is to always keep the PS5 in rest mode OR as you suggested tweak HA to be able to use unavailable. I wouldn’t even know where to start to make a template sensor but i’ll look into that at a later time.
Maybe a suggestion for the documentation? To say what states report as what in the logs?

The Playstation being off is, from a software point of view, unavailable. This was a very conscience decision. This is because the device can not be reached. A.k.a. it could have lost connection to your network, etc. and there would be no way to know.

This is also the same type of behaviour that is used in the “official” ps4 integration.

For the template sensor you could try something like the following (pseudo code).

sensor:
  - platform: template
    sensors:
      interpreted_state_sensor:
        friendly_name: "Interpreted State"
        value_template: >-
          {% if is_state('your_entity_id', 'unavailable') %}
            off
          {% else %}
            {{ states('your_entity_id') }}
          {% endif %}

P.s. I would advise against using something like that.

Maybe a suggestion for the documentation? To say what states report as what in the logs?

PR’s are always welcome :hugs:

I understand the conscience decision from a engineering POV. I work with engineers but aren’t one so it took me some time to follow the logic. To me rest mode would be standby and it would make sense if the entity presented the option for standby. OR the docs would mention power off would present as unavailable. But maybe for the power user i am talking rubbish like the homeassistant n00b i am :slight_smile:

If you don’t recommend using a template how do you use it yourself? Do you leave the PS5 in rest mode?

Do you leave the PS5 in rest mode?

Yes. Otherwise my automations won’t be able to control the device at all times.

1 Like

Hi,

just installed this add-on following the instructions provided. I am not getting any Entities beside the “update.ps5_mqtt_update” sensor:

  1. I’ve installed the Add-on using the “add repository” button from the GitHub page
  2. I’ve configured the MQTT as per screenshot below
  3. I’ve started the add-on and I’ve launched the Web-UI which finds my PS5 and it sees that it is AWAKE
  4. I’ve authenticated using my Sony PlayStation account credentials and I’ve generated the PIN code for pairing.
  5. I then check the Add-on logs and this is what I see (I’ve replaced all the IDs with “X”)
Starting PS5-MQTT...
2023-08-18T12:02:14.356Z @ha:ps5:webserver Server listening on PORT: 63281
2023-08-18T12:02:14.377Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/XXXXXXXXXXXX
2023-08-18T12:02:17.354Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/XXXXXXXXXXXX
2023-08-18T12:06:07.210Z @ha:ps5:webserver connecting to device: 'XXXXXXXXXXXX'
2023-08-18T12:07:49.548Z @ha:ps5:webserver connecting to device: 'XXXXXXXXXXXX'
2023-08-18T12:07:50.229Z @ha:ps5:webserver:playactor Registering with device via Remote Play.
2023-08-18T12:07:50.229Z @ha:ps5:webserver:playactor Go to Settings > System > Remote Play > Link Device
2023-08-18T12:07:50.230Z @ha:ps5:webserver:playactor Enter PIN here> 
2023-08-18T12:07:50.379Z @ha:ps5:webserver:playactor {
  'app-type': 'r',
  'auth-type': 'R',
  'client-type': 'vr',
  model: 'w',
  'user-credential': 'XXXXXXXXXX',
  accountId: 'XXXXXXXXXXXX',
  registration: {
    'AP-Bssid': 'XXXXXXXXXX',
    'AP-Name': 'PS5',
    'PS5-Mac': 'XXXXXXXXXXXX',
    'PS5-RegistKey': 'XXXXXXXXXXXXXXXX',
    'PS5-Nickname': 'PS5',
    'RP-KeyType': '2',
    'RP-Key': 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
  }
}
  1. After that, no entities are being automatically generated and thus no sensors or anything useful is being created.

Any help on this will be greatly appreciated!

Is mqtt discovery enabled?

1 Like

Hi,

yes, it’s enabled:

  • Have you tried restarting home assistant?
  • You could try removing the mqtt config. By doing so the add-on will automatically receive the config for your mqtt broker through HA itself.
1 Like