summaryrefslogtreecommitdiffstats
path: root/krebs/2configs
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/2configs')
-rw-r--r--krebs/2configs/shack/glados/default.nix1
-rw-r--r--krebs/2configs/shack/glados/lib/default.nix46
-rw-r--r--krebs/2configs/shack/glados/multi/schlechte_luft.nix19
-rw-r--r--krebs/2configs/shack/glados/multi/wasser.nix17
-rw-r--r--krebs/2configs/shack/glados/sensors/hass.nix23
5 files changed, 72 insertions, 34 deletions
diff --git a/krebs/2configs/shack/glados/default.nix b/krebs/2configs/shack/glados/default.nix
index d000af397..2c9a01af3 100644
--- a/krebs/2configs/shack/glados/default.nix
+++ b/krebs/2configs/shack/glados/default.nix
@@ -2,6 +2,7 @@
let
shackopen = import ./multi/shackopen.nix;
wasser = import ./multi/wasser.nix;
+ badair = import ./multi/schlechte_luft.nix;
in {
services.nginx.virtualHosts."hass.shack" = {
serverAliases = [ "glados.shack" ];
diff --git a/krebs/2configs/shack/glados/lib/default.nix b/krebs/2configs/shack/glados/lib/default.nix
new file mode 100644
index 000000000..debe8e5c2
--- /dev/null
+++ b/krebs/2configs/shack/glados/lib/default.nix
@@ -0,0 +1,46 @@
+let
+ lib = import <nixpkgs/lib>;
+ prefix = "glados";
+in
+{
+ esphome =
+ {
+ temp = name:
+ {
+ platform = "mqtt";
+ name = "${name} Temperature";
+ device_class = "temperature";
+ state_topic = "${prefix}/${name}/sensor/temperature/state";
+ availability_topic = "${prefix}/${name}/status";
+ payload_available = "online";
+ payload_not_available = "offline";
+ };
+ hum = name:
+ {
+ platform = "mqtt";
+ device_class = "humidity";
+ name = "${name} Humidity";
+ state_topic = "${prefix}/${name}/sensor/humidity/state";
+ availability_topic = "${prefix}/${name}/status";
+ payload_available = "online";
+ payload_not_available = "offline";
+ };
+ };
+ tasmota =
+ {
+ plug = name: topic:
+ {
+ platform = "mqtt";
+ inherit name;
+ state_topic = "sonoff/stat/${topic}/POWER1";
+ command_topic = "sonoff/cmnd/${topic}/POWER1";
+ availability_topic = "sonoff/tele/${topic}/LWT";
+ payload_on= "ON";
+ payload_off= "OFF";
+ payload_available= "Online";
+ payload_not_available= "Offline";
+ retain = false;
+ qos = 1;
+ };
+ };
+}
diff --git a/krebs/2configs/shack/glados/multi/schlechte_luft.nix b/krebs/2configs/shack/glados/multi/schlechte_luft.nix
new file mode 100644
index 000000000..94cb768b9
--- /dev/null
+++ b/krebs/2configs/shack/glados/multi/schlechte_luft.nix
@@ -0,0 +1,19 @@
+let
+ airlevel = name: threshold: color:
+ { alias = "${name} Air trigger ${color}";
+ trigger = [
+ ];
+ action =
+ [
+ # create spark effect with color
+ ];
+ };
+in
+{
+ # LED
+ switch = [
+ ];
+ automation =
+ [
+ ];
+}
diff --git a/krebs/2configs/shack/glados/multi/wasser.nix b/krebs/2configs/shack/glados/multi/wasser.nix
index 578bb0750..e3e7eb2a0 100644
--- a/krebs/2configs/shack/glados/multi/wasser.nix
+++ b/krebs/2configs/shack/glados/multi/wasser.nix
@@ -1,23 +1,12 @@
let
- tasmota_plug = name: topic:
- { platform = "mqtt";
- inherit name;
- state_topic = "sonoff/stat/${topic}/POWER1";
- command_topic = "sonoff/cmnd/${topic}/POWER1";
- availability_topic = "sonoff/tele/${topic}/LWT";
- payload_on= "ON";
- payload_off= "OFF";
- payload_available= "Online";
- payload_not_available= "Offline";
- retain = false;
- qos = 1;
- };
+ glados = import ../lib;
seconds = 20;
in
{
switch = [
- (tasmota_plug "Wasser" "plug")
+ (glados.tasmota.plug "Wasser" "plug")
];
+
automation =
[
{ alias = "Water the plant for ${toString seconds} seconds";
diff --git a/krebs/2configs/shack/glados/sensors/hass.nix b/krebs/2configs/shack/glados/sensors/hass.nix
index 634758701..ced6d9752 100644
--- a/krebs/2configs/shack/glados/sensors/hass.nix
+++ b/krebs/2configs/shack/glados/sensors/hass.nix
@@ -1,22 +1,5 @@
let
- esphome_temp = name:
- { platform = "mqtt";
- name = "${name} Temperature";
- device_class = "temperature";
- state_topic = "glados/${name}/sensor/temperature/state";
- availability_topic = "glados/${name}/status";
- payload_available = "online";
- payload_not_available = "offline";
- };
- esphome_hum = name:
- { platform = "mqtt";
- device_class = "humidity";
- name = "${name} Humidity";
- state_topic = "glados/${name}/sensor/humidity/state";
- availability_topic = "glados/${name}/status";
- payload_available = "online";
- payload_not_available = "offline";
- };
+ glados = import ../lib;
in
- (map esphome_temp [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])
- ++ (map esphome_hum [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])
+ (map glados.esphome.temp [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])
+ ++ (map glados.esphome.hum [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])