Compare commits

...

19 Commits

Author SHA1 Message Date
liecno
8790e5b274
Merge 9a961b9bac into f428146c47 2025-01-09 00:14:12 +01:00
community-scripts-pr-app[bot]
f428146c47
Update CHANGELOG.md (#1336)
Some checks are pending
Shellcheck / Shellcheck (push) Waiting to run
Create Changelog Pull Request / update-changelog-pull-request (push) Waiting to run
Validate script formatting / Check changed files (push) Waiting to run
Validate scripts / Check changed files (push) Waiting to run
2025-01-08 23:05:14 +01:00
Sébastiaan
0059adecf1
fix(ci): formatting event & chmod +x (#1335) 2025-01-08 21:41:58 +01:00
community-scripts-pr-app[bot]
e1daaa6409
Update CHANGELOG.md (#1328)
Some checks are pending
Create Changelog Pull Request / update-changelog-pull-request (push) Waiting to run
Shellcheck / Shellcheck (push) Waiting to run
Validate script formatting / Check changed files (push) Waiting to run
Validate scripts / Check changed files (push) Waiting to run
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-01-08 16:33:40 +01:00
Sébastiaan
ff712bc36e
fix: correctly handle pull_request_target event (#1327)
* Fix workflow on pull_request_target

* fix fromJSON
2025-01-08 16:33:09 +01:00
liecno
9a961b9bac Reorder the code for getting release version in ps5-mqtt script 2025-01-04 12:44:11 +01:00
liecno
d990541f78 Reorder code in ps5-mqtt script 2025-01-04 12:21:23 +01:00
liecno
23008bf37b Refactor handling with folders in the ps5-mqtt script 2025-01-04 12:21:23 +01:00
liecno
e2b8e9a41d Remove superfluous .service string vom systemctl calls in ps5-mqtt script 2025-01-04 12:21:23 +01:00
liecno
15e8858ead Reorder code structure for ps5-mqtt script 2025-01-04 12:21:23 +01:00
liecno
399484f3ee
Merge branch 'community-scripts:main' into main 2025-01-03 21:32:50 +01:00
liecno
664f28a4cb Remove superfluous empty lines in ps5-mqtt install script 2025-01-03 20:46:40 +01:00
liecno
44c9b4e599 Improve wording for the config location for the ps5-mqtt script 2025-01-03 20:18:15 +01:00
liecno
e82d88ff80 Remove superfluous comment from ps5-mqtt install script 2025-01-03 20:10:53 +01:00
liecno
720d170949 Remove superfluous information messages when installing ps5-mqtt 2025-01-03 19:55:25 +01:00
liecno
69473f4ac4 Reformat dependencies when installing ps5-mqtt 2025-01-03 19:53:26 +01:00
liecno
fc0647e5b0 Add version number to update information for ps5-mqtt script 2025-01-03 19:49:27 +01:00
liecno
447357f562 Update location of currently installed version for ps5-mqtt script 2025-01-03 19:48:25 +01:00
liecno
62b9e845a8 Add ps5-mqtt script 2025-01-03 17:08:55 +01:00
7 changed files with 234 additions and 16 deletions

View File

@ -16,6 +16,7 @@ jobs:
steps:
- name: Get pull request information
if: github.event_name == 'pull_request_target'
uses: actions/github-script@v7
id: pr
with:
@ -30,13 +31,13 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure the full history is fetched for accurate diffing
ref: ${{ fromJSON(steps.pr.outputs.result).merge_commit_sha }}
ref: ${{ github.event_name == 'pull_request_target' && fromJSON(steps.pr.outputs.result).merge_commit_sha || '' }}
- name: Get changed files
id: changed-files
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | xargs)" >> $GITHUB_OUTPUT
if ${{ github.event_name == 'pull_request_target' }}; then
echo "files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ steps.pr.outputs.result && fromJSON(steps.pr.outputs.result).merge_commit_sha }} | xargs)" >> $GITHUB_OUTPUT
else
echo "files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT
fi
@ -88,7 +89,7 @@ jobs:
fi
- name: Post results and comment
if: always() && steps.check-scripts.outputs.files != '' && steps.check-json.outputs.files != '' && github.event_name == 'pull_request'
if: always() && steps.check-scripts.outputs.files != '' && steps.check-json.outputs.files != '' && github.event_name == 'pull_request_target'
uses: actions/github-script@v7
with:
script: |

View File

@ -18,6 +18,7 @@ jobs:
steps:
- name: Get pull request information
if: github.event_name == 'pull_request_target'
uses: actions/github-script@v7
id: pr
with:
@ -32,13 +33,13 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure the full history is fetched for accurate diffing
ref: ${{ fromJSON(steps.pr.outputs.result).merge_commit_sha }}
ref: ${{ github.event_name == 'pull_request_target' && fromJSON(steps.pr.outputs.result).merge_commit_sha || '' }}
- name: Get changed files
id: changed-files
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -E '\.(sh|func)$' | xargs)" >> $GITHUB_OUTPUT
if ${{ github.event_name == 'pull_request_target' }}; then
echo "files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ steps.pr.outputs.result && fromJSON(steps.pr.outputs.result).merge_commit_sha }} | grep -E '\.(sh|func)$' | xargs)" >> $GITHUB_OUTPUT
else
echo "files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep -E '\.(sh|func)$' | xargs)" >> $GITHUB_OUTPUT
fi
@ -69,7 +70,7 @@ jobs:
fi
- name: Post comment with results
if: always() && steps.changed-files.outputs.files != '' && github.event_name == 'pull_request'
if: always() && steps.changed-files.outputs.files != '' && github.event_name == 'pull_request_target'
uses: actions/github-script@v7
with:
script: |

View File

@ -17,6 +17,7 @@ jobs:
steps:
- name: Get pull request information
if: github.event_name == 'pull_request_target'
uses: actions/github-script@v7
id: pr
with:
@ -31,17 +32,13 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure the full history is fetched for accurate diffing
ref: ${{fromJSON(steps.pr.outputs.result).merge_commit_sha}}
- name: Set execute permission for .sh files
run: |
chmod +x ct/*.sh
ref: ${{ github.event_name == 'pull_request_target' && fromJSON(steps.pr.outputs.result).merge_commit_sha || '' }}
- name: Get changed files
id: changed-files
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "files=$(git diff --name-only -r HEAD^1 HEAD | grep -E '\.(sh|func)$' | xargs)" >> $GITHUB_OUTPUT
if ${{ github.event_name == 'pull_request_target' }}; then
echo "files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ steps.pr.outputs.result && fromJSON(steps.pr.outputs.result).merge_commit_sha }} | xargs)" >> $GITHUB_OUTPUT
else
echo "files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep -E '\.(sh|func)$' | xargs)" >> $GITHUB_OUTPUT
fi
@ -167,7 +164,7 @@ jobs:
fi
- name: Post results and comment
if: always() && steps.changed-files.outputs.files != '' && github.event_name == 'pull_request'
if: always() && steps.changed-files.outputs.files != '' && github.event_name == 'pull_request_target'
uses: actions/github-script@v7
with:
script: |

View File

@ -24,6 +24,11 @@ Do not break established syntax in this file, as it is automatically updated by
- update postgresql json to add post install password setup [@rdiazlugo](https://github.com/rdiazlugo) ([#1318](https://github.com/community-scripts/ProxmoxVE/pull/1318))
### 🧰 Maintenance
- fix(ci): formatting event & chmod +x [@se-bastiaan](https://github.com/se-bastiaan) ([#1335](https://github.com/community-scripts/ProxmoxVE/pull/1335))
- fix: correctly handle pull_request_target event [@se-bastiaan](https://github.com/se-bastiaan) ([#1327](https://github.com/community-scripts/ProxmoxVE/pull/1327))
## 2025-01-07
### Changed

76
ct/ps5-mqtt.sh Normal file
View File

@ -0,0 +1,76 @@
#!/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() {
header_info
check_container_storage
check_container_resources
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')
if [[ "${RELEASE}" != "$(cat /opt/ps5-mqtt_version.txt)" ]]; then
msg_info "Stopping service"
systemctl stop ps5-mqtt
msg_ok "Stopped service"
msg_info "Updating PS5-MQTT to ${RELEASE}"
wget -P /tmp -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz
rm -rf /opt/ps5-mqtt
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"
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
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}"

View File

@ -0,0 +1,99 @@
#!/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"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y \
curl \
sudo \
mc \
jq \
nodejs \
npm
$STD npm i -g playactor
msg_ok "Installed Dependencies"
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
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"
mkdir -p /root/.config/ps5-mqtt
mkdir -p /root/.config/playactor
cat <<EOF > /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
cat <<EOF >/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"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
rm /tmp/${RELEASE}.tar.gz
msg_ok "Cleaned"

39
json/ps5-mqtt.json Normal file
View File

@ -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": "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"
}
]
}