summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/home/ham/automation/check-in.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2022-09-23 23:41:30 +0200
committermakefu <github@syntax-fehler.de>2022-09-23 23:41:30 +0200
commit3e8f855f60dfa5bf56ab3a1d1a54e0accccbd618 (patch)
tree85674a93388edfb7a0646b46aafc18d64d7aa0c6 /makefu/2configs/home/ham/automation/check-in.nix
parent2dfde5dc6d37fb5bab8a1b658cfe7e5b21f5a2f4 (diff)
ma ham: update
Diffstat (limited to 'makefu/2configs/home/ham/automation/check-in.nix')
-rw-r--r--makefu/2configs/home/ham/automation/check-in.nix77
1 files changed, 61 insertions, 16 deletions
diff --git a/makefu/2configs/home/ham/automation/check-in.nix b/makefu/2configs/home/ham/automation/check-in.nix
index d589a6971..db051757e 100644
--- a/makefu/2configs/home/ham/automation/check-in.nix
+++ b/makefu/2configs/home/ham/automation/check-in.nix
@@ -7,6 +7,21 @@ let
in
{
services.home-assistant.config.input_boolean.felix_at_work.name = "Felix auf Arbeit";
+ services.home-assistant.config.timer.felix_at_work = {
+ name = "Felix auf Arbeit Timer";
+ duration = "10:00:00";
+ };
+ services.home-assistant.config.sensor = [
+ {
+ platform = "history_stats";
+ name = "Felix at work today";
+ entity_id = "input_boolean.felix_at_work";
+ state = "on";
+ type = "time";
+ start = "{{ now().replace(hour=0, minute=0, second=0) }}";
+ end = "{{ now() }}";
+ }
+ ];
services.home-assistant.config.script.start_office_radio.sequence =
[
{ service = "media_player.play_media";
@@ -19,13 +34,41 @@ in
];
services.home-assistant.config.automation =
[
- { service = "media_player.play_media";
- data = {
- media_content_id = "http://radio.lassul.us:8000/radio.mp3";
- media_content_type = "music";
- };
- target.entity_id = "media_player.office";
- }
+ { alias = "Zu lange Felix!";
+ trigger =
+ { platform = "event";
+ event_type = "timer.finished";
+ event_data.entity_id = "timer.felix_at_work";
+ };
+
+ condition =
+ {
+ condition = "state";
+ entity_id = at_work;
+ state = "off";
+ };
+
+ action = (say "Felix, die zehn Stunden sind um, aufhören jetzt");
+ }
+ { alias = "Turn off at work sensor";
+ trigger = [
+ { platform = "time"; at = "00:00:00"; }
+ ];
+ condition =
+ {
+ condition = "state";
+ entity_id = at_work;
+ state = "off";
+ };
+ action =
+ [
+ # felix forgot to stamp out ...
+ {
+ service = "homeassistant.turn_off";
+ entity_id = [ at_work ];
+ }
+ ];
+ }
{ alias = "Push Check-in Button Felix with button";
trigger = [
{
@@ -54,15 +97,12 @@ in
{ service = "homeassistant.turn_on";
entity_id = at_work;
}
- ] ++ (say "Willkommen auf Arbeit") ++
- [
- { service = "media_player.play_media";
- data = {
- media_content_id = "http://radio.lassul.us:8000/radio.mp3";
- media_content_type = "music";
- };
- target.entity_id = "media_player.office";
+ { service = "timer.start";
+ entity_id = [ "timer.felix_at_work" ] ;
}
+ ] ++ (say (builtins.readFile ./welcome.txt.j2)) ++
+ [
+ { service = "script.start_office_radio"; }
];
}
{
@@ -78,7 +118,12 @@ in
{ service = "homeassistant.turn_off";
entity_id = at_work;
}
- ] ++ (say "Endlich ist Pappa fertig mit arbeit!");
+ ] ++ (say (builtins.readFile ./bye.txt.j2)) ++
+ [
+ { service = "timer.stop";
+ entity_id = [ "timer.felix_at_work" ] ;
+ }
+ ];
}
];
}