From 270d7af20be6112f4a8e10f94ed806969ffdb581 Mon Sep 17 00:00:00 2001 From: Magic_RB Date: Sun, 9 Oct 2022 01:26:47 +0200 Subject: [PATCH] HomeAssistant automation updates Signed-off-by: Magic_RB --- containers/home-assistant.nix | 1 + .../alarm/motion-detected-away.nix | 26 +++++++++++++++++++ .../automations/alarm/motion-detected.nix | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 containers/home-assistant/automations/alarm/motion-detected-away.nix diff --git a/containers/home-assistant.nix b/containers/home-assistant.nix index 5f722d3..bec9d6b 100644 --- a/containers/home-assistant.nix +++ b/containers/home-assistant.nix @@ -53,6 +53,7 @@ nglib.makeSystem { (import ./home-assistant/automations/alarm/disarmed.nix) (import ./home-assistant/automations/alarm/triggered.nix) (import ./home-assistant/automations/alarm/motion-detected.nix) + (import ./home-assistant/automations/alarm/motion-detected-away.nix) ]; alarm_control_panel = import ./home-assistant/alarm_control_panel.nix; frontend.themes = diff --git a/containers/home-assistant/automations/alarm/motion-detected-away.nix b/containers/home-assistant/automations/alarm/motion-detected-away.nix new file mode 100644 index 0000000..2717d4b --- /dev/null +++ b/containers/home-assistant/automations/alarm/motion-detected-away.nix @@ -0,0 +1,26 @@ +{ + alias = "Alarm - Trigger when motion detected - Away"; + id = "b16e988f-2ee0-4596-a14d-0fda1a95ac2d"; + + trigger = { + platform = "state"; + entity_id = "binary_sensor.motion_sensor_occupancy"; + to = "on"; + }; + condition = { + condition = "or"; + conditions = [ + { + condition = "state"; + entity_id = "alarm_control_panel.home_alarm"; + state = "armed_away"; + } + ]; + }; + action = [ + { + service = "alarm_control_panel.alarm_trigger"; + entity_id = "alarm_control_panel.home_alarm"; + } + ]; +} diff --git a/containers/home-assistant/automations/alarm/motion-detected.nix b/containers/home-assistant/automations/alarm/motion-detected.nix index d65e1b1..f384cbb 100644 --- a/containers/home-assistant/automations/alarm/motion-detected.nix +++ b/containers/home-assistant/automations/alarm/motion-detected.nix @@ -1,5 +1,5 @@ { - alias = "Alarm - Trigger when motion detected"; + alias = "Alarm - Trigger when motion detected - Home/Away"; id = "972bccd8-a68c-48fc-ac90-ebbeb87c64b9"; trigger = {