diff options
author | tv <tv@krebsco.de> | 2019-04-17 22:04:03 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2019-04-17 22:04:03 +0200 |
commit | ffd36f5554256f74beb6ade469666b00f72b22a9 (patch) | |
tree | 51e77c75388d9f9e032bdb09427bcaace2b846c7 /makefu/2configs/bureautomation/automation | |
parent | e051fecf9c19d446d6588bd21070fd1a799b97a3 (diff) | |
parent | 1314eb9284697b46d8208c138cf2349816e15c5f (diff) |
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'makefu/2configs/bureautomation/automation')
3 files changed, 97 insertions, 48 deletions
diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix index c632a9e69..d54d9762a 100644 --- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix +++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix @@ -5,14 +5,40 @@ entity_id = "group.team"; from = "not_home"; to = "home"; + for.seconds = 30; }; - action = { - service = "homeassistant.turn_on"; - entity_id = [ - "switch.fernseher" - "switch.feuer" - ]; - }; + 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 = "tts.google_say"; + entity_id = "media_player.kodi"; + data = { + message = "Willkommen in deinem Lieblingsbüro"; + language = "de"; + }; + } + { + service = "notify.telegrambot"; + data = { + title = "Bureau Startup"; + message = "Willkommen {{ trigger.platform }}"; + }; + } + ]; } { alias = "Turn off Fernseher after last in group left"; trigger = [ @@ -42,7 +68,7 @@ service = "notify.telegrambot"; data = { title = "Bureau Shutdown"; - message = "All devices are turned off due to {{ trigger.platform }} - {{ trigger }}"; + message = "All devices are turned off due to {{ trigger.platform }}"; }; } ]; diff --git a/makefu/2configs/bureautomation/automation/hass-restart.nix b/makefu/2configs/bureautomation/automation/hass-restart.nix new file mode 100644 index 000000000..be16f6966 --- /dev/null +++ b/makefu/2configs/bureautomation/automation/hass-restart.nix @@ -0,0 +1,31 @@ +[ + { alias = "State on HA start-up"; + trigger = { + platform = "homeassistant"; + event = "start"; + }; + action = [ + # Startup State + { service = "mqtt.publish"; + data = { + topic = "/bam/sonoffs/cmnd/state"; + payload = ""; + }; + } + # Firmware Version + { service = "mqtt.publish"; + data = { + topic = "/bam/sonoffs/cmnd/status"; + payload = "2"; + }; + } + # Will trigger restart of all devices! + #{ service = "mqtt.publish"; + # data = { + # topic = "sonoffs/cmnd/SetOption59"; # configure sending state on power change + # payload = "1"; + # }; + #} + ]; + } +] diff --git a/makefu/2configs/bureautomation/automation/nachtlicht.nix b/makefu/2configs/bureautomation/automation/nachtlicht.nix index 2becd4a39..ec6fa20c7 100644 --- a/makefu/2configs/bureautomation/automation/nachtlicht.nix +++ b/makefu/2configs/bureautomation/automation/nachtlicht.nix @@ -1,43 +1,35 @@ [ - { - alias = "Turn off Nachtlicht on sunrise"; - trigger = - { - platform = "sun"; - event = "sunrise"; - }; - action = - { - service = "homeassistant.turn_off"; - entity_id = [ "group.nachtlicht" ]; - }; - } + # TODO: trigger if it is before dusk and somebody arives but nachtlichter are + # off from last day + # TODO: do not have nachtlicht turned on at night + { + alias = "Turn on Nachtlicht at dusk"; # when it gets dim + trigger = + { platform = "numeric_state"; + entity_id = "sun.sun"; + value_template = "{{ state.attributes.elevation }}"; + below = 10; - { - 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" ]; - }; - } + }; + action = + { service = "homeassistant.turn_on"; + entity_id = [ "group.nachtlicht" ]; + }; + } + { + alias = "Turn off Nachtlicht at dawn"; + trigger = + { platform = "sun"; + event = "sunrise"; + offset = "01:30:00"; # on dawn + }; + # TODO: when somebody is still in the buero + # condition = + #{ + #}; + action = + { service = "homeassistant.turn_off"; + entity_id = [ "group.nachtlicht" ]; + }; + } ] |