diff options
author | makefu <github@syntax-fehler.de> | 2020-11-18 20:50:43 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2020-11-18 20:51:14 +0100 |
commit | a54974412751c98dec78b5e3977afc4a97aadea9 (patch) | |
tree | a096472a2c762f04a67a795a922f26259517dd7a /makefu/2configs/bureautomation/automation/bureau-shutdown.nix | |
parent | f66309f0289c76dc9797573a73acbad186f4e380 (diff) |
ma bureautomation: move to 20.09 style imports
Diffstat (limited to 'makefu/2configs/bureautomation/automation/bureau-shutdown.nix')
-rw-r--r-- | makefu/2configs/bureautomation/automation/bureau-shutdown.nix | 157 |
1 files changed, 80 insertions, 77 deletions
diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix index b9aa710c3..f4c10adc8 100644 --- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix +++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix @@ -1,84 +1,87 @@ -[ - { alias = "Turn on Fernseher on group home"; - trigger = { - platform = "state"; - entity_id = "group.team"; - from = "not_home"; - to = "home"; - for.seconds = 30; - }; - action = [ - { - service = "homeassistant.turn_on"; - entity_id = [ - "switch.fernseher" - "switch.feuer" - ]; - } - { - service = "media_player.kodi_call_method"; - data = { - entity_id = "media_player.kodi"; - method = "Player.Open"; - item.partymode = "music"; - }; - } - { - service = "notify.telegrambot"; - data = { - title = "Bureau Startup"; - message = "Das Büro wurde eröffnet"; - }; - } - ]; - } - { alias = "Turn off Fernseher after last in group left"; - trigger = [ - { # trigger when movement was detected at the time +{ + services.home-assistant.config.automation = + [ + { alias = "Turn on Fernseher on group home"; + trigger = { 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_template = { - title = "Bureau Shutdown"; - message = "All devices are turned off due to {{ trigger.platform }}"; - }; - } - ]; - condition = - { condition = "and"; - conditions = [ + from = "not_home"; + to = "home"; + for.seconds = 30; + }; + action = [ + { + service = "homeassistant.turn_on"; + entity_id = [ + "switch.fernseher" + "switch.feuer" + ]; + } { - 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" ]; + service = "media_player.kodi_call_method"; + data = { + entity_id = "media_player.kodi"; + method = "Player.Open"; + item.partymode = "music"; + }; } - { # if anybody is still there - condition = "state"; + { + service = "notify.telegrambot"; + data = { + title = "Bureau Startup"; + message = "Das Büro wurde eröffnet"; + }; + } + ]; + } + { alias = "Turn off Fernseher after last in group left"; + trigger = [ + { # trigger when movement was detected at the time + platform = "state"; entity_id = "group.team"; - state = "not_home"; + 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_template = { + title = "Bureau Shutdown"; + message = "All devices are turned off due to {{ trigger.platform }}"; + }; + } + ]; + 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"; + } + ]; + }; + } + ]; +} |