summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bureautomation/automation
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-04-13 14:07:30 +0200
committertv <tv@krebsco.de>2019-04-13 14:07:30 +0200
commit0430fbbbfeef5f7d6188ec70d7f084ffa1cb1a46 (patch)
tree38daa64159448bc750de5b3c6692c7e2027ed4c7 /makefu/2configs/bureautomation/automation
parent39fba33bed71c7553da47e56c5e34a0389950c71 (diff)
parentbb2f8b9b920287df33e194a3b62d86669d8e6ddd (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'makefu/2configs/bureautomation/automation')
-rw-r--r--makefu/2configs/bureautomation/automation/10h_timer.nix154
-rw-r--r--makefu/2configs/bureautomation/automation/bureau-shutdown.nix66
-rw-r--r--makefu/2configs/bureautomation/automation/nachtlicht.nix43
3 files changed, 263 insertions, 0 deletions
diff --git a/makefu/2configs/bureautomation/automation/10h_timer.nix b/makefu/2configs/bureautomation/automation/10h_timer.nix
new file mode 100644
index 000000000..dd747114e
--- /dev/null
+++ b/makefu/2configs/bureautomation/automation/10h_timer.nix
@@ -0,0 +1,154 @@
+[
+ { alias = "start Felix 10h";
+ trigger = {
+ platform = "state";
+ entity_id = [ "device_tracker.felix_phone" "device_tracker.felix_laptop" ];
+ from = "not_home";
+ to = "home";
+ };
+ condition = {
+ condition = "and";
+ conditions = [
+ {
+ condition = "state";
+ entity_id = "timer.felix_10h";
+ state = "idle";
+ }
+ {
+ condition = "time";
+ after = "06:00:00";
+ before = "12:00:00";
+ }
+ ];
+ };
+ action = [
+ { service = "timer.start";
+ entity_id = [ "timer.felix_10h" "timer.felix_8_30h" "timer.felix_7h" ] ;
+ }
+ { service = "homeassistant.turn_on";
+ entity_id = [
+ "script.buzz_red_led_fast"
+ "script.blitz_10s"
+ ];
+ }
+ { service = "light.turn_on";
+ data = {
+ effect = "2";
+ entity_id = [ "light.status_felix" ];
+ };
+ }
+ ];
+ }
+
+ { alias = "Disable Felix timer at button press";
+ trigger = {
+ platform = "state";
+ entity_id = "binary_sensor.redbutton";
+ to = "on";
+ };
+ condition = {
+ condition = "and";
+ conditions = [
+ {
+ condition = "state";
+ entity_id = "timer.felix_10h";
+ state = "active";
+ }
+ {
+ condition = "time";
+ after = "12:00:00";
+ before = "22:00:00";
+ }
+ ];
+ };
+ action =
+ [
+ {
+ service = "timer.cancel";
+ entity_id = [ "timer.felix_10h" "timer.felix_8_30h" "timer.felix_7h" ];
+ }
+ {
+ service = "homeassistant.turn_on";
+ entity_id = [ "script.buzz_red_led_fast" ];
+ }
+ {
+ service = "homeassistant.turn_off";
+ entity_id = [ "light.status_felix" ];
+ }
+ ];
+ }
+
+ {
+ alias = "Genug gearbeitet Felix";
+ trigger =
+ {
+ platform = "event";
+ event_type = "timer.finished";
+ event_data.entity_id = "timer.felix_7h";
+ };
+ action =
+ [
+ { service = "light.turn_on";
+ data = {
+ rgb_color= [0 255 0];
+ # effect = "0";
+ entity_id = [ "light.status_felix" ];
+ };
+ }
+ ];
+ }
+
+ {
+ alias = "nun aber nach hause";
+ trigger =
+ {
+ platform = "event";
+ event_type = "timer.finished";
+ event_data.entity_id = "timer.felix_8_30h";
+ };
+ action =
+ [
+ { service = "light.turn_on";
+ data = {
+ rgb_color= [255 255 0];
+ # effect = "0";
+ entity_id = [ "light.status_felix" ];
+ };
+ }
+ ];
+ }
+
+ {
+ alias = "Zu lange Felix!";
+ trigger =
+ {
+ platform = "event";
+ event_type = "timer.finished";
+ event_data.entity_id = "timer.felix_10h";
+ };
+ action =
+ [
+ {
+ service = "notify.telegrambot";
+ data = {
+ title = "Zu lange Felix!";
+ message = "Du bist schon 10 Stunden auf Arbeit, geh jetzt gefälligst nach Hause!";
+ };
+ }
+ {
+ service = "homeassistant.turn_on";
+ entity_id = [
+ "script.buzz_red_led"
+ "script.blitz_10s"
+ ];
+ }
+ { service = "light.turn_on";
+ data = {
+ rgb_color= [255 0 0];
+ effect = "0";
+ entity_id = [ "light.status_felix" ];
+ };
+ }
+ ];
+ }
+]
diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix
new file mode 100644
index 000000000..c632a9e69
--- /dev/null
+++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix
@@ -0,0 +1,66 @@
+[
+ { alias = "Turn on Fernseher on group home";
+ trigger = {
+ platform = "state";
+ entity_id = "group.team";
+ from = "not_home";
+ to = "home";
+ };
+ action = {
+ service = "homeassistant.turn_on";
+ entity_id = [
+ "switch.fernseher"
+ "switch.feuer"
+ ];
+ };
+ }
+ { alias = "Turn off Fernseher after last in group left";
+ trigger = [
+ { # trigger when movement was detected at the time
+ platform = "state";
+ entity_id = "group.team";
+ from = "home";
+ to = "not_home";
+ }
+ { # trigger at 18:00 no matter what
+ # to avoid 'everybody left before 18:00:00'
+ platform = "time";
+ at = "18:00:00";
+ }
+ ];
+ action = [
+ {
+ service = "homeassistant.turn_off";
+ entity_id = [
+ "switch.fernseher"
+ "switch.feuer"
+ "light.status_felix"
+ "light.status_daniel"
+ ];
+ }
+ {
+ service = "notify.telegrambot";
+ data = {
+ title = "Bureau Shutdown";
+ message = "All devices are turned off due to {{ trigger.platform }} - {{ trigger }}";
+ };
+ }
+ ];
+ condition =
+ { condition = "and";
+ conditions = [
+ {
+ condition = "time";
+ before = "06:30:00"; #only turn off between 6:30 and 18:00
+ after = "18:00:00";
+ # weekday = [ "mon" "tue" "wed" "thu" "fri" ];
+ }
+ { # if anybody is still there
+ condition = "state";
+ entity_id = "group.team";
+ state = "not_home";
+ }
+ ];
+ };
+ }
+]
diff --git a/makefu/2configs/bureautomation/automation/nachtlicht.nix b/makefu/2configs/bureautomation/automation/nachtlicht.nix
new file mode 100644
index 000000000..2becd4a39
--- /dev/null
+++ b/makefu/2configs/bureautomation/automation/nachtlicht.nix
@@ -0,0 +1,43 @@
+[
+ {
+ alias = "Turn off Nachtlicht on sunrise";
+ trigger =
+ {
+ platform = "sun";
+ event = "sunrise";
+ };
+ action =
+ {
+ service = "homeassistant.turn_off";
+ entity_id = [ "group.nachtlicht" ];
+ };
+ }
+
+ {
+ alias = "Turn on Nachtlicht on motion and dusk";
+ trigger =
+ {
+ platform = "state";
+ entity_id = "binary_sensor.motion";
+ to = "on";
+ };
+ condition = # 'when dark'
+ {
+ condition = "or";
+ conditions = [
+ { condition = "sun";
+ after = "sunset";
+ after_offset = "-00:45:00"; # on dusk
+ }
+ { condition = "sun";
+ before = "sunrise";
+ }
+ ];
+ };
+ action =
+ {
+ service = "homeassistant.turn_on";
+ entity_id = [ "group.nachtlicht" ];
+ };
+ }
+]