diff options
author | tv <tv@krebsco.de> | 2019-04-13 14:07:30 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2019-04-13 14:07:30 +0200 |
commit | 0430fbbbfeef5f7d6188ec70d7f084ffa1cb1a46 (patch) | |
tree | 38daa64159448bc750de5b3c6692c7e2027ed4c7 /makefu/2configs/bureautomation/automation/bureau-shutdown.nix | |
parent | 39fba33bed71c7553da47e56c5e34a0389950c71 (diff) | |
parent | bb2f8b9b920287df33e194a3b62d86669d8e6ddd (diff) |
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'makefu/2configs/bureautomation/automation/bureau-shutdown.nix')
-rw-r--r-- | makefu/2configs/bureautomation/automation/bureau-shutdown.nix | 66 |
1 files changed, 66 insertions, 0 deletions
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"; + } + ]; + }; + } +] |