From 93e2acc9c438039abfcc8bae1f4dc33b6f6e0264 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Sun, 23 Oct 2022 10:29:58 -0700 Subject: [PATCH 1/5] feat: home-assistant companion app ble --- nixos/systems/tewi/home-assistant.nix | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/nixos/systems/tewi/home-assistant.nix b/nixos/systems/tewi/home-assistant.nix index 068a7fd5..72797926 100644 --- a/nixos/systems/tewi/home-assistant.nix +++ b/nixos/systems/tewi/home-assistant.nix @@ -49,6 +49,10 @@ in { path = "gensokyo/home-assistant"; field = "iphone-se-irk"; }; + secrets.variables.companion-pixel6 = { + path = "gensokyo/home-assistant"; + field = "companion-pixel6"; + }; secrets.variables.tile-bee = { path = "gensokyo/home-assistant"; field = "tile-bee"; @@ -70,6 +74,7 @@ in { text = let espresenceDevices = { iphone-se-irk = tf.variables.iphone-se-irk.ref; + companion-pixel6 = tf.variables.companion-pixel6.ref; tile-kat-wallet = tf.variables.tile-kat-wallet.ref; tile-kat-keys = tf.variables.tile-kat-keys.ref; tile-bee = tf.variables.tile-bee.ref; @@ -303,16 +308,23 @@ in { sensor = let mkESPresenceBeacon = { device_id, ... }@args: { platform = "mqtt_room"; - state_topic = "espresense/devices/${device_id}"; + state_topic = if hasPrefix "!secret" device_id + then "${device_id}-topic" + else "espresense/devices/${device_id}"; } // args; in [ (mkESPresenceBeacon { device_id = "!secret iphone-se-irk"; - state_topic = "!secret iphone-se-irk-topic"; name = "iPhone SE"; timeout = 2; away_timeout = 120; }) + (mkESPresenceBeacon { + device_id = "!secret companion-pixel6"; + name = "Kat's Pixel 6"; + timeout = 5; + away_timeout = 120; + }) (mkESPresenceBeacon { device_id = "name:galaxy-watch-active"; name = "Galaxy Watch Active"; @@ -331,17 +343,14 @@ in { }) (mkESPresenceBeacon { device_id = "!secret tile-bee"; - state_topic = "!secret tile-bee-topic"; name = "Bee"; }) (mkESPresenceBeacon { device_id = "!secret tile-kat-wallet"; - state_topic = "!secret tile-kat-wallet-topic"; name = "Kat's Wallet"; }) (mkESPresenceBeacon { device_id = "!secret tile-kat-keys"; - state_topic = "!secret tile-kat-keys-topic"; name = "Girlwife"; }) ]; From 38e354f111d0cb62dfe6f41200369ab9a083ca6e Mon Sep 17 00:00:00 2001 From: arcnmx Date: Sun, 23 Oct 2022 10:33:59 -0700 Subject: [PATCH 2/5] feat: manual hass configuration --- nixos/systems/tewi/home-assistant.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nixos/systems/tewi/home-assistant.nix b/nixos/systems/tewi/home-assistant.nix index 72797926..82d9c049 100644 --- a/nixos/systems/tewi/home-assistant.nix +++ b/nixos/systems/tewi/home-assistant.nix @@ -96,13 +96,16 @@ in { cp --no-preserve=mode ${config.secrets.files.home-assistant-secrets.path} ${config.services.home-assistant.configDir}/secrets.yaml cp --no-preserve=mode ${config.secrets.files.ha-integration.path} ${config.services.home-assistant.configDir}/integration.yaml # UI-editable config files - touch ${config.services.home-assistant.configDir}/{automations,scenes,scripts}.yaml + touch ${config.services.home-assistant.configDir}/{automations,scenes,scripts,manual}.yaml ''; }; services.home-assistant = { enable = true; config = { + packages = { + manual = "!include manual.yaml"; + }; homeassistant = { name = "Gensokyo"; unit_system = "metric"; From 69d779938af9990723ab950036929f6d24fa734c Mon Sep 17 00:00:00 2001 From: arcnmx Date: Sun, 23 Oct 2022 10:36:53 -0700 Subject: [PATCH 3/5] feat: living room bookshelf lighting --- nixos/systems/tewi/home-assistant.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/systems/tewi/home-assistant.nix b/nixos/systems/tewi/home-assistant.nix index 82d9c049..8df61ae1 100644 --- a/nixos/systems/tewi/home-assistant.nix +++ b/nixos/systems/tewi/home-assistant.nix @@ -209,6 +209,7 @@ in { "TV Backlight" ]; }; + "light.living_bookshelf".room = hidden; # midea "climate.living_ac".aliases = [ "AC" From 28c92dcc6cde442f49c798ec473969d26702f3fd Mon Sep 17 00:00:00 2001 From: arcnmx Date: Sun, 23 Oct 2022 10:50:13 -0700 Subject: [PATCH 4/5] feat: more lights --- nixos/systems/tewi/home-assistant.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nixos/systems/tewi/home-assistant.nix b/nixos/systems/tewi/home-assistant.nix index 8df61ae1..7adc94a8 100644 --- a/nixos/systems/tewi/home-assistant.nix +++ b/nixos/systems/tewi/home-assistant.nix @@ -217,10 +217,21 @@ in { ]; "sensor.living_ac_outdoor_temperature".expose = false; + # kitchen + "light.kitchen_overhead".expose = true; + "light.kitchen_overhead_inner".room = hidden; + "light.kitchen_overhead_middle".room = hidden; + "light.kitchen_overhead_outer".room = hidden; + # balcony "light.outdoor_strip".expose = true; "light.lantern".expose = true; + # foyer + "light.entry_overhead".expose = true; + "light.entry_overhead_left".room = hidden; + "light.entry_overhead_right".room = hidden; + # shanghai systemd "switch.shanghai_graphical".expose = true; "switch.shanghai_mradio".expose = true; @@ -250,6 +261,8 @@ in { "light.living_cluster" "light.bedroom_overhead" "light.closet_overhead" + "light.kitchen_overhead" + "light.entry_overhead" ]); }; entity_config = { From b5c029153623eb167b115f90d6e048018b1b2b32 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Mon, 24 Oct 2022 08:37:12 -0700 Subject: [PATCH 5/5] feat: rename hass entity --- nixos/systems/tewi/home-assistant.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nixos/systems/tewi/home-assistant.nix b/nixos/systems/tewi/home-assistant.nix index 7adc94a8..d9497267 100644 --- a/nixos/systems/tewi/home-assistant.nix +++ b/nixos/systems/tewi/home-assistant.nix @@ -190,7 +190,13 @@ in { "light.closet_overhead".expose = true; "light.closet_overhead_left".room = hidden; "light.closet_overhead_right".room = hidden; - "fan.fornuftig_fan".expose = true; + "fan.bedroom_purifier" = { + expose = true; + aliases = [ + "FĂ–RNUFTIG" + "Bedroom Air Purifier" + ]; + }; "fan.bedroom_floor".expose = true; "switch.swb1_relay_3".expose = true; "switch.swb1_relay_4".expose = true;