Files
nixos/hosts/fw.cloonar.com/modules/home-assistant/sleep.nix
2024-06-03 13:49:35 +02:00

62 lines
1.4 KiB
Nix

{
services.home-assistant.config = {
"automation wakeup" = {
alias = "wakeup";
hide_entity = true;
trigger = {
platform = "time";
at = "input_datetime.wakeup";
};
action = {
service_template = "switch.turn_on";
data_template = {
entity_id = "switch.coffee";
};
};
};
"automation sleep" = {
alias = "sleep";
hide_entity = true;
trigger = [
{
platform = "event";
event_type = "shelly.click";
event_data = {
device = "shellybutton1-E8DB84AA196D";
};
}
{
platform = "event";
event_type = "shelly.click";
event_data = {
device = "shellybutton1-E8DB84AA136D";
};
}
];
action = [
{
choose = [
{
conditions = [ "{{ trigger.event.data.click_type == \"long\" }}" ];
sequence = [
{
service = "light.turn_off";
entity_id = "all";
}
{
service = "light.turn_on";
entity_id = "light.bedroom_bed";
}
{
service = "switch.turn_off";
entity_id = "switch.coffee";
}
];
}
];
}
];
};
};
}