Lightest way to install Zigbee2MQTT on a dedicated device?

I want to have Zigbee2MQTT be separate from HA. I have a Dell Wyze 3040 thin client with 2GB RAM and 8GB storage and the Sonoff zigbee-P dongle. What is the lightest OS I can put under Zigbee2MQTT? I think the Proxmox approach might be too heavy after reading the Proxmox requirements. What should I consider? Maybe just another HA instance that only runs Zigbee2MQTT? Is there a lighter solution?

Basically anything

A Server where you would run Zigbee2MQTT. Most Raspberry-Pi models are known to work but you can run it on many computers and platforms including Linux, Windows and MacOS

Zigbee2MQTT was written in Node.js and runs almost on every platform with affordable memory footprint.

I just use a linux install of Zigbee2MQTT and mosquitto. Never had the problems you often see on the forum with the mqtt add-on. A netinstall of Debian bookworm would fit the nicely in the 8Gb storage. Or my favourite, dietpi. x86 edition

I used to run it on W10 with Node-JS and running HA on Hyper-V (since W10HyperV doesn’t support usb passthough).

But nowadays I just use the HA addon (running VMWare on a debian host, which does support USB passthough :thinking:)
Never had any issue with it either…

Hi. You need a Linux distro that can run Docker.

I will recommend Debian 12 and with the low amount of RAM, install it without desktop. Just the server version and setup everything from terminal.

Debian because it is stable, well known, well supported, and all Docker dependencies available from the standard Debian repo. Docker itself gets installed using apt following the installation steps from the Docker home page. Follow instruction on Install Docker Engine on Debian | Docker Docs

I use Docker Compose. I have zigbee2mqtt installed in /var/lib/zigbee2mqtt

Inside this directory I have my docker-compose.yaml file

version: '3.8'
services:
  zigbee2mqtt:
    container_name: zigbee2mqtt
    image: koenkk/zigbee2mqtt
    restart: unless-stopped
    volumes:
      - /var/lib/zigbee2mqtt/data:/app/data
      - /run/udev:/run/udev:ro
    ports:
      # Frontend port
      - 8099:8099
    environment:
      - TZ=Europe/Copenhagen
    devices:
      # Make sure this matched your adapter location
      - /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_281723e498c9eb11b6688b4f1d69213e-if00-port0:/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_281723e498c9eb11b6688b4f1d69213e-if00-port0

Make sure you use the correct device name for the Zigbee dongle using the /dev/serial/by-id so nothing breaks if you ever add another serial USB dongle later. The serial number is part of it so you cannot just copy mine.

When you need to upgrade zigbee2mqtt these command lines do the job

cd /var/lib/zigbee2mqtt
docker compose down
docker compose pull
docker compose up --force-recreate --build -d

I hope this helps

I have Z2M and Mosquitto running in docker containers (alongside other containers) on DietPi on a Pi-4 - perfect.

Awesome tips. Thanks.
Given these choices, would you put Mosquitto in HA as an add-in or run it on the Z2M appliance?

I run HA container (docker) so no add-ons allowed.

HA addons are a good offer for beginners and people not comfortable with basic administration of a Linux box.

But if you have the skills I advice to run anything you can on a different box (real or virtual) than HA. This way you control yourself when to upgrade or even downgrade each vital components. There have been many issues with addons over the years where fixes took time or people were begging for upgrade to a newer version or even beta version. There has also been problems with serial devices not being consistantly visible inside the addon containers. Right now the Mosquitto addon runs a known buggy version.

If you have the skill, take control of things. And if not, the addon repo is still a great offer. I do not want my advice to be taken as negative critique. It is in the nature of any 3rd party docker or Linux package management system that you are always relying on the packaging maintainers and their time and priorities. It is best to have the freedom to both up and downgrade or select an alternative source to install from

1 Like

See the 2023.10 release thread about the current problems with the Mosquitto add-on.

1 Like

Looked into DietPi. Awesome distro. I’m using it for a few things now.

I ended up using Ubuntu server and following the Zigbee2MQTT Linux installation instructions. I had some challenges along the way that so I think I’ll do a small writeup and post a thread that might help others.

As I learned more, I ended up going with the LXC model.