stockholm/krebs/2configs/shack/glados/lib/default.nix

67 lines
1.5 KiB
Nix
Raw Normal View History

2020-01-07 15:52:31 +00:00
let
prefix = "glados";
in
{
2020-01-23 22:52:39 +00:00
say = let
# returns a list of actions to be performed on an mpd to say something
tts = { message, entity }:
[
{
service = "media_player.turn_on";
2020-02-19 13:36:21 +00:00
data.entity_id = "media_player.${entity}";
2020-01-23 22:52:39 +00:00
}
{ service = "media_player.play_media";
data = {
2020-02-19 13:36:21 +00:00
entity_id = "media_player.${entity}";
2020-01-23 22:52:39 +00:00
media_content_type = "playlist";
media_content_id = "ansage";
};
}
{
service = "media_player.turn_on";
2020-02-19 13:36:21 +00:00
data.entity_id = "media_player.${entity}";
2020-01-23 22:52:39 +00:00
}
{ delay.seconds = 8; }
{ service = "tts.say";
2020-02-19 13:36:21 +00:00
entity_id = "media_player.${entity}";
2020-01-23 22:52:39 +00:00
data_template = {
inherit message;
language = "de";
};
}
];
in
{
lounge = message: tts {
inherit message;
entity = "lounge";
};
herrenklo = message: tts {
inherit message;
entity = "herrenklo";
};
2020-02-19 13:36:21 +00:00
kiosk = message: tts {
inherit message;
entity = "kiosk";
};
2020-01-23 22:52:39 +00:00
};
2020-01-07 15:52:31 +00:00
tasmota =
{
2020-01-10 08:59:11 +00:00
plug = {host, name ? host, topic ? host}:
2020-01-07 15:52:31 +00:00
{
platform = "mqtt";
inherit name;
state_topic = "sonoff/stat/${topic}/POWER1";
command_topic = "sonoff/cmnd/${topic}/POWER1";
availability_topic = "sonoff/tele/${topic}/LWT";
payload_on= "ON";
payload_off= "OFF";
payload_available= "Online";
payload_not_available= "Offline";
retain = false;
qos = 1;
};
};
}