summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/shack/glados/multi/wasser.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2021-01-18 15:24:18 +0100
committertv <tv@krebsco.de>2021-01-18 15:24:18 +0100
commitff6f5ef5e1cdbd27b2211c54643fa2754f888cbb (patch)
treeb33763a7ac8040efe988f8bed2fe1c649cc155dd /krebs/2configs/shack/glados/multi/wasser.nix
parent7b7ebd8708885633c926c21a4b71d5d4ce8931cf (diff)
parent2a32b7731496615e43a06ec1049f6716c49a1999 (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'krebs/2configs/shack/glados/multi/wasser.nix')
-rw-r--r--krebs/2configs/shack/glados/multi/wasser.nix181
1 files changed, 92 insertions, 89 deletions
diff --git a/krebs/2configs/shack/glados/multi/wasser.nix b/krebs/2configs/shack/glados/multi/wasser.nix
index bd8252e1c..9ca5e4500 100644
--- a/krebs/2configs/shack/glados/multi/wasser.nix
+++ b/krebs/2configs/shack/glados/multi/wasser.nix
@@ -11,100 +11,103 @@ let
};
in
{
- sensor = map ( entity_id: {
- platform = "statistics";
- name = "Statistics for ${entity_id}";
- inherit entity_id;
- max_age.minutes = "60";
- sampling_size = 1000;
- }) ["sensor.crafting_brotbox_soil_moisture"];
+ services.home-assistant.config =
+ {
+ sensor = map ( entity_id: {
+ platform = "statistics";
+ name = "Statistics for ${entity_id}";
+ inherit entity_id;
+ max_age.minutes = "60";
+ sampling_size = 1000;
+ }) ["sensor.crafting_brotbox_soil_moisture"];
- automation =
- [
- ### Brotbox #####
- #{ alias = "Brotbox: water for ${toString brotbox.minutes} minutes every hour";
- # trigger =
- # { # Trigger once every hour at :42
- # platform = "time_pattern";
- # minutes = 42;
- # };
- # condition = {
- # condition = "numeric_state";
- # entity_id = brotbox.sensor;
- # value_template = "{{ state_attr('${brotbox.sensor}', 'median') }}";
- # below = 75;
- # };
- # action =
- # [
- # {
- # service = "homeassistant.turn_on";
- # entity_id = brotbox.pump;
- # }
- # { delay.minutes = brotbox.minutes; }
- # {
- # service = "homeassistant.turn_off";
- # entity_id = brotbox.pump ;
- # }
- # ];
- #}
- { alias = "Brotbox: Always turn off water after ${toString (brotbox.minutes * 2)} minutes";
- trigger =
- {
- platform = "state";
- entity_id = brotbox.pump;
- to = "on";
- for.minutes = brotbox.minutes*2;
- };
- action =
- {
- service = "homeassistant.turn_off";
- entity_id = brotbox.pump;
- };
- }
-
- ##### Kaffeemaschine
- { alias = "Water the plant for ${toString seconds} seconds";
- trigger = [
- { # trigger at 20:00 no matter what
- # TODO: retry or run only if switch.wasser is available
- platform = "time";
- at = "20:00:00";
- }
- ];
- action =
- [
- {
- service = "homeassistant.turn_on";
- entity_id = [
- wasser
- ];
- }
- { delay.seconds = seconds; }
- {
- service = "homeassistant.turn_off";
- entity_id = [
- wasser
- ];
- }
- ];
- }
- { alias = "Always turn off water after ${toString (seconds * 2)}seconds";
- trigger = [
+ automation =
+ [
+ ### Brotbox #####
+ #{ alias = "Brotbox: water for ${toString brotbox.minutes} minutes every hour";
+ # trigger =
+ # { # Trigger once every hour at :42
+ # platform = "time_pattern";
+ # minutes = 42;
+ # };
+ # condition = {
+ # condition = "numeric_state";
+ # entity_id = brotbox.sensor;
+ # value_template = "{{ state_attr('${brotbox.sensor}', 'median') }}";
+ # below = 75;
+ # };
+ # action =
+ # [
+ # {
+ # service = "homeassistant.turn_on";
+ # entity_id = brotbox.pump;
+ # }
+ # { delay.minutes = brotbox.minutes; }
+ # {
+ # service = "homeassistant.turn_off";
+ # entity_id = brotbox.pump ;
+ # }
+ # ];
+ #}
+ { alias = "Brotbox: Always turn off water after ${toString (brotbox.minutes * 2)} minutes";
+ trigger =
{
platform = "state";
- entity_id = wasser;
+ entity_id = brotbox.pump;
to = "on";
- for.seconds = seconds*2;
- }
- ];
- action =
- [
+ for.minutes = brotbox.minutes*2;
+ };
+ action =
{
service = "homeassistant.turn_off";
- entity_id = [ wasser ];
- }
- ];
- }
- ];
+ entity_id = brotbox.pump;
+ };
+ }
+
+ ##### Kaffeemaschine
+ { alias = "Water the plant for ${toString seconds} seconds";
+ trigger = [
+ { # trigger at 20:00 no matter what
+ # TODO: retry or run only if switch.wasser is available
+ platform = "time";
+ at = "20:00:00";
+ }
+ ];
+ action =
+ [
+ {
+ service = "homeassistant.turn_on";
+ entity_id = [
+ wasser
+ ];
+ }
+ { delay.seconds = seconds; }
+ {
+ service = "homeassistant.turn_off";
+ entity_id = [
+ wasser
+ ];
+ }
+ ];
+ }
+ { alias = "Always turn off water after ${toString (seconds * 2)}seconds";
+ trigger = [
+ {
+ platform = "state";
+ entity_id = wasser;
+ to = "on";
+ for.seconds = seconds*2;
+ }
+ ];
+ action =
+ [
+ {
+ service = "homeassistant.turn_off";
+ entity_id = [ wasser ];
+ }
+ ];
+ }
+ ];
+ };
}