nixos-config/machines/chungus/hass-zigbee2mqtt.nix
2024-06-07 22:56:52 +02:00

56 lines
1.4 KiB
Nix

{ pkgs, lib, config, private_assets, ... }:
{
imports = [ ./hass-mqtt.nix ];
services.zigbee2mqtt = {
enable = true;
dataDir = "/srv2/zigbee2mqtt";
settings = {
# Home Assistant integration (MQTT discovery)
homeassistant = true;
# allow new devices to join
permit_join = false;
# MQTT settings
mqtt = {
# MQTT base topic for zigbee2mqtt MQTT messages
base_topic = "zigbee2mqtt";
# MQTT server URL
server = "mqtt://127.0.0.1:1883";
# MQTT server authentication, uncomment if required:
user = "zigbee";
password = lib.fileContents "${private_assets}/zigbee/home-assistant-password";
};
# Serial settings
serial = {
#port = "/dev/ttyACM0";
port = "/dev/ttyUSB0";
# disable LED of CC2531 USB sniffer
disable_led = true;
};
# you own network key,
# 16 numbers between 0 and 255
# see https://www.zigbee2mqtt.io/how_tos/how_to_secure_network.html
advanced = {
network_key = import "${private_assets}/zigbee/networkKey.nix";
log_output = [ "console" ];
log_level = "warn";
pan_id = 1337;
# add last seen information
last_seen = "ISO_8601_local";
};
# configure web ui
frontend.port = 9666;
frontend.host = "0.0.0.0";
experimental.new_api = true;
};
};
}