summaryrefslogtreecommitdiff
path: root/hostnix
diff options
context:
space:
mode:
Diffstat (limited to 'hostnix')
-rw-r--r--hostnix/elmo/home-assistant.nix110
1 files changed, 52 insertions, 58 deletions
diff --git a/hostnix/elmo/home-assistant.nix b/hostnix/elmo/home-assistant.nix
index 5b29a10..e4fa35d 100644
--- a/hostnix/elmo/home-assistant.nix
+++ b/hostnix/elmo/home-assistant.nix
@@ -14,9 +14,11 @@
enable = true;
extraPackages = ps: with ps; [ psycopg2 ];
extraComponents = [
+ "apple_tv"
"esphome"
"met"
"roku"
+ "spotify"
"vesync"
];
# https://nathan.gs/2023/12/28/home-assistant-add-a-custom-component-in-nixos-revisited/
@@ -143,22 +145,6 @@
}
];
-# - id: b43fdad4b27046b0a8688742daf89ba2
-# alias: Departure
-# description: ''
-# trigger:
-# - platform: zone
-# entity_id: person.joe
-# zone: zone.home
-# event: leave
-# condition: []
-# action:
-# - service: light.turn_off
-# data: {}
-# target:
-# entity_id:
-# - light.panel_light
-# mode: single
# - alias: Sound machine switch
# description: ''
# trigger:
@@ -540,7 +526,23 @@
# - stop: 'Release Radar (updates Fridays): 37i9dQZEVXbgyUT3Ewvdog'
# mode: single
- automation = [
+ automation = let
+ setTemperatureAt = at: temperature: {
+ alias = "Thermostat ${at}";
+ trigger = {
+ inherit at;
+ platform = "time";
+ };
+ action = [
+ {
+ service = "climate.set_temperature";
+ target.entity_id = "climate.bedroom";
+ data.temperature = temperature;
+ }
+ ];
+ };
+ in
+ [
{
alias = "Panel update";
trigger = [
@@ -548,20 +550,20 @@
platform = "state";
entity_id = "input_number.target_panel_brightness";
}
- # {
- # platform = "zone";
- # entity_id = "person.joe";
- # zone: "zone.home";
- # event: "enter";
- # }
+ {
+ platform = "zone";
+ entity_id = "person.joe";
+ zone = "zone.home";
+ event = "enter";
+ }
+ ];
+ condition = [
+ {
+ condition = "zone";
+ entity_id = "person.joe";
+ zone = "zone.home";
+ }
];
- # condition = [
- # {
- # condition = "zone";
- # entity_id = "person.joe";
- # zone: "zone.home";
- # }
- # ];
action = [
{
service = "light.turn_on";
@@ -571,6 +573,22 @@
];
}
{
+ alias = "Panel off";
+ trigger = {
+ platform = "zone";
+ entity_id = "person.joe";
+ zone = "zone.home";
+ event = "leave";
+ };
+ action = [
+ {
+ service = "light.turn_off";
+ target.entity_id = "light.panel_light";
+ }
+ ];
+ }
+
+ {
alias = "Sunrise";
trigger = {
platform = "sun";
@@ -652,34 +670,10 @@
];
}
- {
- alias = "Thermostat morning";
- trigger = {
- platform = "time";
- at = "06:00";
- };
- action = [
- {
- service = "climate.set_temperature";
- target.entity_id = "climate.bedroom";
- data.temperature = 71;
- }
- ];
- }
- {
- alias = "Thermostat night";
- trigger = {
- platform = "time";
- at = "23:00";
- };
- action = [
- {
- service = "climate.set_temperature";
- target.entity_id = "climate.bedroom";
- data.temperature = 69;
- }
- ];
- }
+ (setTemperatureAt "06:00" 71)
+ (setTemperatureAt "12:00" 70)
+ (setTemperatureAt "19:00" 71)
+ (setTemperatureAt "22:00" 69)
];
};
};