summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/ham/lib/default.nix
blob: c2d7916c170e115914606b975164347dc3b8132f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
let
  prefix = "/ham";
in
{
  inherit prefix;
  say = let
    # returns a list of actions to be performed on an mpd to say something
    tts = { message, entity }:
    [
      {
        service = "media_player.turn_on";
        data.entity_id = entity;
      }
      {
        service = "media_player.play_media";
        data = {
          entity_id = entity;
          media_content_type = "playlist";
          media_content_id = "ansage";
        };
      }
      {
        service = "media_player.turn_on";
        data.entity_id = entity;
      }
      { delay.seconds = 8; }
      {
        service = "tts.say";
        entity_id =  entity;
        data_template = {
          inherit message;
          language = "de";
        };
      }
    ];
  in
  {
    firetv = message: tts {
      inherit message;
      entity = "firetv";
    };
  };
}