feat: ha add morning active automation
This commit is contained in:
@@ -103,6 +103,7 @@ in
|
|||||||
./snapcast.nix
|
./snapcast.nix
|
||||||
|
|
||||||
./coming-home.nix
|
./coming-home.nix
|
||||||
|
./morning-active.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
|
|||||||
76
hosts/fw/modules/home-assistant/morning-active.nix
Normal file
76
hosts/fw/modules/home-assistant/morning-active.nix
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
{
|
||||||
|
services.home-assistant.config = {
|
||||||
|
# Track if morning hook already triggered today
|
||||||
|
input_boolean = {
|
||||||
|
morning_active_triggered = {
|
||||||
|
name = "Morning Active Triggered";
|
||||||
|
icon = "mdi:weather-sunny";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# REST command to call Moltbot
|
||||||
|
rest_command = {
|
||||||
|
moltbot_morning_active = {
|
||||||
|
url = "https://moltbot.cloonar.com/hooks/agent";
|
||||||
|
method = "POST";
|
||||||
|
headers = {
|
||||||
|
Authorization = "!secret moltbot_home_arrival"; # reuse same token
|
||||||
|
Content-Type = "application/json";
|
||||||
|
};
|
||||||
|
payload = ''{"message":"Morning briefing. Give a brief, friendly summary: 1) Today's weather for Vienna 2) Calendar events for today (check CalDAV) 3) Any pending reminders. Keep it concise, no fluff. Just the info.","name":"MorningBriefing","deliver":true,"channel":"whatsapp","to":"+436607055308"}'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Main automation: detect morning activity
|
||||||
|
"automation morning_active" = {
|
||||||
|
alias = "morning_active";
|
||||||
|
trigger = [
|
||||||
|
{
|
||||||
|
platform = "state";
|
||||||
|
entity_id = "light.toilet_lights";
|
||||||
|
to = "on";
|
||||||
|
}
|
||||||
|
# Future: add kitchen motion sensor here
|
||||||
|
# {
|
||||||
|
# platform = "state";
|
||||||
|
# entity_id = "binary_sensor.kitchen_motion";
|
||||||
|
# to = "on";
|
||||||
|
# }
|
||||||
|
];
|
||||||
|
condition = [
|
||||||
|
{
|
||||||
|
condition = "time";
|
||||||
|
after = "05:00:00";
|
||||||
|
before = "12:00:00";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
condition = "state";
|
||||||
|
entity_id = "input_boolean.morning_active_triggered";
|
||||||
|
state = "off";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
action = [
|
||||||
|
{
|
||||||
|
service = "input_boolean.turn_on";
|
||||||
|
target.entity_id = "input_boolean.morning_active_triggered";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
service = "rest_command.moltbot_morning_active";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Reset automation: reset triggered state at 3:00 AM
|
||||||
|
"automation morning_active_reset" = {
|
||||||
|
alias = "morning_active_reset";
|
||||||
|
trigger = {
|
||||||
|
platform = "time";
|
||||||
|
at = "03:00:00";
|
||||||
|
};
|
||||||
|
action = {
|
||||||
|
service = "input_boolean.turn_off";
|
||||||
|
target.entity_id = "input_boolean.morning_active_triggered";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user