summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/shack/glados/lib/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/2configs/shack/glados/lib/default.nix')
-rw-r--r--krebs/2configs/shack/glados/lib/default.nix60
1 files changed, 60 insertions, 0 deletions
diff --git a/krebs/2configs/shack/glados/lib/default.nix b/krebs/2configs/shack/glados/lib/default.nix
index 6737af842..eb0528a06 100644
--- a/krebs/2configs/shack/glados/lib/default.nix
+++ b/krebs/2configs/shack/glados/lib/default.nix
@@ -2,6 +2,50 @@ let
prefix = "glados";
in
{
+
+ 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 = "media_player.${entity}";
+ }
+ { service = "media_player.play_media";
+ data = {
+ entity_id = "media_player.${entity}";
+ media_content_type = "playlist";
+ media_content_id = "ansage";
+ };
+ }
+ {
+ service = "media_player.turn_on";
+ data.entity_id = "media_player.${entity}";
+ }
+ { delay.seconds = 8; }
+ { service = "tts.say";
+ entity_id = "media_player.${entity}";
+ data_template = {
+ inherit message;
+ language = "de";
+ };
+ }
+ ];
+ in
+ {
+ lounge = message: tts {
+ inherit message;
+ entity = "lounge";
+ };
+ herrenklo = message: tts {
+ inherit message;
+ entity = "herrenklo";
+ };
+ kiosk = message: tts {
+ inherit message;
+ entity = "kiosk";
+ };
+ };
esphome =
{
temp = {host, topic ? "temperature" }:
@@ -75,6 +119,22 @@ in
state_topic = "${prefix}/${host}/sensor/${topic}/state";
availability_topic = "${prefix}/${host}/status";
};
+ ip = {host, name ? "${host} IP", topic ? "ip_address" }:
+ {
+ platform = "mqtt";
+ inherit name;
+ state_topic = "${prefix}/${host}/sensor/${topic}/state";
+ availability_topic = "${prefix}/${host}/status";
+ };
+ wifi = {host, name ? "${host} Wifi Signal", topic ? "wifi_signal" }:
+ {
+ platform = "mqtt";
+ unit_of_measurement = "dB";
+ icon = "mdi:wifi";
+ inherit name;
+ state_topic = "${prefix}/${host}/sensor/${topic}/state";
+ availability_topic = "${prefix}/${host}/status";
+ };
switch = {host, name ? "${host} Button", topic ? "btn" }:
# host: ampel
# name: Button 1