From c12411d79f21f6e462251d02485c8b2a139cb93e Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 23 Jan 2020 23:52:39 +0100 Subject: shack/glados: add shack-startup --- krebs/2configs/shack/glados/lib/default.nix | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'krebs/2configs/shack/glados/lib') diff --git a/krebs/2configs/shack/glados/lib/default.nix b/krebs/2configs/shack/glados/lib/default.nix index 6737af842..16cbc6830 100644 --- a/krebs/2configs/shack/glados/lib/default.nix +++ b/krebs/2configs/shack/glados/lib/default.nix @@ -2,6 +2,46 @@ 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.lounge"; + } + { service = "media_player.play_media"; + data = { + entity_id = "media_player.lounge"; + media_content_type = "playlist"; + media_content_id = "ansage"; + }; + } + { + service = "media_player.turn_on"; + data.entity_id = "media_player.lounge"; + } + { delay.seconds = 8; } + { service = "tts.say"; + entity_id = "media_player.lounge"; + data_template = { + inherit message; + language = "de"; + }; + } + ]; + in + { + lounge = message: tts { + inherit message; + entity = "lounge"; + }; + herrenklo = message: tts { + inherit message; + entity = "herrenklo"; + }; + }; esphome = { temp = {host, topic ? "temperature" }: -- cgit v1.2.3 From cc1659925919b777ee76fcab99e605cbf90057f4 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 19 Feb 2020 14:36:21 +0100 Subject: shack/glados/lib: generalize tts --- krebs/2configs/shack/glados/lib/default.nix | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'krebs/2configs/shack/glados/lib') diff --git a/krebs/2configs/shack/glados/lib/default.nix b/krebs/2configs/shack/glados/lib/default.nix index 16cbc6830..eb0528a06 100644 --- a/krebs/2configs/shack/glados/lib/default.nix +++ b/krebs/2configs/shack/glados/lib/default.nix @@ -9,22 +9,22 @@ in [ { service = "media_player.turn_on"; - data.entity_id = "media_player.lounge"; + data.entity_id = "media_player.${entity}"; } { service = "media_player.play_media"; data = { - entity_id = "media_player.lounge"; + entity_id = "media_player.${entity}"; media_content_type = "playlist"; media_content_id = "ansage"; }; } { service = "media_player.turn_on"; - data.entity_id = "media_player.lounge"; + data.entity_id = "media_player.${entity}"; } { delay.seconds = 8; } { service = "tts.say"; - entity_id = "media_player.lounge"; + entity_id = "media_player.${entity}"; data_template = { inherit message; language = "de"; @@ -41,6 +41,10 @@ in inherit message; entity = "herrenklo"; }; + kiosk = message: tts { + inherit message; + entity = "kiosk"; + }; }; esphome = { @@ -115,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 -- cgit v1.2.3 From a62f71b00bdb4028595d7edae0e2a25942ad1e56 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 19 Feb 2020 16:38:25 +0100 Subject: shack/glados/lib: add rollo config --- krebs/2configs/shack/glados/lib/default.nix | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'krebs/2configs/shack/glados/lib') diff --git a/krebs/2configs/shack/glados/lib/default.nix b/krebs/2configs/shack/glados/lib/default.nix index eb0528a06..6ab1edf85 100644 --- a/krebs/2configs/shack/glados/lib/default.nix +++ b/krebs/2configs/shack/glados/lib/default.nix @@ -72,6 +72,17 @@ in payload_available = "online"; payload_not_available = "offline"; }; + rollo = {host, topic ? "rollo" }: + { + optimistic = true; + platform = "mqtt"; + name = "${host} Rollo"; + state_topic = "${prefix}/${host}/sensor/${topic}/state"; + command_topic = "${prefix}/${host}/sensor/${topic}/command"; + availability_topic = "${prefix}/${host}/status"; + position_topic = "${prefix}/${host}/cover/${topic}/position/state"; + set_position_topic = "${prefix}/${host}/cover/${topic}/position/command"; + }; # copied from "homeassistant/light/fablab_led/led_ring/config" led = {host, topic ? "led", name ? host}: { # name: fablab_led @@ -100,6 +111,37 @@ in payload_not_available = "offline"; qos = 1; }; + monoled = {host, topic ? "blue_led", name ? host "MonoLED ${host}"}: + { + platform = "mqtt"; + inherit name; + schema = "json"; + brightness = true; + effect = true; + effect_list = [ # TODO: may be different + "Strobe" + "Twinkle" + "None" + ]; + state_topic = "${prefix}/${host}/light/${topic}/state"; + command_topic = "${prefix}/${host}/light/${topic}/command"; + availability_topic = "${prefix}/${host}/status"; + }; + btn = {host, topic ? "button", name ? "${host} ${topic}"}: #binary_sensor + { + platform = "mqtt"; + name = "${host} Button"; + state_topic = "${prefix}/${host}/binary_sensor/${topic}/state"; + availability_topic = "${prefix}/${host}/status"; + }; + relay = {host, name ? "${host} ${topic}", topic ? "relay" }: #switch + { + inherit name; + platform = "mqtt"; + state_topic = "${prefix}/${host}/switch/${topic}/state"; + command_topic = "${prefix}/${host}/switch/${topic}/command"; + availability_topic = "${prefix}/${host}/status"; + }; # Feinstaub dust_25m = { host, name ? "${host} < 2.5µm", topic ? "particulate_matter_25m_concentration" }: { -- cgit v1.2.3 From 64c224a711a1147b1be562ddd5ce1778ff5a6b1c Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 20 Feb 2020 14:00:17 +0100 Subject: shack/glados: add darksky,mate,spaceap,rollos --- krebs/2configs/shack/glados/lib/default.nix | 143 ---------------------------- 1 file changed, 143 deletions(-) (limited to 'krebs/2configs/shack/glados/lib') diff --git a/krebs/2configs/shack/glados/lib/default.nix b/krebs/2configs/shack/glados/lib/default.nix index 6ab1edf85..6d2b7749b 100644 --- a/krebs/2configs/shack/glados/lib/default.nix +++ b/krebs/2configs/shack/glados/lib/default.nix @@ -46,149 +46,6 @@ in entity = "kiosk"; }; }; - esphome = - { - 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"; - }; - rollo = {host, topic ? "rollo" }: - { - optimistic = true; - platform = "mqtt"; - name = "${host} Rollo"; - state_topic = "${prefix}/${host}/sensor/${topic}/state"; - command_topic = "${prefix}/${host}/sensor/${topic}/command"; - availability_topic = "${prefix}/${host}/status"; - position_topic = "${prefix}/${host}/cover/${topic}/position/state"; - set_position_topic = "${prefix}/${host}/cover/${topic}/position/command"; - }; - # 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; - }; - monoled = {host, topic ? "blue_led", name ? host "MonoLED ${host}"}: - { - platform = "mqtt"; - inherit name; - schema = "json"; - brightness = true; - effect = true; - effect_list = [ # TODO: may be different - "Strobe" - "Twinkle" - "None" - ]; - state_topic = "${prefix}/${host}/light/${topic}/state"; - command_topic = "${prefix}/${host}/light/${topic}/command"; - availability_topic = "${prefix}/${host}/status"; - }; - btn = {host, topic ? "button", name ? "${host} ${topic}"}: #binary_sensor - { - platform = "mqtt"; - name = "${host} Button"; - state_topic = "${prefix}/${host}/binary_sensor/${topic}/state"; - availability_topic = "${prefix}/${host}/status"; - }; - relay = {host, name ? "${host} ${topic}", topic ? "relay" }: #switch - { - inherit name; - platform = "mqtt"; - state_topic = "${prefix}/${host}/switch/${topic}/state"; - command_topic = "${prefix}/${host}/switch/${topic}/command"; - availability_topic = "${prefix}/${host}/status"; - }; - # 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"; - }; - 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 - # 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"; - }; - }; tasmota = { plug = {host, name ? host, topic ? host}: -- cgit v1.2.3