feat: ha add morning active automation

This commit is contained in:
Dominik Polakovics Polakovics 2026-01-31 15:04:23 +01:00
parent d83f4ec903
commit b11d9b2fb9
2 changed files with 77 additions and 0 deletions

View file

@ -103,6 +103,7 @@ in
./snapcast.nix
./coming-home.nix
./morning-active.nix
];
networking = {

View 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";
};
};
};
}