Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New script: ps5-mqtt #1198

Merged
merged 21 commits into from
Jan 9, 2025
Merged

New script: ps5-mqtt #1198

merged 21 commits into from
Jan 9, 2025

Conversation

liecno
Copy link
Contributor

@liecno liecno commented Jan 3, 2025

✍️ Description

Add scripts for PS5-MQTT, useful then using home-assistant core scripts.


🛠️ Type of Change

Please check the relevant options:

  • Bug fix (non-breaking change that resolves an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change unexpectedly)
  • New script (a fully functional and thoroughly tested script or set of scripts)

✅ Prerequisites

The following steps must be completed for the pull request to be considered:

  • Self-review performed (I have reviewed my code to ensure it follows established patterns and conventions.)
  • Testing performed (I have thoroughly tested my changes and verified expected functionality.)
  • Documentation updated (I have updated any relevant documentation)

@liecno liecno requested a review from a team as a code owner January 3, 2025 16:14
@github-actions github-actions bot added new script A change that adds a new script website A change to the website labels Jan 3, 2025
@liecno liecno changed the title Add ps5-mqtt script New script: ps5-mqtt Jan 3, 2025
ct/ps5-mqtt.sh Show resolved Hide resolved
ct/ps5-mqtt.sh Outdated Show resolved Hide resolved
ct/ps5-mqtt.sh Show resolved Hide resolved
ct/ps5-mqtt.sh Outdated Show resolved Hide resolved
install/ps5-mqtt-install.sh Outdated Show resolved Hide resolved
install/ps5-mqtt-install.sh Outdated Show resolved Hide resolved
install/ps5-mqtt-install.sh Outdated Show resolved Hide resolved
install/ps5-mqtt-install.sh Outdated Show resolved Hide resolved
install/ps5-mqtt-install.sh Outdated Show resolved Hide resolved
json/ps5-mqtt.json Outdated Show resolved Hide resolved
@michelroegl-brunner
Copy link
Member

Looks mostly good to me, please remove all blank lines in the msg_info blocks, then it should be good to go.

@liecno
Copy link
Contributor Author

liecno commented Jan 3, 2025

Looks mostly good to me, please remove all blank lines in the msg_info blocks, then it should be good to go.

removed the empty lines in 664f28a. 🚀

ct/ps5-mqtt.sh Outdated Show resolved Hide resolved
ct/ps5-mqtt.sh Outdated Show resolved Hide resolved
ct/ps5-mqtt.sh Show resolved Hide resolved
ct/ps5-mqtt.sh Outdated Show resolved Hide resolved
ct/ps5-mqtt.sh Show resolved Hide resolved
install/ps5-mqtt-install.sh Outdated Show resolved Hide resolved
install/ps5-mqtt-install.sh Show resolved Hide resolved
install/ps5-mqtt-install.sh Outdated Show resolved Hide resolved
install/ps5-mqtt-install.sh Outdated Show resolved Hide resolved
install/ps5-mqtt-install.sh Outdated Show resolved Hide resolved
@liecno liecno requested a review from MickLesk January 6, 2025 17:01
@MickLesk MickLesk merged commit 8dd43dd into community-scripts:main Jan 9, 2025
4 checks passed
@Kirbo
Copy link

Kirbo commented Feb 4, 2025

Not sure where to post this.

I got the ps5-mqtt installed as it was supposed to, then I modified the nano /opt/.config/ps5-mqtt/config.json as supposed to (added MQTT settings, npsso), restarted container, accessed web UI, didn't get any devices (I have PS4 and PS5, both powered on) and my credentials.json isn't created..
image

Then I tried for the lulz running this again:

apt update ; apt upgrade ; apt-get clean ; apt-get autoremove ; bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/ps5-mqtt.sh)"
Kapture.2025-02-04.at.12.17.58.mp4

Is this intended behavior?

Checking from https://github.com/community-scripts/ProxmoxVE/blob/main/misc/build.func#L852 that what's going on (as I occasionally got an error pointing to this line)

http://api.htl-braunau.at/upload/updatestatus
image

@liecno
Copy link
Contributor Author

liecno commented Feb 4, 2025

I would try to break this down:

  1. no connection to PS
  2. 502 when running update / updatestatus request

regarding 1.)
ps5-mqtt seems to start without problems, since you're able to access the webinterface. Is your PS5 powered on and within the same subnet/network as your container? if they're in different subnet, you could use the device_discovery_broadcast_address setting within the configuration file to fix this.

regarding 2.)
this has nothing to do with this script, but with the post_update_to_api function. Did you overwrite any environment variables? The request to http://api.htl-braunau.at/upload/updatestatus does not make any sense for me, since this should be a request to github. nonetheless, this error should not impact the ps5-mqtt service.

this is not the best spot to get support. you can write me on discord if you need further help.

@Kirbo
Copy link

Kirbo commented Feb 4, 2025

I would try to break this down:

  1. no connection to PS
  2. 502 when running update / updatestatus request

regarding 1.) ps5-mqtt seems to start without problems, since you're able to access the webinterface. Is your PS5 powered on and within the same subnet/network as your container? if they're in different subnet, you could use the device_discovery_broadcast_address setting within the configuration file to fix this.

regarding 2.) this has nothing to do with this script, but with the post_update_to_api function. Did you overwrite any environment variables? The request to http://api.htl-braunau.at/upload/updatestatus does not make any sense for me, since this should be a request to github. nonetheless, this error should not impact the ps5-mqtt service.

this is not the best spot to get support. you can write me on discord if you need further help.

  1. yes, PS5 was on, both are in same subnet/vlan and I also tried setting the device_discovery_broadcast_address but that didn't help either.
  2. I know this has nothing to do with ps5-mqtt, directly, but (if I'm not completely incorrect) indirectly it has something to do with the installer script. I might be completely wrong, but I started debugging from here https://github.com/community-scripts/ProxmoxVE/blob/main/ct/ps5-mqtt.sh#L69 it is trying to run this start script, which is defined in here https://github.com/community-scripts/ProxmoxVE/blob/main/misc/build.func#L1051 and at the end of that function it calls the post_update_to_api which fails on line 850-852 https://github.com/community-scripts/ProxmoxVE/blob/main/misc/build.func#L850
  RESPONSE=$(curl -s -o response.txt -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
      -H "Content-Type: application/json" \
      -d "$JSON_PAYLOAD")

..and since that fails, it wont continue the installer script to the next step which is build_container (https://github.com/community-scripts/ProxmoxVE/blob/main/ct/ps5-mqtt.sh#L70) which is defined here https://github.com/community-scripts/ProxmoxVE/blob/main/misc/build.func#L1074, so the rest of the script https://github.com/community-scripts/ProxmoxVE/blob/main/ct/ps5-mqtt.sh starting from line 70 wont be executed.

But as I said, I might be completely wrong. But if I'm not, doesn't the installer script leave bunch of stuff incomplete, so is my installation even completely complete..? 🤔

@Kirbo
Copy link

Kirbo commented Feb 4, 2025

I mean.

  1. execute this on the Proxmox host: bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/ps5-mqtt.sh)" -> it will install the new container
  2. open the shell for the new container and execute bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/ps5-mqtt.sh)" -> shouldn't this try to update the container and execute successfully, instead of exiting with an error?

well, now that I tried it again, now the step 2 wont fail anymore.. so something was broken, as the – whatever website – responded with 500 and now it works.

but the PS5-MQTT still doesn't work.. 😕

just to verify if I missed some steps:

  1. execute this on host bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/ps5-mqtt.sh)" with all default settings
  2. open terminal on the container and edit nano /opt/.config/ps5-mqtt/config.json -> add mqtt host, port, user and pass, add psn_acconts username and npsso (following this guide https://psn-api.achievements.app/authentication/authenticating-manually#get-started) and since both my PS5 and my Proxmox (+ the PS5-MQTT container) are in the same subnet (192.168.1.35 and 192.168.1.189) I don't need to use the device_discovery_broadcast_address, right? If I do, shouldn't it be 192.168.1.35?
  3. power up my PS5 and launch Minecraft (made sure I am logged in on PSN, my PS operating system is up to date and PS5 is seen in LAN and can access internet)
  4. restart the container and open in browser http://192.168.1.35:8645/ -> it will automatically try to fetch the devices
  5. no devices found

For what it's worth, I'm running on Unifi LAN, so I'm not sure if I should modify my networks settings somehow, e.g. allow IGMP snooping or something.

@Kirbo
Copy link

Kirbo commented Feb 4, 2025

I don't need to use the device_discovery_broadcast_address, right? If I do, shouldn't it be 192.168.1.35?

Ok so it was supposed to be the IP-address of my PS5. Now I am able to see it. But the auto discovery didn't work

@liecno
Copy link
Contributor Author

liecno commented Feb 4, 2025

Ok so it was supposed to be the IP-address of my PS5. Now I am able to see it. But the auto discovery didn't work

No, as the name suggest it should be the broadcast address of the subnet in which you PS5 is located, NOT the IP address of your PS5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new script A change that adds a new script website A change to the website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants