diff options
Diffstat (limited to 'krebs/2configs/shack/glados/multi')
-rw-r--r-- | krebs/2configs/shack/glados/multi/rollos.nix | 77 | ||||
-rw-r--r-- | krebs/2configs/shack/glados/multi/schlechte_luft.nix | 181 | ||||
-rw-r--r-- | krebs/2configs/shack/glados/multi/shackopen.nix | 45 | ||||
-rw-r--r-- | krebs/2configs/shack/glados/multi/wasser.nix | 181 |
4 files changed, 248 insertions, 236 deletions
diff --git a/krebs/2configs/shack/glados/multi/rollos.nix b/krebs/2configs/shack/glados/multi/rollos.nix index 4e6494936..29525ad82 100644 --- a/krebs/2configs/shack/glados/multi/rollos.nix +++ b/krebs/2configs/shack/glados/multi/rollos.nix @@ -11,46 +11,49 @@ let ]; in { - automation = - [ - { alias = "Rollos fahren Runter"; - trigger = [ - { - platform = "numeric_state"; - entity_id = tempsensor; - above = 25; - for = "00:30:00"; - } - ]; - condition = - [ + services.home-assistant.config = + { + automation = + [ + { alias = "Rollos fahren Runter"; + trigger = [ { - condition = "state"; - entity_id = "sun.sun"; - state = "above_horizon"; - } - ]; - action = - [ - { service = "cover.close_cover"; - entity_id = all_covers; + platform = "numeric_state"; + entity_id = tempsensor; + above = 25; + for = "00:30:00"; } ]; - } - { alias = "Rollos fahren Hoch"; - trigger = [ - { - platform = "sun"; - event = "sunset"; - } - ]; - condition = [ ]; - action = - [ - { service = "cover.open_cover"; - entity_id = all_covers; + condition = + [ + { + condition = "state"; + entity_id = "sun.sun"; + state = "above_horizon"; + } + ]; + action = + [ + { service = "cover.close_cover"; + entity_id = all_covers; + } + ]; + } + { alias = "Rollos fahren Hoch"; + trigger = [ + { + platform = "sun"; + event = "sunset"; } ]; - } - ]; + condition = [ ]; + action = + [ + { service = "cover.open_cover"; + entity_id = all_covers; + } + ]; + } + ]; + }; } diff --git a/krebs/2configs/shack/glados/multi/schlechte_luft.nix b/krebs/2configs/shack/glados/multi/schlechte_luft.nix index 31373d7b9..c1890361b 100644 --- a/krebs/2configs/shack/glados/multi/schlechte_luft.nix +++ b/krebs/2configs/shack/glados/multi/schlechte_luft.nix @@ -4,103 +4,106 @@ let ledring = "light.fablab_led_ring"; in { - automation = - [ - { alias = "Gute Luft Fablab"; - trigger = [ - { - platform = "numeric_state"; - entity_id = feinstaub_sensor; - below = 3; - } - ]; - action = - [ - { service = "light.turn_on"; - data = { - entity_id = ledring; - effect = "Twinkle"; - color_name = "green"; - }; + services.home-assistant.config = + { + automation = + [ + { alias = "Gute Luft Fablab"; + trigger = [ + { + platform = "numeric_state"; + entity_id = feinstaub_sensor; + below = 3; } ]; - } - { alias = "mäßige Luft Fablab"; - trigger = [ - { - platform = "numeric_state"; - above = 3; - below = 10; - entity_id = feinstaub_sensor; - } - ]; - action = - [ - { service = "light.turn_on"; - data = { - entity_id = ledring; - effect = "Twinkle"; - color_name = "yellow"; - }; + action = + [ + { service = "light.turn_on"; + data = { + entity_id = ledring; + effect = "Twinkle"; + color_name = "green"; + }; + } + ]; + } + { alias = "mäßige Luft Fablab"; + trigger = [ + { + platform = "numeric_state"; + above = 3; + below = 10; + entity_id = feinstaub_sensor; } ]; - } - { alias = "schlechte Luft Fablab"; - trigger = [ - { - platform = "numeric_state"; - above = 10; - entity_id = feinstaub_sensor; - } - ]; - action = - [ - { service = "light.turn_on"; - data = { - entity_id = ledring; - effect = "Fireworks"; - color_name = "red"; - }; + action = + [ + { service = "light.turn_on"; + data = { + entity_id = ledring; + effect = "Twinkle"; + color_name = "yellow"; + }; + } + ]; + } + { alias = "schlechte Luft Fablab"; + trigger = [ + { + platform = "numeric_state"; + above = 10; + entity_id = feinstaub_sensor; } ]; - } - { alias = "Luft Sensor nicht verfügbar"; - trigger = [ - { - platform = "state"; - to = "unavailable"; - entity_id = feinstaub_sensor; - } - ]; - action = - [ - { service = "light.turn_on"; - data = { - entity_id = ledring; - effect = "Rainbow"; - color_name = "blue"; - }; + action = + [ + { service = "light.turn_on"; + data = { + entity_id = ledring; + effect = "Fireworks"; + color_name = "red"; + }; + } + ]; + } + { alias = "Luft Sensor nicht verfügbar"; + trigger = [ + { + platform = "state"; + to = "unavailable"; + entity_id = feinstaub_sensor; } ]; - } - { alias = "Fablab Licht Reboot"; - trigger = [ - { - platform = "state"; - from = "unavailable"; - entity_id = ledring; - } - ]; - action = - [ - { service = "light.turn_on"; - data = { - entity_id = ledring; - effect = "Rainbow"; - color_name = "orange"; - }; + action = + [ + { service = "light.turn_on"; + data = { + entity_id = ledring; + effect = "Rainbow"; + color_name = "blue"; + }; + } + ]; + } + { alias = "Fablab Licht Reboot"; + trigger = [ + { + platform = "state"; + from = "unavailable"; + entity_id = ledring; } ]; - } - ]; + action = + [ + { service = "light.turn_on"; + data = { + entity_id = ledring; + effect = "Rainbow"; + color_name = "orange"; + }; + } + ]; + } + ]; + }; } diff --git a/krebs/2configs/shack/glados/multi/shackopen.nix b/krebs/2configs/shack/glados/multi/shackopen.nix index 354405d06..d9be9adfa 100644 --- a/krebs/2configs/shack/glados/multi/shackopen.nix +++ b/krebs/2configs/shack/glados/multi/shackopen.nix @@ -1,23 +1,26 @@ { - binary_sensor = [ - { platform = "mqtt"; - name = "Portal Lock"; - device_class = "door"; - state_topic = "portal/gateway/status"; - availability_topic = "portal/gateway/lwt"; - payload_on = "open"; - payload_off = "closed"; - payload_available = "online"; - payload_not_available = "offline"; - } - ]; - sensor = [ - { platform = "mqtt"; - name = "Keyholder"; - state_topic = "portal/gateway/keyholder"; - availability_topic = "portal/gateway/lwt"; - payload_available = "online"; - payload_not_available = "offline"; - } - ]; + services.home-assistant.config = + { + binary_sensor = [ + { platform = "mqtt"; + name = "Portal Lock"; + device_class = "door"; + state_topic = "portal/gateway/status"; + availability_topic = "portal/gateway/lwt"; + payload_on = "open"; + payload_off = "closed"; + payload_available = "online"; + payload_not_available = "offline"; + } + ]; + sensor = [ + { platform = "mqtt"; + name = "Keyholder"; + state_topic = "portal/gateway/keyholder"; + availability_topic = "portal/gateway/lwt"; + payload_available = "online"; + payload_not_available = "offline"; + } + ]; + }; } 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 ]; + } + ]; + } + ]; + }; } |