os/modules/home-assistant/zigbee.nix
Hendrik Sokolowski 6c7d9704bd
All checks were successful
continuous-integration/drone/push Build is passing
latest changes
2023-11-11 01:24:25 +01:00

47 lines
1 KiB
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 = {
legacy_entity_attributes = false;
};
availability = true;
advanced = {
legacy_api = false;
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";
ota = {
zigbee_ota_override_index_location = "/var/lib/zigbee2mqtt/index.json";
};
};
};
};
}