diff --git a/modules/home-assistant/default.nix b/modules/home-assistant/default.nix index 426cbb1d..877cfc92 100644 --- a/modules/home-assistant/default.nix +++ b/modules/home-assistant/default.nix @@ -3,15 +3,22 @@ config, options, pkgs, + inputs, ... }: with lib; let cfg = config.pub-solar.home-assistant; + unstable = import {}; in { imports = [ ./home-assistant.nix ./mqtt.nix ./zigbee.nix + (inputs.latest + "/nixos/modules/services/home-automation/home-assistant.nix") + ]; + + disabledModules = [ + "services/home-automation/home-assistant.nix" ]; options.pub-solar.home-assistant = { diff --git a/modules/home-assistant/home-assistant.nix b/modules/home-assistant/home-assistant.nix index 9d6cc10e..2d94ad42 100644 --- a/modules/home-assistant/home-assistant.nix +++ b/modules/home-assistant/home-assistant.nix @@ -8,6 +8,8 @@ with lib; let cfg = config.pub-solar.home-assistant; in { config = mkIf cfg.enable { + networking.firewall.allowedUDPPorts = [1900]; + services.home-assistant = { enable = true; openFirewall = true; diff --git a/modules/home-assistant/zigbee.nix b/modules/home-assistant/zigbee.nix index 6b2bd1ba..5981c3be 100644 --- a/modules/home-assistant/zigbee.nix +++ b/modules/home-assistant/zigbee.nix @@ -10,17 +10,21 @@ with lib; let in { config = mkIf (haCfg.enable && cfg.enable) { networking.firewall.allowedTCPPorts = [ - 8080 # zigbee2mqtt + 8081 # zigbee2mqtt ]; - #services.udev.extraRules = ''KERNEL=="${cfg.device}", OWNER="zigbee2mqtt", GROUP="zigbee2mqtt"''; - services.zigbee2mqtt = { enable = true; settings = { - frontend = true; + frontend = { + port = 8081; + }; permit_join = false; homeassistant = true; + availability = true; + advanced = { + legacy_availability_payload = false; + }; mqtt = { user = "z2m"; password = "!secrets.yaml mqtt_password"; @@ -29,6 +33,7 @@ in { port = cfg.device; adapter = mkIf (cfg.adapter != null) cfg.adapter; }; + groups = "groups.yaml"; }; }; };