summaryrefslogtreecommitdiff
path: root/hostnix/elmo/home-assistant.nix
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2024-06-12 18:26:43 -0400
committerJoe Mou <dev@mou.fo>2024-10-09 13:48:40 -0400
commit0bc287a042c742c4dd24b9b24fd5e9aeb2523113 (patch)
treeab71fb4b1353028f54b09aa7e718d1dbf6fba749 /hostnix/elmo/home-assistant.nix
parent670fc9ce79019e108abd1a2467f9ef362fdcc619 (diff)
HA: adaptive_lighting custom component to follow daylight
Diffstat (limited to 'hostnix/elmo/home-assistant.nix')
-rw-r--r--hostnix/elmo/home-assistant.nix123
1 files changed, 25 insertions, 98 deletions
diff --git a/hostnix/elmo/home-assistant.nix b/hostnix/elmo/home-assistant.nix
index 35f0e70..7facdd4 100644
--- a/hostnix/elmo/home-assistant.nix
+++ b/hostnix/elmo/home-assistant.nix
@@ -23,9 +23,11 @@
];
# https://nathan.gs/2023/12/28/home-assistant-add-a-custom-component-in-nixos-revisited/
customComponents = with pkgs.home-assistant-custom-components; [
+ adaptive_lighting
auth-header
tuya_local
];
+
config = {
default_config = { };
http = {
@@ -44,11 +46,12 @@
# value_template: "{{ state_attr('weather.knyc_daynight', 'forecast')[1]['precipitation_probability']|float > 0 or state_attr('weather.knyc_daynight', 'forecast')[2]['precipitation_probability']|float > 0 }}"
# #value_template: "{{ states('sensor.dark_sky_precip_probability_0d')|float > 5 }}"
- input_number.target_panel_brightness = {
- name = "Target panel brightness";
- min = 0;
- max = 100;
- icon = "mdi:lightbulb-on-outline";
+ adaptive_lighting = {
+ lights = [
+ "light.grow_light"
+ "light.panel_light"
+ ];
+ max_color_temp = 3500;
};
climate = [
@@ -402,52 +405,6 @@
in
[
{
- alias = "Panel update";
- trigger = [
- {
- platform = "state";
- entity_id = "input_number.target_panel_brightness";
- }
- {
- platform = "zone";
- entity_id = "person.joe";
- zone = "zone.home";
- event = "enter";
- }
- ];
- condition = [
- {
- condition = "zone";
- entity_id = "person.joe";
- zone = "zone.home";
- }
- ];
- action = [
- {
- service = "light.turn_on";
- target.entity_id = "light.panel_light";
- data.brightness_pct = "{{ states('input_number.target_panel_brightness')|float * 0.9 + 10 }}";
- }
- ];
- }
- {
- alias = "Grow light update";
- trigger = [
- {
- platform = "state";
- entity_id = "input_number.target_panel_brightness";
- }
- ];
- action = [
- {
- service = "light.turn_on";
- target.entity_id = "light.grow_light";
- data.brightness_pct = "{{ states('input_number.target_panel_brightness') }}";
- }
- ];
- }
-
- {
alias = "Depart";
trigger = {
platform = "zone";
@@ -461,61 +418,28 @@
}
{
- alias = "Sunrise";
- trigger = {
- platform = "sun";
- event = "sunrise";
- };
- action = [
+ alias = "Arrive/Sunrise";
+ trigger = [
{
- service = "input_number.set_value";
- target.entity_id = "input_number.target_panel_brightness";
- data.value = 15;
+ platform = "sun";
+ event = "sunrise";
}
- ];
- }
- {
- alias = "Sunrise after";
- trigger = {
- platform = "sun";
- event = "sunrise";
- offset = "1:00";
- };
- action = [
{
- service = "input_number.set_value";
- target.entity_id = "input_number.target_panel_brightness";
- data.value = 100;
+ platform = "zone";
+ entity_id = "person.joe";
+ zone = "zone.home";
+ event = "enter";
}
];
- }
- {
- alias = "Sunset before";
- trigger = {
- platform = "sun";
- event = "sunset";
- offset = "-1:00";
- };
- action = [
+ condition = [
{
- service = "input_number.set_value";
- target.entity_id = "input_number.target_panel_brightness";
- data.value = 15;
+ condition = "zone";
+ entity_id = "person.joe";
+ zone = "zone.home";
}
];
- }
- {
- alias = "Sunset";
- trigger = {
- platform = "sun";
- event = "sunset";
- };
action = [
- {
- service = "input_number.set_value";
- target.entity_id = "input_number.target_panel_brightness";
- data.value = 0;
- }
+ (service "light.turn_on" "light.panel_light")
];
}
@@ -525,7 +449,10 @@
platform = "time";
at = "08:00";
};
- action = [ (service "switch.turn_on" "switch.wakko") ];
+ action = [
+ (service "switch.turn_on" "light.grow_light")
+ (service "switch.turn_on" "switch.wakko")
+ ];
}
{
alias = "Grow light night";