summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/shack/glados/multi
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2019-09-06 01:07:20 +0200
committermakefu <github@syntax-fehler.de>2019-09-06 01:08:32 +0200
commitfce2c4275caf7df064fb13a4280291a9aefaef1f (patch)
treeb74e266f9b3776ff5b01e45ef68778fc1119bc61 /krebs/2configs/shack/glados/multi
parent39b1e08ad1358cc54527e9b87cb5fbc01349b62e (diff)
shack/glados: init shackopen and auto watering
Diffstat (limited to 'krebs/2configs/shack/glados/multi')
-rw-r--r--krebs/2configs/shack/glados/multi/shackopen.nix23
-rw-r--r--krebs/2configs/shack/glados/multi/wasser.nix65
2 files changed, 88 insertions, 0 deletions
diff --git a/krebs/2configs/shack/glados/multi/shackopen.nix b/krebs/2configs/shack/glados/multi/shackopen.nix
new file mode 100644
index 000000000..354405d06
--- /dev/null
+++ b/krebs/2configs/shack/glados/multi/shackopen.nix
@@ -0,0 +1,23 @@
+{
+ 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
new file mode 100644
index 000000000..a2c80851b
--- /dev/null
+++ b/krebs/2configs/shack/glados/multi/wasser.nix
@@ -0,0 +1,65 @@
+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;
+ };
+in
+{
+ switch = [
+ (tasmota_plug "Wasser" "plug")
+ ];
+ automation =
+ [
+ { alias = "Water the plant for 10 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 = [
+ "switch.wasser"
+ ];
+ }
+ { delay.seconds = 10; }
+ {
+ service = "homeassistant.turn_off";
+ entity_id = [
+ "switch.wasser"
+ ];
+ }
+ ];
+ }
+ { alias = "Always turn off water after 15 seconds";
+ trigger = [
+ {
+ platform = "state";
+ entity_id = "switch.wasser";
+ to = "on";
+ for.seconds = 15;
+ }
+ ];
+ action =
+ [
+ {
+ service = "homeassistant.turn_off";
+ entity_id = [ "switch.wasser" ];
+ }
+ ];
+ }
+ ];
+}