From 9e01d233aa2d14f64d738e8f24355af6cd4f54ea Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 5 Apr 2019 01:44:29 +0200 Subject: [PATCH] bureautomation: enable telegram bot --- .../bureautomation/automation/10h_timer.nix | 8 +++++- .../automation/bureau-shutdown.nix | 26 +++++++++++++------ 2configs/bureautomation/hass.nix | 13 +++++++++- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/2configs/bureautomation/automation/10h_timer.nix b/2configs/bureautomation/automation/10h_timer.nix index d86b461..dd74711 100644 --- a/2configs/bureautomation/automation/10h_timer.nix +++ b/2configs/bureautomation/automation/10h_timer.nix @@ -128,7 +128,13 @@ }; action = [ - # TODO: Pushbullet + { + 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 = [ diff --git a/2configs/bureautomation/automation/bureau-shutdown.nix b/2configs/bureautomation/automation/bureau-shutdown.nix index 28c6572..c632a9e 100644 --- a/2configs/bureautomation/automation/bureau-shutdown.nix +++ b/2configs/bureautomation/automation/bureau-shutdown.nix @@ -28,14 +28,24 @@ at = "18:00:00"; } ]; - action = { - service = "homeassistant.turn_off"; - entity_id = [ - "switch.fernseher" - "switch.feuer" - "light.status_felix" - ]; - }; + 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 = [ diff --git a/2configs/bureautomation/hass.nix b/2configs/bureautomation/hass.nix index f3a400a..4e5fe7b 100644 --- a/2configs/bureautomation/hass.nix +++ b/2configs/bureautomation/hass.nix @@ -55,9 +55,16 @@ in { notify = [ { platform = "kodi"; - name = "wbob"; + name = "wbob-kodi"; host = kodi-host; } + { + platform = "telegram"; + name = "telegrambot"; + chat_id = builtins.elemAt + (builtins.fromJSON (builtins.readFile + )).allowed_chat_ids 0; + } ]; media_player = [ { platform = "kodi"; @@ -88,6 +95,10 @@ in { logbook = {}; tts = [ { platform = "google";} ]; recorder = {}; + telegram_bot = [ + (builtins.fromJSON + (builtins.readFile )) + ]; group = { default_view = { view = "yes";