From f829371b6aca7639ecc3856711471f3ff800fc7f Mon Sep 17 00:00:00 2001 From: Jordan Holt Date: Sat, 6 Jan 2024 13:32:49 +0000 Subject: [PATCH] Update home-assistant config --- hosts/pi/default.nix | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/hosts/pi/default.nix b/hosts/pi/default.nix index d016360..2212837 100644 --- a/hosts/pi/default.nix +++ b/hosts/pi/default.nix @@ -88,6 +88,13 @@ pulse.enable = true; }; + age.secrets."files/services/home-assistant/secrets.yaml" = { + file = "${inputs.secrets}/files/services/home-assistant/secrets.yaml.age"; + path = "${config.services.home-assistant.configDir}/secrets.yaml"; + owner = "hass"; + group = "hass"; + }; + services.home-assistant = { enable = true; extraComponents = [ @@ -116,10 +123,27 @@ backup = {}; homeassistant = { name = "Home"; - unit_system = "metric"; + latitude = "!secret latitude"; + longitude = "!secret longitude"; + country = "GB"; temperature_unit = "C"; + time_zone = config.time.timeZone; + unit_system = "metric"; + }; + mqtt = { + broker = "127.0.0.1"; + port = 1883; + discovery = true; + client_id = "home-assistant-1"; + birth_message = { + topic = "homeassistant/status"; + payload = "online"; + }; + will_message = { + topic = "homeassistant/status"; + payload = "offline"; + }; }; - mqtt = {}; recorder = { purge_keep_days = 365; }; @@ -147,7 +171,13 @@ enable = true; dataDir = "/var/lib/zigbee2mqtt"; settings = { - homeassistant = config.services.home-assistant.enable; + homeassistant = lib.optionalAttrs config.services.home-assistant.enable { + discovery_topic = "homeassistant"; + status_topic = "hass/status"; + legacy_entity_attributes = true; + legacy_triggers = true; + }; + availability = true; frontend = true; device_options = { retain = true;