summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/home/ham/lib/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'makefu/2configs/home/ham/lib/default.nix')
-rw-r--r--makefu/2configs/home/ham/lib/default.nix50
1 files changed, 32 insertions, 18 deletions
diff --git a/makefu/2configs/home/ham/lib/default.nix b/makefu/2configs/home/ham/lib/default.nix
index 75be52737..67e8e902d 100644
--- a/makefu/2configs/home/ham/lib/default.nix
+++ b/makefu/2configs/home/ham/lib/default.nix
@@ -8,36 +8,50 @@ in
tts = { message, entity }:
[
{
- service = "media_player.turn_on";
- data.entity_id = entity;
+ service = "sonos.snapshot";
+ target.entity_id = entity;
}
{
- service = "media_player.play_media";
+ service = "tts.google_say";
data = {
- entity_id = entity;
- media_content_type = "playlist";
- media_content_id = "ansage";
+ entity_id = entity;
+ inherit message;
+ language = "de";
};
}
- {
- service = "media_player.turn_on";
- data.entity_id = entity;
+ #{ wait_template = "{{ is_state('${entity}' , 'playing') }}";
+ # timeout = "00:00:02";
+ #}
+ #{ wait_template = "{{ not is_state('${entity}' , 'playing') }}";
+ # timeout = "00:01:00";
+ #}
+ { delay.seconds = 1; }
+ { delay = ''
+ {% set duration = states.${entity}.attributes.media_duration %}
+ {% if duration > 0 %}
+ {% set duration = duration - 1 %}
+ {% endif %}
+ {% set seconds = duration % 60 %}
+ {% set minutes = (duration / 60)|int % 60 %}
+ {% set hours = (duration / 3600)|int %}
+ {{ "%02i:%02i:%02i"|format(hours, minutes, seconds)}}
+
+ '';
}
- { delay.seconds = 8; }
{
- service = "tts.say";
- entity_id = entity;
- data_template = {
- inherit message;
- language = "de";
- };
+ service = "sonos.restore";
+ target.entity_id = entity;
}
];
in
{
- firetv = message: tts {
+ living_room = message: tts {
+ inherit message;
+ entity = "media_player.living_room";
+ };
+ office = message: tts {
inherit message;
- entity = "firetv";
+ entity = "media_player.office";
};
};