From b5118aa1d4575bced5bd70b2ededf03a4cfbd7a3 Mon Sep 17 00:00:00 2001 From: Hendrik Sokolowski Date: Sun, 1 Oct 2023 22:20:38 +0200 Subject: [PATCH] Use home-assistant from latest, move zigbee2mqtt port to 8081 --- modules/home-assistant/default.nix | 7 +++++++ modules/home-assistant/home-assistant.nix | 2 ++ modules/home-assistant/zigbee.nix | 13 +++++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) 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"; }; }; };