Refactor: Zigbee2MQTT (#9803)

This commit is contained in:
Slaviša Arežina
2025-12-09 16:04:47 +01:00
committed by GitHub
parent c28e404bd9
commit cb28199964
3 changed files with 8 additions and 12 deletions

View File

@ -43,7 +43,7 @@ function update_script() {
fetch_and_deploy_gh_release "Zigbee2MQTT" "Koenkk/zigbee2mqtt" "tarball" "latest" "/opt/zigbee2mqtt" fetch_and_deploy_gh_release "Zigbee2MQTT" "Koenkk/zigbee2mqtt" "tarball" "latest" "/opt/zigbee2mqtt"
msg_info "Updating ${APP}" msg_info "Updating Zigbee2MQTT"
rm -rf /opt/zigbee2mqtt/data rm -rf /opt/zigbee2mqtt/data
mv /opt/z2m_backup/data /opt/zigbee2mqtt mv /opt/z2m_backup/data /opt/zigbee2mqtt
cd /opt/zigbee2mqtt cd /opt/zigbee2mqtt

View File

@ -11,7 +11,7 @@
"interface_port": 9442, "interface_port": 9442,
"documentation": "https://www.zigbee2mqtt.io/guide/getting-started/", "documentation": "https://www.zigbee2mqtt.io/guide/getting-started/",
"website": "https://www.zigbee2mqtt.io/", "website": "https://www.zigbee2mqtt.io/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@master/webp/zigbee2mqtt.webp", "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/zigbee2mqtt.webp",
"config_path": "debian: /opt/zigbee2mqtt/data/configuration.yaml | alpine: /var/lib/zigbee2mqtt/configuration.yaml", "config_path": "debian: /opt/zigbee2mqtt/data/configuration.yaml | alpine: /var/lib/zigbee2mqtt/configuration.yaml",
"description": "Zigbee2MQTT is an open-source software project that allows you to use Zigbee-based smart home devices (such as those sold under the Philips Hue and Ikea Tradfri brands) with MQTT-based home automation systems, like Home Assistant, Node-RED, and others. The software acts as a bridge between your Zigbee devices and MQTT, allowing you to control and monitor these devices from your home automation system.", "description": "Zigbee2MQTT is an open-source software project that allows you to use Zigbee-based smart home devices (such as those sold under the Philips Hue and Ikea Tradfri brands) with MQTT-based home automation systems, like Home Assistant, Node-RED, and others. The software acts as a bridge between your Zigbee devices and MQTT, allowing you to control and monitor these devices from your home automation system.",
"install_methods": [ "install_methods": [

View File

@ -16,31 +16,26 @@ update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt install -y \ $STD apt install -y \
git \ git \
make \ build-essential
g++ \
gcc \
ca-certificates \
jq
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
NODE_VERSION="24" NODE_MODULE="pnpm@$(curl -fsSL https://raw.githubusercontent.com/Koenkk/zigbee2mqtt/master/package.json | jq -r '.packageManager | split("@")[1]')" setup_nodejs NODE_VERSION="24" NODE_MODULE="pnpm@$(curl -fsSL https://raw.githubusercontent.com/Koenkk/zigbee2mqtt/master/package.json | jq -r '.packageManager | split("@")[1]')" setup_nodejs
fetch_and_deploy_gh_release "Zigbee2MQTT" "Koenkk/zigbee2mqtt" "tarball" "latest" "/opt/zigbee2mqtt" fetch_and_deploy_gh_release "Zigbee2MQTT" "Koenkk/zigbee2mqtt" "tarball" "latest" "/opt/zigbee2mqtt"
msg_info "Setting up Zigbee2MQTT" msg_info "Setting up Zigbee2MQTT"
cd /opt/zigbee2mqtt/data || exit mv /opt/zigbee2mqtt/data/configuration.example.yaml /opt/zigbee2mqtt/data/configuration.yaml
mv configuration.example.yaml configuration.yaml cd /opt/zigbee2mqtt
cd /opt/zigbee2mqtt || exit
echo "packageImportMethod: hardlink" >>./pnpm-workspace.yaml echo "packageImportMethod: hardlink" >>./pnpm-workspace.yaml
$STD pnpm install --no-frozen-lockfile $STD pnpm install --no-frozen-lockfile
$STD pnpm build $STD pnpm build
msg_ok "Installed Zigbee2MQTT" msg_ok "Setup Zigbee2MQTT"
msg_info "Creating Service" msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/zigbee2mqtt.service cat <<EOF >/etc/systemd/system/zigbee2mqtt.service
[Unit] [Unit]
Description=zigbee2mqtt Description=zigbee2mqtt
After=network.target After=network.target
[Service] [Service]
Environment=NODE_ENV=production Environment=NODE_ENV=production
ExecStart=/usr/bin/pnpm start ExecStart=/usr/bin/pnpm start
@ -49,6 +44,7 @@ StandardOutput=inherit
StandardError=inherit StandardError=inherit
Restart=always Restart=always
User=root User=root
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF