{ config, lib, ... }: { options.zpha.configure.floraCtl.enable = lib.mkEnableOption ""; config = lib.mkIf config.zpha.configure.floraCtl.enable { sops.secrets."zigbee2mqttSecrets.yaml" = { owner = "zigbee2mqtt"; key = "zigbee2mqttSecrets"; }; common.configure.persist.system.dirs = [ { directory = "/var/lib/zigbee2mqtt"; mode = "0770"; user = "zigbee2mqtt"; group = "zigbee2mqtt"; } ]; systemd.services.zigbee2mqtt = { serviceConfig = { Restart = lib.mkForce "always"; RuntimeMaxSec = "1d"; }; }; services = { udev.extraRules = '' SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{serial}=="00_12_4B_00_25_9B_C1_FC", SYMLINK+="zigbee0" ATTR{idVendor}=="0451", ATTR{idProduct}=="16a8", ENV{ID_MM_DEVICE_IGNORE}="1" SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="zigbee0" ''; zigbee2mqtt = { enable = true; settings = { homeassistant.enabled = true; permit_join = false; mqtt = { base_topic = "zigbee2mqtt"; server = "mqtt://192.168.2.147:1883"; user = "!${config.sops.secrets."zigbee2mqttSecrets.yaml".path} mqttUser"; password = "!${config.sops.secrets."zigbee2mqttSecrets.yaml".path} mqttPassword"; }; serial = { adapter = "zstack"; port = "/dev/zigbee0"; disable_led = true; }; frontend = { port = 8422; host = "::1"; }; advanced = { log_level = "info"; log_output = [ "console" ]; channel = 11; pan_id = 55067; ext_pan_id = [ 116 73 103 101 20 101 160 9 ]; network_key = "!${config.sops.secrets."zigbee2mqttSecrets.yaml".path} network_key"; }; device_options.retain = true; devices = { "0x00124b0023ad17f1".friendly_name = "door_buzzer"; }; }; }; }; }; }