Custom PS3 Integration: Issues with notify platform

Hi everyone,

I am currently developing a custom component to integrate Playstation 3 systems with custom firmware installed into Home Assistant. I am currently setting up the notify platform to send notifications to the Playstation 3 (pop-up messages in the top right corner).

However, I am having some issues. When setting up my Playstation 3 with the component in my devcontainer, the log tells me that the notify platform has been set up succesfully.

However, when I try to call the service from the UI I get the following message:

Do I still need to set something up? Did I do something wrong in my code? The repo and branch can be consulted here: https://github.com/SDR3078/PS3MAPI/tree/notifications

config_flow.py: ps3-home-assistant/custom_components/PS3MAPI/config_flow.py at c34cacfcfaca88784670e87fd27f8c6ed0a4fb5f ¡ SDR3078/ps3-home-assistant ¡ GitHub

init.py: ps3-home-assistant/custom_components/PS3MAPI/__init__.py at c34cacfcfaca88784670e87fd27f8c6ed0a4fb5f ¡ SDR3078/ps3-home-assistant ¡ GitHub

notify.py: ps3-home-assistant/custom_components/PS3MAPI/notify.py at c34cacfcfaca88784670e87fd27f8c6ed0a4fb5f ¡ SDR3078/ps3-home-assistant ¡ GitHub

EDIT: I have decided to delete the branch and start development on the notify platform again, I will update this post

You should have a services.yaml file and i wonder if it actually didnt set it up because this is missing.

EDIT: scrap that. It maybe that your domain name should be lowercase not uppercase. As the error is lowercase.

Changed everything to lower case and I am unfortunately getting the same error:

Even in the logs:

Unfortunately it did not help :frowning:

Just commenting for the moment I am excited for this and will test it.
Have you tried running it in production?

What will the integration do?

1 Like

Hi! Cool that you’re interested!

The integration will be able to pair PS3 systems with Home Assistant. The PS3 needs to have custom firmware (jailbreak) and the webMAN mod installed as this exposes a web server on the PS3 over which we can send commands to the system.

The integration is currently in early stages of development. I’ve ran it for extended periods of time on a devcontainer linked to my own PS3 system. It currently supports reading cpu temps, gpu (rsx) temps and fan speeds which it will register and show under sensor entities in Home Assistant. I’ve also managed to set up a config flow so that the integration can set up entities fully through the UI with validation.

The first functionalities I want to add and I am currently working on are:

  • Notification support: Already implemented it on the PlayStation side, the integration will show a notification on the PS3 when it paired successfully. I am just struggling with setting up a notify service as you can read in the post.
  • Turning PS3 on and off from Home Assistant
  • Fan control: choosing one of the presets to manage fan speed
  • Launching games

These are just some initial ideas, but there are lots of possibilities as webMAN exposes quite a lot of functionalities on the PS3.

Anyway, that’s the summary, just hoping I’ll manage to get the notify platform set up soon! :grin:

I am especially interested in on-off by the way, and what are you using to implement the integration?

I have the original 60gb full backwards hardware compatible with 4.90 CFW (SO The good one, lol)

I think especially with harmony mostly gone, many are also interested in on / off. The other features are definitely cool! Let me know what I can do, I’ve made some custom add-on and integrations

What do you mean when you’re asking what I will use to implement the integration? If you’re asking what I’m using to communicate with the PS3 system, I also wrote an API wrapper which can be found inside of the repo :slight_smile:.

Turning the system off will be an easy functionality to implement as webMAN has a command for that. To turn the system on, I will be experimenting with WoL messages, so one of the requirements for this functionality will be that the PS3 has remote play enabled.

You can always help me by trying to figure out what this notify platform issue is so I can solve it :smiley:

Ok, so had some more time to look at your code and think I understand why your notifications were not working.

  1. You were checking if discovery_info was None in notify.py and not creating the service if it was - and it would have been.
  2. Your device name is the IP/hostname of the PS3 as set by title in config flow, therefore your notify service would have been called notify.[IP/hostname]
  3. The way you had created your DataUpdateCoordinator meant that outside of the coordinator callback, you could not pass your api wrapper object around. If you had fixed 1 above, this would have errored.

I have made a few tweaks for you to make it work (will need the notify send_message function completing) and will send this to you as a PR.

Hope it helps.

EDIT: sorry i think i recalled 1 incorrectly, couldnt check as you removed from your repo. Maybe just 2 was the issue?

Hey! I appreciate your efforts and improvements a lot! I will have a look at the code tomorrow and test it, keep you updated! :slight_smile:

@msp1974 your code looks very promising! There are still some things that need to be changed, so for the moment I merged your PR into the notify_service branch of the project, after it is fully functional I will merge it into main!

Notify platform is ready! I will merge it into main tomorrow!

1 Like

@SDR3078 Wow, I just stumbled across your custom component and I can’t wait to try it out. I always hoped for webman mod to support mqtt since it already had good http endpoints. I also was sure that it must be possible to use the ps3mapi in exactly this way. In fact I used mapi in combination with an android app “macrodroid” to send notifications to my kids PlayStation to hand over the controller to the next sibling after a certain period. I even went as far as to shut down the PlayStation after their limit was exceeded.
For you putting together what I always dreamed of is refreshing and always has been a missing piece in my device/home automation list.
Since you are using ps3mapi, provided by webmanmod, on the PlayStation side to control the ps3 it should be worth mentioning your PlayStation only needs HFW and ps3hen. Of course, CFW is always better.
Have you considered posting over at psx-place once your component reaches a state you are satisfied with?

Greetings from Dunkelschunkel

Hi @SDR3078

I have setup your custom component and the ps3 is displaying a notification “registration successful”. Yet it shows the error message, that setup failed an will be retried. HA-Log shows me this bit of Information:

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.ps3
Quelle: helpers/update_coordinator.py:318
Integration: PlayStationÂŽ 3 (Dokumentation)
Erstmals aufgetreten: 16:51:30 (8 Vorkommnisse)
Zuletzt protokolliert: 16:53:25

Unexpected error fetching ps3 (None) data: list index out of range
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 318, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ps3/__init__.py", line 77, in _async_update_data
    await self.wrapper.update()
  File "/config/custom_components/ps3/API/PS3MAPI.py", line 68, in update
    await self._update()
  File "/config/custom_components/ps3/API/PS3MAPI.py", line 31, in _update
    self._rsx_temp = temperature_text.split(': ')[3].split('°C')[0]
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

I am willing and eager to test, to change, to provide any information you deem necessary.

Dunkelschunkel

Hi @Dunkelschunkel! Thanks for the feedback! That was indeed an error that came up with certain fan modes. Could you try to clone the repo in the fan_platform branch? It should work like that! I am doing some work on fan control and fixed the error there, but did not merge into main just yet.

Hi @SDR3078,

it is working with the fan_platform branch. 1 log entry is thrown by HA:

Logger: homeassistant.components.climate
Quelle: components/climate/init.py:361
Integration: Klima (Dokumentation, Probleme)
Erstmals aufgetreten: 13:25:11 (5 Vorkommnisse)
Zuletzt protokolliert: 13:38:00

Entity None (<class ‘custom_components.ps3.climate.TempRegulator’>) implements HVACMode(s): off, cool and therefore implicitly supports the turn_on/turn_off methods without setting the proper ClimateEntityFeature. Please report it to the author of the ‘ps3’ custom integration

Thus said, I am able to control the climate entity and set different fan modes accordingly. Even the fan speed slider is working.

One minor oddity I was observing, on the ps3-Integrations pane in HA it says no devices or entities are associated with my PlayStation yet under the entities tab in HA they are there.

The notification service has been created and works

Dunkelschunkel

Hi @Dunkelschunkel ,

Awesome to hear that the notification service works! I did not make any documentation yet, but you can change the sound and the icon of the notification by defining the icon and sound parameter under data with an integer as value when you define your notification!

To answer on your other questions:

  1. The log entry is indeed a bug but a fix was proposed here: Custom PS3 Integration: Issues with climate platform - #2 by msp1974. I will implement it ASAP!

  2. The entities not being linked to the device is because of something called the device registry. I am not implementing any logic concerning that right now, first trying to get all the necessary entities, but I will be fixing that later!

For the next step, I’ll be focusing on implementing a media player entity, so you can monitor which games are being played and even launch them. Keep sending me feedback and functionalities you want implemented, thanks for testing the integration! :smiley:

1 Like

Hi @SDR3078,

That was quick. Thank you for taking time to answer my questions to that extent. In a couple of days I am able to test at my heart’s content and give some more feedback. Since you are using the ps3mapi as the basis for your notification service I deduct I’ll be good with the sounds and icons from the webman-mod documentation, specifically Web Commands · aldostools/webMAN-MOD Wiki · GitHub.

A media player component sounds awesome. You are going to pull a game list and present it as a library? Or will it be a drop-down list from which you’ll be able to choose a game?

Thank you for all your efforts. I am only able to appreciate what others have invented.
I have 3 x ps3 systems to choose from. One cfw phat, one cfw slim and one hfw super slim. So I’ll be able to test some and then some more.

Dunkelschunkel

Hi @Dunkelschunkel , after a holiday I have been working on the media player entity and the code can now be found in the media_player branch. It is by far finished but it already detects which games are being played and they can be stopped with home assistant. The sounds and notifications are indeed the same as those found in the web commands! Thanks a lot for testing :smiley:

Hi @SDR3078,

that are indeed good news. At first glance I do see the game-id and the title. The player progress-bar is showing the elapsed time for which it has been played since it has been started. I am also able to use a dashboard media card “Mini Media Player” to get some controls working albeit it is just the stop-button that is working - no fast forward sadly ;-).

Have you thought about displaying the covers of the game that’s playing? Webman has some default cover-paths for games. Assuming you have the coverpack installed it looks like this

http://ps3.lan/dev_hdd0//game/BLES80608/USRDIR/covers/BLES01328.JPG

Alternatively I do believe the icon of the mounted game also has a unique path to it which gets update every time I mount a new game regardless if it is a PS3ISO or a JB-Gamefolder.

http://ps3.lan/dev_bdvd/PS3_GAME/ICON0.PNG

Would any of this be a good source for a covers or icons?

There could be some P

I also tested the sound and icon parameters,

icon: 0-9
sound: 0-50

They do work perfectly.

I hope you had a nice holiday. Keep up the good work

p.s.: Since this thread is technically closed I don’t get notifications for it. Community-rules also state we should start a new topic.

@Dunkelschunkel, thanks for the heads up! Discussions regarding testing and development can be continued under the following topic: Custom PS3 Integration: Testing & Development - #2 by SDR3078