From 62b9e845a84210cd5b5ba9efb529669a6ed2865a Mon Sep 17 00:00:00 2001 From: liecno Date: Fri, 3 Jan 2025 16:17:25 +0100 Subject: [PATCH 01/20] Add ps5-mqtt script --- ct/ps5-mqtt.sh | 78 +++++++++++++++++++++++++ install/ps5-mqtt-install.sh | 111 ++++++++++++++++++++++++++++++++++++ json/ps5-mqtt.json | 39 +++++++++++++ 3 files changed, 228 insertions(+) create mode 100644 ct/ps5-mqtt.sh create mode 100644 install/ps5-mqtt-install.sh create mode 100644 json/ps5-mqtt.json diff --git a/ct/ps5-mqtt.sh b/ct/ps5-mqtt.sh new file mode 100644 index 00000000000..80f07286368 --- /dev/null +++ b/ct/ps5-mqtt.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: liecno +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/FunkeyFlo/ps5-mqtt/ + +# App Default Values +APP="PS5-MQTT" +var_tags="smarthome;automation" +var_cpu="1" +var_ram="256" +var_disk="3" +var_os="debian" +var_version="12" +var_unprivileged="1" + +# App Output & Base Settings +header_info "$APP" +base_settings + +# Core +variables +color +catch_errors + +function update_script() { + if [[ ! -d /opt/ps5-mqtt ]]; then + msg_error "No ${APP} installation found!" + exit + fi + + RELEASE=$(curl -s https://api.github.com/repos/FunkeyFlo/ps5-mqtt/releases/latest | jq -r '.tag_name') + + header_info + check_container_storage + check_container_resources + + if [[ "${RELEASE}" != "$(cat /opt/ps5-mqtt/cs_release)" ]]; then + msg_info "Stopping service" + systemctl stop ps5-mqtt.service + msg_ok "Stopped service" + + msg_info "Updating PS5-MQTT" + cd ~ + wget -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz + tar zxf ${RELEASE}.tar.gz + rm -rf /opt/ps5-mqtt + mv ps5-mqtt-* /opt/ps5-mqtt + rm ${RELEASE}.tar.gz + echo ${RELEASE} > /opt/ps5-mqtt/cs_release + msg_ok "Updated PS5-MQTT" + + msg_info "Building new PS5-MQTT version" + cd /opt/ps5-mqtt/ps5-mqtt/ + npm install &>/dev/null + npm run build &>/dev/null + msg_ok "Built new PS5-MQTT version" + + msg_info "Starting service" + systemctl start ps5-mqtt.service + msg_ok "Started service" + + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi + + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8645${CL}" \ No newline at end of file diff --git a/install/ps5-mqtt-install.sh b/install/ps5-mqtt-install.sh new file mode 100644 index 00000000000..450d93504a2 --- /dev/null +++ b/install/ps5-mqtt-install.sh @@ -0,0 +1,111 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: liecno +# License: MIT +# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE + +# source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y curl jq + +msg_info "Installing NodeJS and NPM" +$STD apt-get install -y nodejs npm +msg_ok "Installed NodeJS and NPM" + +msg_info "Installing playactor" +$STD npm i -g playactor +msg_ok "Installed playactor" + +msg_ok "Installed Dependencies" + +RELEASE=$(curl -s https://api.github.com/repos/FunkeyFlo/ps5-mqtt/releases/latest | jq -r '.tag_name') + +msg_info "Installing PS5-MQTT" +wget -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz + +tar zxf ${RELEASE}.tar.gz + +mv ps5-mqtt-* /opt/ps5-mqtt +echo ${RELEASE} > /opt/ps5-mqtt/cs_release + +cd /opt/ps5-mqtt/ps5-mqtt/ +$STD npm install +$STD npm run build +msg_ok "Installed PS5-MQTT" + +msg_info "Creating Configuration" + +mkdir -p /root/.config/ps5-mqtt +mkdir -p /root/.config/playactor +cat < /root/.config/ps5-mqtt/config.json +{ + "mqtt": { + "host": "", + "port": "", + "user": "", + "pass": "", + "discovery_topic": "homeassistant" + }, + + "device_check_interval": 5000, + "device_discovery_interval": 60000, + "device_discovery_broadcast_address": "", + + "include_ps4_devices": false, + + "psn_accounts": [ + { + "username": "", + "npsso":"" + } + ], + + "account_check_interval": 5000, + + "credentialsStoragePath": "/root/.config/ps5-mqtt/credentials.json", + "frontendPort": "8645" +} +EOF +msg_ok "Created Configuration" + +msg_info "Creating Service" +cat </etc/systemd/system/ps5-mqtt.service +[Unit] +Description=PS5-MQTT Daemon +After=syslog.target network.target + +[Service] +WorkingDirectory=/opt/ps5-mqtt/ps5-mqtt +Environment="CONFIG_PATH=/root/.config/ps5-mqtt/config.json" +Environment="DEBUG='@ha:ps5:*'" +Restart=always +RestartSec=5 +Type=simple +ExecStart=node server/dist/index.js +KillMode=process +SyslogIdentifier=ps5-mqtt + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now ps5-mqtt +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +cd / +$STD apt-get -y autoremove +$STD apt-get -y autoclean +rm ${RELEASE}.tar.gz +msg_ok "Cleaned" diff --git a/json/ps5-mqtt.json b/json/ps5-mqtt.json new file mode 100644 index 00000000000..9c82f691a42 --- /dev/null +++ b/json/ps5-mqtt.json @@ -0,0 +1,39 @@ +{ + "name": "PS5-MQTT", + "slug": "ps5-mqtt", + "categories": [ + 3 + ], + "date_created": "2025-01-03", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 8645, + "documentation": null, + "website": "https://github.com/FunkeyFlo/", + "logo": "https://github.com/FunkeyFlo/ps5-mqtt/blob/main/add-ons/ps5-mqtt/logo.png?raw=true", + "description": "Integrate your Sony Playstation 5 devices with Home Assistant using MQTT.", + "install_methods": [ + { + "type": "default", + "script": "ct/ps5-mqtt.sh", + "resources": { + "cpu": 1, + "ram": 265, + "hdd": 3, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "config file: `/root/.config/ps5-mqtt/config.json`", + "type": "info" + } + ] +} \ No newline at end of file From 447357f5620093df354e320d783fba450b432bfc Mon Sep 17 00:00:00 2001 From: liecno Date: Fri, 3 Jan 2025 19:48:25 +0100 Subject: [PATCH 02/20] Update location of currently installed version for ps5-mqtt script --- ct/ps5-mqtt.sh | 4 ++-- install/ps5-mqtt-install.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ct/ps5-mqtt.sh b/ct/ps5-mqtt.sh index 80f07286368..e5c7c977486 100644 --- a/ct/ps5-mqtt.sh +++ b/ct/ps5-mqtt.sh @@ -36,7 +36,7 @@ function update_script() { check_container_storage check_container_resources - if [[ "${RELEASE}" != "$(cat /opt/ps5-mqtt/cs_release)" ]]; then + if [[ "${RELEASE}" != "$(cat /opt/ps5-mqtt_version.txt)" ]]; then msg_info "Stopping service" systemctl stop ps5-mqtt.service msg_ok "Stopped service" @@ -48,7 +48,7 @@ function update_script() { rm -rf /opt/ps5-mqtt mv ps5-mqtt-* /opt/ps5-mqtt rm ${RELEASE}.tar.gz - echo ${RELEASE} > /opt/ps5-mqtt/cs_release + echo ${RELEASE} > /opt/ps5-mqtt_version.txt msg_ok "Updated PS5-MQTT" msg_info "Building new PS5-MQTT version" diff --git a/install/ps5-mqtt-install.sh b/install/ps5-mqtt-install.sh index 450d93504a2..d1f31abaad2 100644 --- a/install/ps5-mqtt-install.sh +++ b/install/ps5-mqtt-install.sh @@ -35,7 +35,7 @@ wget -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.g tar zxf ${RELEASE}.tar.gz mv ps5-mqtt-* /opt/ps5-mqtt -echo ${RELEASE} > /opt/ps5-mqtt/cs_release +echo ${RELEASE} > /opt/ps5-mqtt_version.txt cd /opt/ps5-mqtt/ps5-mqtt/ $STD npm install From fc0647e5b0281f498a02440d8b839d990ef01325 Mon Sep 17 00:00:00 2001 From: liecno Date: Fri, 3 Jan 2025 19:49:27 +0100 Subject: [PATCH 03/20] Add version number to update information for ps5-mqtt script --- ct/ps5-mqtt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/ps5-mqtt.sh b/ct/ps5-mqtt.sh index e5c7c977486..2dfe955f78a 100644 --- a/ct/ps5-mqtt.sh +++ b/ct/ps5-mqtt.sh @@ -41,7 +41,7 @@ function update_script() { systemctl stop ps5-mqtt.service msg_ok "Stopped service" - msg_info "Updating PS5-MQTT" + msg_info "Updating PS5-MQTT to ${RELEASE}" cd ~ wget -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz tar zxf ${RELEASE}.tar.gz From 69473f4ac41ef28a92690fb9f6cad1328385d4e7 Mon Sep 17 00:00:00 2001 From: liecno Date: Fri, 3 Jan 2025 19:53:26 +0100 Subject: [PATCH 04/20] Reformat dependencies when installing ps5-mqtt --- install/ps5-mqtt-install.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/install/ps5-mqtt-install.sh b/install/ps5-mqtt-install.sh index d1f31abaad2..561d7fc5d0e 100644 --- a/install/ps5-mqtt-install.sh +++ b/install/ps5-mqtt-install.sh @@ -15,15 +15,15 @@ network_check update_os msg_info "Installing Dependencies" -$STD apt-get install -y curl jq +$STD apt-get install -y \ + curl \ + sudo \ + mc \ + jq \ + nodejs \ + npm -msg_info "Installing NodeJS and NPM" -$STD apt-get install -y nodejs npm -msg_ok "Installed NodeJS and NPM" - -msg_info "Installing playactor" $STD npm i -g playactor -msg_ok "Installed playactor" msg_ok "Installed Dependencies" From 720d17094921fc7d78c0e0d0a3b9ba69fc59bc3b Mon Sep 17 00:00:00 2001 From: liecno Date: Fri, 3 Jan 2025 19:55:25 +0100 Subject: [PATCH 05/20] Remove superfluous information messages when installing ps5-mqtt --- install/ps5-mqtt-install.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/install/ps5-mqtt-install.sh b/install/ps5-mqtt-install.sh index 561d7fc5d0e..fdc34c2e539 100644 --- a/install/ps5-mqtt-install.sh +++ b/install/ps5-mqtt-install.sh @@ -42,7 +42,7 @@ $STD npm install $STD npm run build msg_ok "Installed PS5-MQTT" -msg_info "Creating Configuration" +msg_info "Creating Service" mkdir -p /root/.config/ps5-mqtt mkdir -p /root/.config/playactor @@ -75,9 +75,7 @@ cat < /root/.config/ps5-mqtt/config.json "frontendPort": "8645" } EOF -msg_ok "Created Configuration" -msg_info "Creating Service" cat </etc/systemd/system/ps5-mqtt.service [Unit] Description=PS5-MQTT Daemon From e82d88ff80e0f2055d0355ad881777e21de24d15 Mon Sep 17 00:00:00 2001 From: liecno Date: Fri, 3 Jan 2025 20:10:53 +0100 Subject: [PATCH 06/20] Remove superfluous comment from ps5-mqtt install script --- install/ps5-mqtt-install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/install/ps5-mqtt-install.sh b/install/ps5-mqtt-install.sh index fdc34c2e539..d17d69d7f81 100644 --- a/install/ps5-mqtt-install.sh +++ b/install/ps5-mqtt-install.sh @@ -5,7 +5,6 @@ # License: MIT # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -# source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" color verb_ip6 From 44c9b4e59952d7132683e28fbb0583ab20417085 Mon Sep 17 00:00:00 2001 From: liecno Date: Fri, 3 Jan 2025 20:18:15 +0100 Subject: [PATCH 07/20] Improve wording for the config location for the ps5-mqtt script --- json/ps5-mqtt.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json/ps5-mqtt.json b/json/ps5-mqtt.json index 9c82f691a42..4a8afcb333b 100644 --- a/json/ps5-mqtt.json +++ b/json/ps5-mqtt.json @@ -32,7 +32,7 @@ }, "notes": [ { - "text": "config file: `/root/.config/ps5-mqtt/config.json`", + "text": "After installation, the MQTT endpoint must be configured. The configuration file is located within the LXC container at: `/root/.config/ps5-mqtt/config.json`", "type": "info" } ] From 664f28a4cbf003b998a8f665c970dba750378961 Mon Sep 17 00:00:00 2001 From: liecno Date: Fri, 3 Jan 2025 20:46:40 +0100 Subject: [PATCH 08/20] Remove superfluous empty lines in ps5-mqtt install script --- install/ps5-mqtt-install.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/install/ps5-mqtt-install.sh b/install/ps5-mqtt-install.sh index d17d69d7f81..043786d934d 100644 --- a/install/ps5-mqtt-install.sh +++ b/install/ps5-mqtt-install.sh @@ -21,28 +21,22 @@ $STD apt-get install -y \ jq \ nodejs \ npm - $STD npm i -g playactor - msg_ok "Installed Dependencies" RELEASE=$(curl -s https://api.github.com/repos/FunkeyFlo/ps5-mqtt/releases/latest | jq -r '.tag_name') msg_info "Installing PS5-MQTT" wget -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz - tar zxf ${RELEASE}.tar.gz - mv ps5-mqtt-* /opt/ps5-mqtt echo ${RELEASE} > /opt/ps5-mqtt_version.txt - cd /opt/ps5-mqtt/ps5-mqtt/ $STD npm install $STD npm run build msg_ok "Installed PS5-MQTT" msg_info "Creating Service" - mkdir -p /root/.config/ps5-mqtt mkdir -p /root/.config/playactor cat < /root/.config/ps5-mqtt/config.json @@ -74,7 +68,6 @@ cat < /root/.config/ps5-mqtt/config.json "frontendPort": "8645" } EOF - cat </etc/systemd/system/ps5-mqtt.service [Unit] Description=PS5-MQTT Daemon From 15e8858ead766c842660e854284a2ef9fa8e4aa1 Mon Sep 17 00:00:00 2001 From: liecno Date: Sat, 4 Jan 2025 11:52:40 +0100 Subject: [PATCH 09/20] Reorder code structure for ps5-mqtt script --- ct/ps5-mqtt.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ct/ps5-mqtt.sh b/ct/ps5-mqtt.sh index 2dfe955f78a..568d8a4d1dd 100644 --- a/ct/ps5-mqtt.sh +++ b/ct/ps5-mqtt.sh @@ -25,6 +25,10 @@ color catch_errors function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -d /opt/ps5-mqtt ]]; then msg_error "No ${APP} installation found!" exit @@ -32,10 +36,6 @@ function update_script() { RELEASE=$(curl -s https://api.github.com/repos/FunkeyFlo/ps5-mqtt/releases/latest | jq -r '.tag_name') - header_info - check_container_storage - check_container_resources - if [[ "${RELEASE}" != "$(cat /opt/ps5-mqtt_version.txt)" ]]; then msg_info "Stopping service" systemctl stop ps5-mqtt.service From e2b8e9a41dc547c0bfd040bb301b4528fd11f918 Mon Sep 17 00:00:00 2001 From: liecno Date: Sat, 4 Jan 2025 12:09:57 +0100 Subject: [PATCH 10/20] Remove superfluous .service string vom systemctl calls in ps5-mqtt script --- ct/ps5-mqtt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ct/ps5-mqtt.sh b/ct/ps5-mqtt.sh index 568d8a4d1dd..5102cd8b875 100644 --- a/ct/ps5-mqtt.sh +++ b/ct/ps5-mqtt.sh @@ -38,7 +38,7 @@ function update_script() { if [[ "${RELEASE}" != "$(cat /opt/ps5-mqtt_version.txt)" ]]; then msg_info "Stopping service" - systemctl stop ps5-mqtt.service + systemctl stop ps5-mqtt msg_ok "Stopped service" msg_info "Updating PS5-MQTT to ${RELEASE}" @@ -58,7 +58,7 @@ function update_script() { msg_ok "Built new PS5-MQTT version" msg_info "Starting service" - systemctl start ps5-mqtt.service + systemctl start ps5-mqtt msg_ok "Started service" else From 23008bf37b0c80abca9f8bcf2ee0744277b2fbf6 Mon Sep 17 00:00:00 2001 From: liecno Date: Sat, 4 Jan 2025 12:13:12 +0100 Subject: [PATCH 11/20] Refactor handling with folders in the ps5-mqtt script --- ct/ps5-mqtt.sh | 10 ++++------ install/ps5-mqtt-install.sh | 9 ++++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/ct/ps5-mqtt.sh b/ct/ps5-mqtt.sh index 5102cd8b875..4e75d0a5468 100644 --- a/ct/ps5-mqtt.sh +++ b/ct/ps5-mqtt.sh @@ -42,12 +42,11 @@ function update_script() { msg_ok "Stopped service" msg_info "Updating PS5-MQTT to ${RELEASE}" - cd ~ - wget -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz - tar zxf ${RELEASE}.tar.gz + wget -P /tmp -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz rm -rf /opt/ps5-mqtt - mv ps5-mqtt-* /opt/ps5-mqtt - rm ${RELEASE}.tar.gz + tar zxf /tmp/${RELEASE}.tar.gz -C /opt + mv /opt/ps5-mqtt-* /opt/ps5-mqtt + rm /tmp/${RELEASE}.tar.gz echo ${RELEASE} > /opt/ps5-mqtt_version.txt msg_ok "Updated PS5-MQTT" @@ -60,7 +59,6 @@ function update_script() { msg_info "Starting service" systemctl start ps5-mqtt msg_ok "Started service" - else msg_ok "No update required. ${APP} is already at ${RELEASE}" fi diff --git a/install/ps5-mqtt-install.sh b/install/ps5-mqtt-install.sh index 043786d934d..a07080f6fc5 100644 --- a/install/ps5-mqtt-install.sh +++ b/install/ps5-mqtt-install.sh @@ -27,9 +27,9 @@ msg_ok "Installed Dependencies" RELEASE=$(curl -s https://api.github.com/repos/FunkeyFlo/ps5-mqtt/releases/latest | jq -r '.tag_name') msg_info "Installing PS5-MQTT" -wget -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz -tar zxf ${RELEASE}.tar.gz -mv ps5-mqtt-* /opt/ps5-mqtt +wget -P /tmp -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz +tar zxf /tmp/${RELEASE}.tar.gz -C /opt +mv /opt/ps5-mqtt-* /opt/ps5-mqtt echo ${RELEASE} > /opt/ps5-mqtt_version.txt cd /opt/ps5-mqtt/ps5-mqtt/ $STD npm install @@ -94,8 +94,7 @@ motd_ssh customize msg_info "Cleaning up" -cd / $STD apt-get -y autoremove $STD apt-get -y autoclean -rm ${RELEASE}.tar.gz +rm /tmp/${RELEASE}.tar.gz msg_ok "Cleaned" From d990541f78ab6ded22bdca230c3b4547a980cc76 Mon Sep 17 00:00:00 2001 From: liecno Date: Sat, 4 Jan 2025 12:16:17 +0100 Subject: [PATCH 12/20] Reorder code in ps5-mqtt script --- install/ps5-mqtt-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ps5-mqtt-install.sh b/install/ps5-mqtt-install.sh index a07080f6fc5..4edf1721070 100644 --- a/install/ps5-mqtt-install.sh +++ b/install/ps5-mqtt-install.sh @@ -30,10 +30,10 @@ msg_info "Installing PS5-MQTT" wget -P /tmp -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz tar zxf /tmp/${RELEASE}.tar.gz -C /opt mv /opt/ps5-mqtt-* /opt/ps5-mqtt -echo ${RELEASE} > /opt/ps5-mqtt_version.txt cd /opt/ps5-mqtt/ps5-mqtt/ $STD npm install $STD npm run build +echo ${RELEASE} > /opt/ps5-mqtt_version.txt msg_ok "Installed PS5-MQTT" msg_info "Creating Service" From 9a961b9bacadeeae9591343f6feb9d4788c3bd3c Mon Sep 17 00:00:00 2001 From: liecno Date: Sat, 4 Jan 2025 12:44:11 +0100 Subject: [PATCH 13/20] Reorder the code for getting release version in ps5-mqtt script --- install/ps5-mqtt-install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/install/ps5-mqtt-install.sh b/install/ps5-mqtt-install.sh index 4edf1721070..b07c0a5e3eb 100644 --- a/install/ps5-mqtt-install.sh +++ b/install/ps5-mqtt-install.sh @@ -24,9 +24,8 @@ $STD apt-get install -y \ $STD npm i -g playactor msg_ok "Installed Dependencies" -RELEASE=$(curl -s https://api.github.com/repos/FunkeyFlo/ps5-mqtt/releases/latest | jq -r '.tag_name') - msg_info "Installing PS5-MQTT" +RELEASE=$(curl -s https://api.github.com/repos/FunkeyFlo/ps5-mqtt/releases/latest | jq -r '.tag_name') wget -P /tmp -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz tar zxf /tmp/${RELEASE}.tar.gz -C /opt mv /opt/ps5-mqtt-* /opt/ps5-mqtt From 8365af6f66e59b4329451a353639bc4e22c66eb5 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 9 Jan 2025 16:10:39 +0100 Subject: [PATCH 14/20] Update ps5-mqtt-install.sh --- install/ps5-mqtt-install.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/install/ps5-mqtt-install.sh b/install/ps5-mqtt-install.sh index b07c0a5e3eb..cce6f241975 100644 --- a/install/ps5-mqtt-install.sh +++ b/install/ps5-mqtt-install.sh @@ -2,8 +2,8 @@ # Copyright (c) 2021-2025 community-scripts ORG # Author: liecno -# License: MIT -# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/FunkeyFlo/ps5-mqtt/ source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" color @@ -36,9 +36,9 @@ echo ${RELEASE} > /opt/ps5-mqtt_version.txt msg_ok "Installed PS5-MQTT" msg_info "Creating Service" -mkdir -p /root/.config/ps5-mqtt -mkdir -p /root/.config/playactor -cat < /root/.config/ps5-mqtt/config.json +mkdir -p /opt/ps5-mqtt/.config/ps5-mqtt +mkdir -p /opt/ps5-mqtt/.config/playactor +cat < /opt/ps5-mqtt/.config/ps5-mqtt/config.json { "mqtt": { "host": "", @@ -63,7 +63,7 @@ cat < /root/.config/ps5-mqtt/config.json "account_check_interval": 5000, - "credentialsStoragePath": "/root/.config/ps5-mqtt/credentials.json", + "credentialsStoragePath": "/opt/ps5-mqtt/.config/ps5-mqtt/credentials.json", "frontendPort": "8645" } EOF @@ -74,7 +74,7 @@ After=syslog.target network.target [Service] WorkingDirectory=/opt/ps5-mqtt/ps5-mqtt -Environment="CONFIG_PATH=/root/.config/ps5-mqtt/config.json" +Environment="CONFIG_PATH=/opt/ps5-mqtt/.config/ps5-mqtt/config.json" Environment="DEBUG='@ha:ps5:*'" Restart=always RestartSec=5 From 480e9d3e64def1e1f47785566ce7d7c0e917e1ab Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 9 Jan 2025 16:12:51 +0100 Subject: [PATCH 15/20] Update ps5-mqtt-install.sh --- install/ps5-mqtt-install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install/ps5-mqtt-install.sh b/install/ps5-mqtt-install.sh index cce6f241975..5d563df3505 100644 --- a/install/ps5-mqtt-install.sh +++ b/install/ps5-mqtt-install.sh @@ -36,9 +36,9 @@ echo ${RELEASE} > /opt/ps5-mqtt_version.txt msg_ok "Installed PS5-MQTT" msg_info "Creating Service" -mkdir -p /opt/ps5-mqtt/.config/ps5-mqtt +mkdir -p /opt/ps5-mqtt/.config/ mkdir -p /opt/ps5-mqtt/.config/playactor -cat < /opt/ps5-mqtt/.config/ps5-mqtt/config.json +cat < /opt/ps5-mqtt/.config/config.json { "mqtt": { "host": "", @@ -63,7 +63,7 @@ cat < /opt/ps5-mqtt/.config/ps5-mqtt/config.json "account_check_interval": 5000, - "credentialsStoragePath": "/opt/ps5-mqtt/.config/ps5-mqtt/credentials.json", + "credentialsStoragePath": "/opt/ps5-mqtt/.config/credentials.json", "frontendPort": "8645" } EOF @@ -74,7 +74,7 @@ After=syslog.target network.target [Service] WorkingDirectory=/opt/ps5-mqtt/ps5-mqtt -Environment="CONFIG_PATH=/opt/ps5-mqtt/.config/ps5-mqtt/config.json" +Environment="CONFIG_PATH=/opt/ps5-mqtt/.config/config.json" Environment="DEBUG='@ha:ps5:*'" Restart=always RestartSec=5 From ee71f163473c2e91aeefa2bc9aea30658aa36efd Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 9 Jan 2025 16:13:09 +0100 Subject: [PATCH 16/20] Update ps5-mqtt.json --- json/ps5-mqtt.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/json/ps5-mqtt.json b/json/ps5-mqtt.json index 4a8afcb333b..614d60a9901 100644 --- a/json/ps5-mqtt.json +++ b/json/ps5-mqtt.json @@ -32,8 +32,8 @@ }, "notes": [ { - "text": "After installation, the MQTT endpoint must be configured. The configuration file is located within the LXC container at: `/root/.config/ps5-mqtt/config.json`", + "text": "After installation, the MQTT endpoint must be configured. The configuration file is located within the LXC container at: `/opt/ps5-mqtt/.config/config.json`", "type": "info" } ] -} \ No newline at end of file +} From 040f2760d7416fb743948ca98d10d59f0e9bc6ae Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 9 Jan 2025 16:15:42 +0100 Subject: [PATCH 17/20] Update --- install/ps5-mqtt-install.sh | 10 +++++----- json/ps5-mqtt.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/install/ps5-mqtt-install.sh b/install/ps5-mqtt-install.sh index 5d563df3505..54633b45fb5 100644 --- a/install/ps5-mqtt-install.sh +++ b/install/ps5-mqtt-install.sh @@ -36,9 +36,9 @@ echo ${RELEASE} > /opt/ps5-mqtt_version.txt msg_ok "Installed PS5-MQTT" msg_info "Creating Service" -mkdir -p /opt/ps5-mqtt/.config/ -mkdir -p /opt/ps5-mqtt/.config/playactor -cat < /opt/ps5-mqtt/.config/config.json +mkdir -p /opt/.config/ps5-mqtt/ +mkdir -p /opt/.config/ps5-mqtt/playactor +cat < /opt/.config/ps5-mqtt/config.json { "mqtt": { "host": "", @@ -63,7 +63,7 @@ cat < /opt/ps5-mqtt/.config/config.json "account_check_interval": 5000, - "credentialsStoragePath": "/opt/ps5-mqtt/.config/credentials.json", + "credentialsStoragePath": "/opt/.config/ps5-mqtt/credentials.json", "frontendPort": "8645" } EOF @@ -74,7 +74,7 @@ After=syslog.target network.target [Service] WorkingDirectory=/opt/ps5-mqtt/ps5-mqtt -Environment="CONFIG_PATH=/opt/ps5-mqtt/.config/config.json" +Environment="CONFIG_PATH=/opt/.config/ps5-mqtt/config.json" Environment="DEBUG='@ha:ps5:*'" Restart=always RestartSec=5 diff --git a/json/ps5-mqtt.json b/json/ps5-mqtt.json index 614d60a9901..7ffb7f5cf28 100644 --- a/json/ps5-mqtt.json +++ b/json/ps5-mqtt.json @@ -32,7 +32,7 @@ }, "notes": [ { - "text": "After installation, the MQTT endpoint must be configured. The configuration file is located within the LXC container at: `/opt/ps5-mqtt/.config/config.json`", + "text": "After installation, the MQTT endpoint must be configured. The configuration file is located within the LXC container at: `/opt/.config/ps5-mqtt/config.json`", "type": "info" } ] From 6e3eea541c2b94b99e5617e11a29b39217c4741e Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 9 Jan 2025 16:18:11 +0100 Subject: [PATCH 18/20] Update ps5-mqtt-install.sh --- install/ps5-mqtt-install.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/install/ps5-mqtt-install.sh b/install/ps5-mqtt-install.sh index 54633b45fb5..d5c2c1fc37c 100644 --- a/install/ps5-mqtt-install.sh +++ b/install/ps5-mqtt-install.sh @@ -19,11 +19,22 @@ $STD apt-get install -y \ sudo \ mc \ jq \ - nodejs \ npm $STD npm i -g playactor msg_ok "Installed Dependencies" +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + + msg_info "Installing PS5-MQTT" RELEASE=$(curl -s https://api.github.com/repos/FunkeyFlo/ps5-mqtt/releases/latest | jq -r '.tag_name') wget -P /tmp -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz From 916a0459aa3c94eeeb20dfe47995d5d90b9c5809 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 9 Jan 2025 16:21:04 +0100 Subject: [PATCH 19/20] Fix npm --- install/ps5-mqtt-install.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/install/ps5-mqtt-install.sh b/install/ps5-mqtt-install.sh index d5c2c1fc37c..e3a9295c504 100644 --- a/install/ps5-mqtt-install.sh +++ b/install/ps5-mqtt-install.sh @@ -18,9 +18,7 @@ $STD apt-get install -y \ curl \ sudo \ mc \ - jq \ - npm -$STD npm i -g playactor + jq msg_ok "Installed Dependencies" msg_info "Setting up Node.js Repository" @@ -32,6 +30,7 @@ msg_ok "Set up Node.js Repository" msg_info "Installing Node.js" $STD apt-get update $STD apt-get install -y nodejs +$STD npm i -g playactor msg_ok "Installed Node.js" From b4df0141357b6ff54f0af098cea0f86516cdc817 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 9 Jan 2025 16:21:49 +0100 Subject: [PATCH 20/20] Fix Date in json --- json/ps5-mqtt.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json/ps5-mqtt.json b/json/ps5-mqtt.json index 7ffb7f5cf28..2371fe158b6 100644 --- a/json/ps5-mqtt.json +++ b/json/ps5-mqtt.json @@ -4,7 +4,7 @@ "categories": [ 3 ], - "date_created": "2025-01-03", + "date_created": "2025-01-09", "type": "ct", "updateable": true, "privileged": false,