====== Zigbee2MQTT in LXC ======
Z2M in Proxmox's LXC
Installation hints: [[https://www.zigbee2mqtt.io/guide/installation/01_linux.html|Linux]]
3rd party Proxmox installer scripts:
- bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/zigbee2mqtt.sh)"
- [[https://raw.githubusercontent.com/tteck/Proxmox/main/ct/zigbee2mqtt.sh]]
- [[https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func|build.func]]
===== CT configuration =====
* unprivileged
* keyctl, nesting
* additional permissions to access USB dongle:
lxc.cgroup2.devices.allow: c 188:* rwm
lxc.mount.entry: /dev/serial/by-id dev/serial/by-id none bind,optional,create=dir
lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file
* unprivileged container has mapped own UID to host uids 100000 and higher. So ''dialout'' GID=20 in LXC is visible for host as 100020. It is need to give correct permissions to device node: chown 100000:100020 /dev/ttyUSB0
===== Guest system =====
Zigbee2MQTT requres:
# Verify that the correct nodejs and npm (automatically installed with nodejs)
# version has been installed
node --version # Should output v14.X, V16.x, V17.x or V18.X
npm --version # Should output 6.X, 7.X or 8.X
So best is to start with Debian 12 ''bookworm'' system.
===== HA =====
Get MQTT user and password from ''MQTT settings'' or create new HA user which also will became MQTT user.
Enable [[https://www.zigbee2mqtt.io/guide/usage/integrations/home_assistant.html#mqtt-discovery|MQTT Discovery]]