Home Assistant security system bringup

Signed-off-by: Magic_RB <magic_rb@redalder.org>

Update flake.lock

Signed-off-by: Magic_RB <magic_rb@redalder.org>

wip!!

Signed-off-by: Magic_RB <magic_rb@redalder.org>

wip!!!

Signed-off-by: Magic_RB <magic_rb@redalder.org>

wip!!!

Signed-off-by: Magic_RB <magic_rb@redalder.org>

wip!!!!

Signed-off-by: Magic_RB <magic_rb@redalder.org>

wip!!!!!

Signed-off-by: Magic_RB <magic_rb@redalder.org>

wip!!!!!!

Signed-off-by: Magic_RB <magic_rb@redalder.org>

wip!!!!!!!

Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
Magic_RB 2022-08-26 17:45:13 +02:00
parent 5d38fe62c9
commit ae174de04d
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
7 changed files with 127 additions and 13 deletions

View file

@ -29,7 +29,7 @@ nglib.makeSystem {
sha256 = "sha256-RSIJqsbgnktl7zNaxAKUoMjbkrJ1aJTej0vjlCgstJ8="; sha256 = "sha256-RSIJqsbgnktl7zNaxAKUoMjbkrJ1aJTej0vjlCgstJ8=";
} + "/custom_components/xiaomi_gateway3"; } + "/custom_components/xiaomi_gateway3";
}; };
config = with { inherit (builtins) toString; }; config =
{ default_config = {}; { default_config = {};
http = { http = {
server_port = "8123"; server_port = "8123";
@ -48,6 +48,13 @@ nglib.makeSystem {
internal_url = "http://localhost:8123/"; internal_url = "http://localhost:8123/";
}; };
automation = "!include automations.yaml"; automation = "!include automations.yaml";
"automation static" = [
(import ./home-assistant/automations/alarm/pending.nix)
(import ./home-assistant/automations/alarm/disarmed.nix)
(import ./home-assistant/automations/alarm/triggered.nix)
(import ./home-assistant/automations/alarm/motion-detected.nix)
];
alarm_control_panel = import ./home-assistant/alarm_control_panel.nix;
frontend.themes = frontend.themes =
{ }; { };
}; };

View file

@ -0,0 +1,17 @@
{
platform = "manual";
name = "Home Alarm";
code = "\${ALARM_CODE}";
code_arm_required = false; # Don't need code to arm.
disarm_after_trigger = false; # Leave alarm armed after triggering.
arming_time = 30; # Time to leave the house after arming.
delay_time = 60; # Time to turn off after entering the house.
trigger_time = 600; # How long the alarm goes off for.
disarmed = {
trigger_time = 0; # Can't be triggered when disarmed.
};
armed_home = {
arming_time = 0; # Arm instantly when at home.
delay_time = 0; # Trigger instantly when at home.
};
}

View file

@ -0,0 +1,20 @@
{
alias = "Alarm - Disarmed";
id = "a8c26d1c-3a71-4a99-b0f3-dc799495a706";
trigger = [
{
entity_id = "alarm_control_panel.home_alarm";
platform = "state";
to = "disarmed";
}
];
action = [
{
data = {
message = "Alarm Disarmed";
};
service = "notify.mobile_app_redrum";
}
];
}

View file

@ -0,0 +1,31 @@
{
alias = "Alarm - Trigger when motion detected";
id = "972bccd8-a68c-48fc-ac90-ebbeb87c64b9";
trigger = {
platform = "state";
entity_id = "binary_sensor.sensor_entry_door_contact";
to = "on";
};
condition = {
condition = "or";
conditions = [
{
condition = "state";
entity_id = "alarm_control_panel.home_alarm";
state = "armed_home";
}
{
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";
}
];
}

View file

@ -0,0 +1,19 @@
{
alias = "Alarm - Pending";
id = "e4771f5a-1205-4fbe-9142-6a56600d7bd4";
trigger = [
{
entity_id = "alarm_control_panel.home_alarm";
from = "armed_away";
platform = "state";
to = "pending";
}
];
action = [
{
data = { message = "Alarm Pending - Intruder Detected!"; };
service = "notify.mobile_app_redrum";
}
];
}

View file

@ -0,0 +1,20 @@
{
alias = "Alarm - Triggered";
id = "6b9c6dac-2c6b-4add-b499-8e2b134e5d9c";
trigger = [
{
entity_id = "alarm_control_panel.home_alarm";
platform = "state";
to = "triggered";
}
];
action = [
{
data = {
message = "Alarm Triggered - Motion Detected!";
};
service = "notify.mobile_app_redrum";
}
];
}

View file

@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1650374345, "lastModified": 1641345147,
"narHash": "sha256-YprUqDDomOackDUuVvXSeVQwjekXtoZSjLi0x2XjKes=", "narHash": "sha256-2DwiEp/pxQ/gIMlJyYOM/q2sEXaJ4LYqhdvW9TrFjpA=",
"ref": "master", "ref": "refs/heads/master",
"rev": "bc20eb7c20b906ee4fc6a936da7370d00f2c2739", "rev": "67759ba6aede849780dcedcc3b316ccc1c0084b0",
"revCount": 42, "revCount": 39,
"type": "git", "type": "git",
"url": "https://gitea.redalder.org/ThyW/camptules" "url": "https://gitea.redalder.org/ThyW/camptules"
}, },
@ -75,11 +75,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1659246221, "lastModified": 1659247306,
"narHash": "sha256-+d2E6e9So3swU3N5l6Dylb02qiwizevip6wPiWLDRSs=", "narHash": "sha256-7HnMAj+OzChKVZWp5bqnTTXfKsGSIymryLOHek0bDBE=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NixNG", "repo": "NixNG",
"rev": "7f30b8b20f5a4bcdf4b6350be22da623da237fb4", "rev": "043a9a5353501b017adaa3730f09074d2f4c9514",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -107,11 +107,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1659077768, "lastModified": 1661361016,
"narHash": "sha256-P0XIHBVty6WIuIrk2DZNvLcYev9956y1prT4zL212H8=", "narHash": "sha256-Bjf6ZDnDc6glTwIIItvwfcaeJ5zWFM6GYfPajSArdUY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2a93ea177c3d7700b934bf95adfe00c435f696b8", "rev": "b784c5ae63dd288375af1b4d37b8a27dd8061887",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -190,7 +190,7 @@
"locked": { "locked": {
"lastModified": 1641601042, "lastModified": 1641601042,
"narHash": "sha256-Nqz5fYUaCdrj7GmpONqsMxKP3GM/11btYEPtbm0p66w=", "narHash": "sha256-Nqz5fYUaCdrj7GmpONqsMxKP3GM/11btYEPtbm0p66w=",
"ref": "master", "ref": "refs/heads/master",
"rev": "9a678533ce1d3a550ccba39fc6cc86b1d3e3de3d", "rev": "9a678533ce1d3a550ccba39fc6cc86b1d3e3de3d",
"revCount": 36, "revCount": 36,
"type": "git", "type": "git",