41 lines
844 B
Nix
41 lines
844 B
Nix
{
|
|
lib,
|
|
config,
|
|
pkgs,
|
|
...
|
|
}:
|
|
with lib; let
|
|
haCfg = config.pub-solar.home-assistant;
|
|
cfg = config.pub-solar.home-assistant.zigbee2mqtt;
|
|
in {
|
|
config = mkIf (haCfg.enable && cfg.enable) {
|
|
networking.firewall.allowedTCPPorts = [
|
|
8081 # zigbee2mqtt
|
|
];
|
|
|
|
services.zigbee2mqtt = {
|
|
enable = true;
|
|
settings = {
|
|
frontend = {
|
|
port = 8081;
|
|
};
|
|
permit_join = false;
|
|
homeassistant = true;
|
|
availability = true;
|
|
advanced = {
|
|
legacy_availability_payload = false;
|
|
};
|
|
mqtt = {
|
|
user = "z2m";
|
|
password = "!secrets.yaml mqtt_password";
|
|
};
|
|
serial = {
|
|
port = cfg.device;
|
|
adapter = mkIf (cfg.adapter != null) cfg.adapter;
|
|
};
|
|
groups = "groups.yaml";
|
|
};
|
|
};
|
|
};
|
|
}
|