From 5b6e91249faa333a8dfb6f2fada2d7d1c73894c6 Mon Sep 17 00:00:00 2001 From: notohh Date: Tue, 16 Jan 2024 22:50:24 -0500 Subject: [PATCH] yuki: add basic hass config --- hosts/yuki/services/default.nix | 2 + hosts/yuki/services/hass/config.nix | 18 +++++ hosts/yuki/services/hass/default.nix | 28 +++++++ hosts/yuki/services/hass/lovelace.nix | 110 ++++++++++++++++++++++++++ 4 files changed, 158 insertions(+) create mode 100644 hosts/yuki/services/hass/config.nix create mode 100644 hosts/yuki/services/hass/default.nix create mode 100644 hosts/yuki/services/hass/lovelace.nix diff --git a/hosts/yuki/services/default.nix b/hosts/yuki/services/default.nix index b8f9614..7ce13d1 100644 --- a/hosts/yuki/services/default.nix +++ b/hosts/yuki/services/default.nix @@ -1,5 +1,6 @@ {...}: { imports = [ + ./hass ./restic.nix ./traefik.nix ./stash.nix @@ -7,5 +8,6 @@ ./wallos.nix ./homepage.nix ./searxng.nix + ./navidrome.nix ]; } diff --git a/hosts/yuki/services/hass/config.nix b/hosts/yuki/services/hass/config.nix new file mode 100644 index 0000000..998fe24 --- /dev/null +++ b/hosts/yuki/services/hass/config.nix @@ -0,0 +1,18 @@ +_: { + services.home-assistant.config = { + lovelace.mode = "yaml"; + http = { + server_host = "192.168.1.98"; + server_port = 8124; + }; + homeassistant = { + name = "Home"; + time_zone = "America/New_York"; + unit_system = "imperial"; + temperature_unit = "F"; + currency = "USD"; + country = "US"; + }; + default_config = {}; + }; +} diff --git a/hosts/yuki/services/hass/default.nix b/hosts/yuki/services/hass/default.nix new file mode 100644 index 0000000..81f1b01 --- /dev/null +++ b/hosts/yuki/services/hass/default.nix @@ -0,0 +1,28 @@ +_: { + imports = [ + ./lovelace.nix + ./config.nix + ]; + + nixpkgs.config.permittedInsecurePackages = ["openssl-1.1.1w"]; + + services.home-assistant = { + enable = true; + openFirewall = true; + extraComponents = [ + "default_config" + "met" + "openweathermap" + "esphome" + "google_translate" + "radio_browser" + "sonarr" + "radarr" + "glances" + "epson" + "eufy" + "hue" + "nanoleaf" + ]; + }; +} diff --git a/hosts/yuki/services/hass/lovelace.nix b/hosts/yuki/services/hass/lovelace.nix new file mode 100644 index 0000000..4e81771 --- /dev/null +++ b/hosts/yuki/services/hass/lovelace.nix @@ -0,0 +1,110 @@ +_: { + services.home-assistant.lovelaceConfig = { + title = "Home"; + views = [ + { + title = "Home"; + icon = "mdi:home"; + cards = [ + { + type = "markdown"; + title = "Lovelace"; + content = "Welcome home!"; + } + { + type = "weather-forecast"; + entity = "weather.openweathermap"; + forecast_type = "hourly"; + } + ]; + } + { + title = "Living Room"; + cards = [ + { + type = "light"; + entity = "light.living_room"; + tap_action = {action = "toggle";}; + hold_action = {action = "Default action";}; + style = { + top = "72.8%"; + left = "75.3%"; + }; + } + { + type = "light"; + entity = "light.hall_light"; + tap_action = {action = "toggle";}; + hold_action = {action = "Default action";}; + style = { + top = "72.8%"; + left = "75.3%"; + }; + } + ]; + } + { + title = "Master Bedroom"; + cards = [ + { + type = "light"; + entity = "light.master_bedroom_lamp"; + tap_action = {action = "toggle";}; + hold_action = {action = "Default action";}; + style = { + top = "72.8%"; + left = "75.3%"; + }; + } + ]; + } + { + title = "Bedroom 1"; + cards = [ + { + type = "light"; + entity = "light.bedroom_1"; + show_state = true; + show_icon = true; + tap_action = {action = "toggle";}; + hold_action = {action = "Default action";}; + style = { + top = "72.8%"; + left = "75.3%"; + }; + } + { + type = "light"; + entity = "light.light_panels_58_6c_84"; + show_state = true; + show_icon = true; + tap_action = {action = "toggle";}; + hold_action = {action = "Default action";}; + style = { + top = "72.8%"; + left = "75.3%"; + }; + } + { + type = "entities"; + entities = [ + "light.hue_color_lamp_1" + "light.hue_color_lamp_2" + "light.hue_lightstrip_plus_1" + "light.light_panels_58_6c_84" + ]; + style = { + top = "72.8%"; + left = "75.3%"; + }; + } + ]; + } + { + title = "Bedroom 2"; + cards = [ + ]; + } + ]; + }; +}