feat: changes to home assistant getting home
This commit is contained in:
27
hosts/fw/modules/home-assistant/coming-home.nix
Normal file
27
hosts/fw/modules/home-assistant/coming-home.nix
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
services.home-assistant.config = {
|
||||||
|
rest_command = {
|
||||||
|
moltbot_home_arrival = {
|
||||||
|
url = "https://moltbot.cloonar.com/hooks/agent";
|
||||||
|
method = "POST";
|
||||||
|
headers = {
|
||||||
|
Authorization = "!secret moltbot_home_arrival";
|
||||||
|
Content-Type = "application/json";
|
||||||
|
};
|
||||||
|
payload = "{\"message\":\"I just arrived home. Read home-reminders.md in my workspace. This file may contain reminders to tell me, or instructions/tasks to perform (like looking something up). Execute any instructions, send me the results along with any simple reminders, then clear the file content (keep the header). If the file is empty, just welcome me home briefly.\",\"name\":\"HomeArrival\",\"deliver\":true,\"channel\":\"whatsapp\",\"to\":\"+436607055308\"}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"automation home_arrival" = {
|
||||||
|
alias = "home_arrival";
|
||||||
|
trigger = {
|
||||||
|
platform = "zone";
|
||||||
|
entity_id = "person.dominik";
|
||||||
|
zone = "zone.home";
|
||||||
|
event = "enter";
|
||||||
|
};
|
||||||
|
action = {
|
||||||
|
service = "rest_command.moltbot_home_arrival";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -101,6 +101,8 @@ in
|
|||||||
./shelly.nix
|
./shelly.nix
|
||||||
./sleep.nix
|
./sleep.nix
|
||||||
./snapcast.nix
|
./snapcast.nix
|
||||||
|
|
||||||
|
./coming-home.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
let
|
let
|
||||||
devices = [
|
persons = [
|
||||||
"device_tracker.dominiks_iphone"
|
"person.dominiks"
|
||||||
"device_tracker.dominiks_mp01"
|
|
||||||
"device_tracker.dominiks_fairphone_6"
|
|
||||||
];
|
];
|
||||||
in {
|
in {
|
||||||
services.home-assistant.extraComponents = [
|
services.home-assistant.extraComponents = [
|
||||||
@@ -14,18 +12,12 @@ in {
|
|||||||
alias = "house_door";
|
alias = "house_door";
|
||||||
mode = "restart";
|
mode = "restart";
|
||||||
trigger = {
|
trigger = {
|
||||||
platform = "state";
|
platform = "zone";
|
||||||
entity_id = devices;
|
entity_id = "person.dominik";
|
||||||
from = "not_home";
|
zone = "zone.home";
|
||||||
to = "home";
|
event = "enter";
|
||||||
};
|
};
|
||||||
action = [
|
action = [
|
||||||
{
|
|
||||||
service = "script.turn_on";
|
|
||||||
target = {
|
|
||||||
entity_id = "script.turn_on_circuits";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
service = "lock.unlock";
|
service = "lock.unlock";
|
||||||
target = {
|
target = {
|
||||||
|
|||||||
@@ -23,12 +23,10 @@
|
|||||||
"automation arrive home power" = {
|
"automation arrive home power" = {
|
||||||
alias = "arrive home power";
|
alias = "arrive home power";
|
||||||
trigger = {
|
trigger = {
|
||||||
platform = "state";
|
platform = "zone";
|
||||||
entity_id = [
|
entity_id = "person.dominik";
|
||||||
"device_tracker.dominiks_iphone"
|
zone = "zone.home";
|
||||||
];
|
event = "enter";
|
||||||
from = "not_home";
|
|
||||||
to = "home";
|
|
||||||
};
|
};
|
||||||
action = [
|
action = [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user