diff --git a/nixos/modules/services/home-automation/home-assistant.nix b/nixos/modules/services/home-automation/home-assistant.nix index 687128b81f4e..382c09cb0fa3 100644 --- a/nixos/modules/services/home-automation/home-assistant.nix +++ b/nixos/modules/services/home-automation/home-assistant.nix @@ -864,12 +864,19 @@ in networking.firewall.allowedTCPPorts = mkMerge [ (mkIf cfg.openFirewall [ cfg.config.http.server_port ]) - (mkIf cfg.openFirewallForComponents + (mkIf cfg.openFirewallForComponents ( + # https://www.home-assistant.io/integrations/homekit/#firewall + optionals (useComponent "homekit") [ 21063 ] # https://www.home-assistant.io/integrations/sonos/#network-requirements - (optionals (useComponent "sonos") [ 1400 ]) - ) + ++ optionals (useComponent "sonos") [ 1400 ] + )) ]; + networking.firewall.allowedUDPPorts = mkIf cfg.openFirewallForComponents ( + # https://www.home-assistant.io/integrations/homekit/#firewall + optionals (useComponent "homekit") [ 5353 ] + ); + # symlink the configuration to /etc/home-assistant environment.etc = mkMerge [ (mkIf (cfg.config != null && !cfg.configWritable) {