summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/shack/glados/lib/default.nix
diff options
context:
space:
mode:
authorJeschli <jeschli@gmail.com>2020-04-14 20:36:21 +0200
committerJeschli <jeschli@gmail.com>2020-04-14 20:36:21 +0200
commite5342b25c149f05db86983f3785ee395c156b435 (patch)
treee45270c08010c48c27a22643bd9a3a343b880eae /krebs/2configs/shack/glados/lib/default.nix
parent290b6a542527a0a48c11fc2b00aee2b4d7f7df06 (diff)
parent843a537bd7fbedd8eb5fd61a1172dd8229440606 (diff)
Merge branch 'master' of https://cgit.lassul.us/stockholm
Diffstat (limited to 'krebs/2configs/shack/glados/lib/default.nix')
-rw-r--r--krebs/2configs/shack/glados/lib/default.nix119
1 files changed, 39 insertions, 80 deletions
diff --git a/krebs/2configs/shack/glados/lib/default.nix b/krebs/2configs/shack/glados/lib/default.nix
index 6737af842..6d2b7749b 100644
--- a/krebs/2configs/shack/glados/lib/default.nix
+++ b/krebs/2configs/shack/glados/lib/default.nix
@@ -2,89 +2,48 @@ let
prefix = "glados";
in
{
- esphome =
+
+ 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
{
- temp = {host, topic ? "temperature" }:
- {
- platform = "mqtt";
- name = "${host} Temperature";
- device_class = "temperature";
- unit_of_measurement = "°C";
- icon = "mdi:thermometer";
- state_topic = "${prefix}/${host}/sensor/${topic}/state";
- availability_topic = "${prefix}/${host}/status";
- payload_available = "online";
- payload_not_available = "offline";
- };
- hum = {host, topic ? "humidity" }:
- {
- platform = "mqtt";
- unit_of_measurement = "%";
- icon = "mdi:water-percent";
- device_class = "humidity";
- name = "${host} Humidity";
- state_topic = "${prefix}/${host}/sensor/${topic}/state";
- availability_topic = "${prefix}/${host}/status";
- payload_available = "online";
- payload_not_available = "offline";
+ lounge = message: tts {
+ inherit message;
+ entity = "lounge";
};
- # copied from "homeassistant/light/fablab_led/led_ring/config"
- led = {host, topic ? "led", name ? host}:
- { # name: fablab_led
- # topic: led_ring
- platform = "mqtt";
- inherit name;
- schema = "json";
- brightness = true;
- rgb = true;
- effect = true;
- effect_list = [ # TODO: may be different
- "Random"
- "Strobe"
- "Rainbow"
- "Color Wipe"
- "Scan"
- "Twinkle"
- "Fireworks"
- "Addressable Flicker"
- "None"
- ];
- state_topic = "${prefix}/${host}/light/${topic}/state";
- command_topic = "${prefix}/${host}/light/${topic}/command";
- availability_topic = "${prefix}/${host}/status";
- payload_available = "online";
- payload_not_available = "offline";
- qos = 1;
+ herrenklo = message: tts {
+ inherit message;
+ entity = "herrenklo";
};
- # Feinstaub
- dust_25m = { host, name ? "${host} < 2.5µm", topic ? "particulate_matter_25m_concentration" }:
- {
- platform = "mqtt";
- unit_of_measurement = "µg/m³";
- icon = "mdi:chemical-weapon";
- inherit name;
- state_topic = "${prefix}/${host}/sensor/${topic}/state";
- availability_topic = "${prefix}/${host}/status";
- };
- dust_100m = {host, name ? "${host} < 10µm", topic ? "particulate_matter_100m_concentration" }:
- {
- platform = "mqtt";
- unit_of_measurement = "µg/m³";
- icon = "mdi:chemical-weapon";
- 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
- # topic: btn1
- {
- inherit name;
- platform = "mqtt";
- state_topic = "${prefix}/${host}/sensor/${topic}/state";
- command_topic = "${prefix}/${host}/switch/${topic}/state";
- availability_topic = "${prefix}/${host}/status";
+ kiosk = message: tts {
+ inherit message;
+ entity = "kiosk";
};
};
tasmota =