From e2fcbd0919015085b310d72198fb2e0250b5d1cd Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 15 Jan 2020 09:11:03 +0100 Subject: shack/muellshack: bump to latest master adds new static data for 2020 --- krebs/2configs/shack/muellshack.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'krebs') diff --git a/krebs/2configs/shack/muellshack.nix b/krebs/2configs/shack/muellshack.nix index c67d8f523..e894b9394 100644 --- a/krebs/2configs/shack/muellshack.nix +++ b/krebs/2configs/shack/muellshack.nix @@ -4,8 +4,9 @@ let pkg = pkgs.callPackage ( pkgs.fetchgit { url = "https://git.shackspace.de/rz/muellshack"; - rev = "c3d1f70325e5b90f280c5be60110e14f4de653ae"; - sha256 = "1dd4kqwdr4v413rmkvmyjzzvw8id9747nifp96pg0c2cy6bhzj24"; + rev = "dc80cf1edaa3d86ec2bebae8596ad1d4c4e3650a"; + sha256 = "1yipr66zhrg5m20pf3rzvgvvl78an6ddkq6zc45rxb2r0i7ipkyh"; + }) { mkYarnPackage = pkgs.yarn2nix-moretea.mkYarnPackage; }; home = "/var/lib/muellshack"; port = "8081"; -- cgit v1.2.3 From 6508c853da3596b701aa00e99a5260d31ebeaa24 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 23 Jan 2020 23:51:05 +0100 Subject: shack/glados: schlechte_luft add rz --- krebs/2configs/shack/glados/multi/schlechte_luft.nix | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'krebs') diff --git a/krebs/2configs/shack/glados/multi/schlechte_luft.nix b/krebs/2configs/shack/glados/multi/schlechte_luft.nix index 9cd2c56f4..4625f6846 100644 --- a/krebs/2configs/shack/glados/multi/schlechte_luft.nix +++ b/krebs/2configs/shack/glados/multi/schlechte_luft.nix @@ -15,6 +15,11 @@ in (glados.esphome.temp { host = "fablab_feinstaub";}) (glados.esphome.dust_25m { host = "fablab_feinstaub";}) (glados.esphome.dust_100m { host = "fablab_feinstaub";}) + + (glados.esphome.temp { host = "rz_feinstaub";}) + (glados.esphome.hum { host = "rz_feinstaub";}) + (glados.esphome.dust_25m { host = "rz_feinstaub";}) + (glados.esphome.dust_100m { host = "rz_feinstaub";}) ]; automation = [ -- cgit v1.2.3 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 --- .../shack/glados/automation/hass-restart.nix | 3 +- .../shack/glados/automation/shack-startup.nix | 82 ++++++++++++++++++++++ krebs/2configs/shack/glados/default.nix | 13 +++- krebs/2configs/shack/glados/lib/default.nix | 40 +++++++++++ 4 files changed, 135 insertions(+), 3 deletions(-) create mode 100644 krebs/2configs/shack/glados/automation/shack-startup.nix (limited to 'krebs') diff --git a/krebs/2configs/shack/glados/automation/hass-restart.nix b/krebs/2configs/shack/glados/automation/hass-restart.nix index e87354978..1b380204d 100644 --- a/krebs/2configs/shack/glados/automation/hass-restart.nix +++ b/krebs/2configs/shack/glados/automation/hass-restart.nix @@ -6,12 +6,13 @@ platform = "homeassistant"; event = "start"; }; + # trigger good/bad air action = [ { service = "light.turn_on"; data = { entity_id = "light.fablab_led"; effect = "Rainbow"; - color_name = "yellow"; + color_name = "purple"; }; } ]; diff --git a/krebs/2configs/shack/glados/automation/shack-startup.nix b/krebs/2configs/shack/glados/automation/shack-startup.nix new file mode 100644 index 000000000..10051d60a --- /dev/null +++ b/krebs/2configs/shack/glados/automation/shack-startup.nix @@ -0,0 +1,82 @@ +# needs: +# binary_sensor.portal_lock +# sensor.keyholder +# media_player.lounge +let + glados = import ../lib; +in +[ + { + alias = "Greet new keyholder for key exchange"; + initial_state = true; + trigger = { + platform = "state"; + entity_id = "sensor.keyholder"; + }; + condition = { + condition = "template"; + value_template = "{{ trigger.from_state.state != 'No Keyholder' }}"; + }; + #action = glados.say.lounge "Danke {{trigger.to_state.state}} für das Übernehmen des Keys von {{trigger.from_state.state}}"; + action = []; + } + + { + alias = "Start Music on portal lock on"; + # TODO: use "power" trigger + trigger = { + platform = "state"; + entity_id = "binary_sensor.portal_lock"; + to = "on"; + for.seconds = 30; + }; + condition = { + condition = "and"; + conditions = + [ + { # only start if a keyholder opened the door and if the lounge mpd is currently not playing anything + condition = "template"; + value_template = "{{ state('sensor.keyholder') != 'No Keyholder' }}"; + } + { + condition = "state"; + entity_id = "media_player.lounge"; + state = "idle"; + } + ]; + }; + action = [ + { + service = "media_player.volume_set"; + data = { + entity_id = "media_player.lounge"; + volume_level = 1.0; + }; + } + { + service = "media_player.play_media"; + data = { + entity_id = "media_player.lounge"; + media_content_type = "playlist"; + media_content_id = "ansage"; + }; + } + { delay.seconds = 8; } + { + service = "media_player.volume_set"; + data = { + entity_id = "media_player.lounge"; + volume_level = 0.6; + }; + } + { + service = "media_player.play_media"; + data = { + entity_id = "media_player.lounge"; + media_content_type = "playlist"; + media_content_id = "lassulus superradio"; + }; + } + ]; + } +] diff --git a/krebs/2configs/shack/glados/default.nix b/krebs/2configs/shack/glados/default.nix index e48a54551..ef22ccb0d 100644 --- a/krebs/2configs/shack/glados/default.nix +++ b/krebs/2configs/shack/glados/default.nix @@ -93,6 +93,7 @@ in { light = badair.light; media_player = [ { platform = "mpd"; + name = "lounge"; host = "lounge.mpd.shack"; } ]; @@ -117,19 +118,27 @@ in { #conversation = {}; history = {}; logbook = {}; + logger = { + default = "info"; + }; recorder = {}; tts = [ { platform = "google_translate"; + service_name = "say"; language = "de"; + cache = true; + time_memory = 57600; } #{ platform = "picotts"; # language = "de-DE"; + # service_name = "say"; #} ]; sun = {}; - automation = wasser.automation - ++ badair.automation + automation = wasser.automation + ++ badair.automation + ++ (import ./automation/shack-startup.nix) ++ (import ./automation/hass-restart.nix); device_tracker = []; 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 e38f61c7ff54031d5f48e57b96eff0062feb99b2 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 30 Jan 2020 08:12:24 +0100 Subject: ma: update omo pubkey --- krebs/3modules/makefu/sshd/omo.pub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'krebs') diff --git a/krebs/3modules/makefu/sshd/omo.pub b/krebs/3modules/makefu/sshd/omo.pub index 63bbbc709..5b9435414 100644 --- a/krebs/3modules/makefu/sshd/omo.pub +++ b/krebs/3modules/makefu/sshd/omo.pub @@ -1 +1 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPTBGboU/P00yYiwYje53G0oqDFWmcSJ+hIpMsl4f/HH +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIujMZ3ZFxKpWeB/cjfKfYRr77+VRZk0Eik+92t03NoA -- cgit v1.2.3 From 160e9d1843b3e8c6d503a0ae023df31a27f7880c Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 12 Feb 2020 07:55:17 +0100 Subject: ma gum: add dns.euer.krebsco.de domain naim --- krebs/3modules/makefu/default.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'krebs') diff --git a/krebs/3modules/makefu/default.nix b/krebs/3modules/makefu/default.nix index dcfee59b3..6c2fd6245 100644 --- a/krebs/3modules/makefu/default.nix +++ b/krebs/3modules/makefu/default.nix @@ -171,6 +171,7 @@ in { cgit.euer IN A ${nets.internet.ip4.addr} dl.euer IN A ${nets.internet.ip4.addr} dockerhub IN A ${nets.internet.ip4.addr} + dns.euer IN A ${nets.internet.ip4.addr} euer IN A ${nets.internet.ip4.addr} euer IN MX 1 aspmx.l.google.com. ghook IN A ${nets.internet.ip4.addr} -- cgit v1.2.3 From 0509f857414ef1ca9b84f6cec29985ea50ecf579 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 12 Feb 2020 07:55:39 +0100 Subject: ma gum: sort dnsnames --- krebs/3modules/makefu/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'krebs') diff --git a/krebs/3modules/makefu/default.nix b/krebs/3modules/makefu/default.nix index 6c2fd6245..56d313528 100644 --- a/krebs/3modules/makefu/default.nix +++ b/krebs/3modules/makefu/default.nix @@ -164,14 +164,15 @@ in { ci = true; extraZones = { "krebsco.de" = '' + bookmark.euer IN A ${nets.internet.ip4.addr} boot IN A ${nets.internet.ip4.addr} boot.euer IN A ${nets.internet.ip4.addr} cache.euer IN A ${nets.internet.ip4.addr} cache.gum IN A ${nets.internet.ip4.addr} cgit.euer IN A ${nets.internet.ip4.addr} dl.euer IN A ${nets.internet.ip4.addr} - dockerhub IN A ${nets.internet.ip4.addr} dns.euer IN A ${nets.internet.ip4.addr} + dockerhub IN A ${nets.internet.ip4.addr} euer IN A ${nets.internet.ip4.addr} euer IN MX 1 aspmx.l.google.com. ghook IN A ${nets.internet.ip4.addr} @@ -179,7 +180,9 @@ in { gold IN A ${nets.internet.ip4.addr} graph IN A ${nets.internet.ip4.addr} gum IN A ${nets.internet.ip4.addr} + io IN NS gum.krebsco.de. iso.euer IN A ${nets.internet.ip4.addr} + mediengewitter IN CNAME over.dose.io. mon.euer IN A ${nets.internet.ip4.addr} netdata.euer IN A ${nets.internet.ip4.addr} nixos.unstable IN CNAME krebscode.github.io. @@ -190,9 +193,6 @@ in { wg.euer IN A ${nets.internet.ip4.addr} wiki.euer IN A ${nets.internet.ip4.addr} wikisearch IN A ${nets.internet.ip4.addr} - bookmark.euer IN A ${nets.internet.ip4.addr} - io IN NS gum.krebsco.de. - mediengewitter IN CNAME over.dose.io. ''; }; cores = 8; -- cgit v1.2.3 From d9e111716af4556cd5a29704080ba1e46c23ae02 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 19 Feb 2020 14:35:53 +0100 Subject: shack/glados: enable sensemap, mpd for kiosk --- krebs/2configs/shack/glados/default.nix | 5 +++++ krebs/2configs/shack/glados/sensors/sensemap.nix | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 krebs/2configs/shack/glados/sensors/sensemap.nix (limited to 'krebs') diff --git a/krebs/2configs/shack/glados/default.nix b/krebs/2configs/shack/glados/default.nix index ef22ccb0d..06350db2a 100644 --- a/krebs/2configs/shack/glados/default.nix +++ b/krebs/2configs/shack/glados/default.nix @@ -96,6 +96,10 @@ in { name = "lounge"; host = "lounge.mpd.shack"; } + { platform = "mpd"; + name = "kiosk"; + host = "lounge.kiosk.shack"; + } ]; sensor = @@ -103,6 +107,7 @@ in { ++ (import ./sensors/power.nix) ++ shackopen.sensor ++ badair.sensor; + airquality = (import ./sensors/sensemap.nix ); binary_sensor = shackopen.binary_sensor; diff --git a/krebs/2configs/shack/glados/sensors/sensemap.nix b/krebs/2configs/shack/glados/sensors/sensemap.nix new file mode 100644 index 000000000..dff29c3c4 --- /dev/null +++ b/krebs/2configs/shack/glados/sensors/sensemap.nix @@ -0,0 +1,6 @@ +[ + { + platform = "opensensemap"; + station_id = "56a0de932cb6e1e41040a68b"; + } +] -- 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') 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 54ef473e33af58638b242a086e9b8ef995fe2ce6 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 19 Feb 2020 14:37:00 +0100 Subject: shack/glados/schlechte_luft: enable ip and wifi sensors --- krebs/2configs/shack/glados/multi/schlechte_luft.nix | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'krebs') diff --git a/krebs/2configs/shack/glados/multi/schlechte_luft.nix b/krebs/2configs/shack/glados/multi/schlechte_luft.nix index 4625f6846..c02287d56 100644 --- a/krebs/2configs/shack/glados/multi/schlechte_luft.nix +++ b/krebs/2configs/shack/glados/multi/schlechte_luft.nix @@ -12,10 +12,17 @@ in (glados.esphome.led { name = "Fablab LED Part D"; host = "fablab_led"; topic = "D";}) ]; sensor = [ + (glados.esphome.ip { host = "fablab_feinstaub";}) + (glados.esphome.wifi { host = "fablab_feinstaub";}) (glados.esphome.temp { host = "fablab_feinstaub";}) (glados.esphome.dust_25m { host = "fablab_feinstaub";}) (glados.esphome.dust_100m { host = "fablab_feinstaub";}) + (glados.esphome.ip { host = "fablab_led";}) + (glados.esphome.wifi { host = "fablab_led";}) + + (glados.esphome.ip { host = "rz_feinstaub";}) + (glados.esphome.wifi { host = "rz_feinstaub";}) (glados.esphome.temp { host = "rz_feinstaub";}) (glados.esphome.hum { host = "rz_feinstaub";}) (glados.esphome.dust_25m { host = "rz_feinstaub";}) -- cgit v1.2.3 From 7f197bc2b842670707937779510cc4efc1a50dd4 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 19 Feb 2020 14:38:10 +0100 Subject: shack/glados: re-enable picotts with pico2wave --- krebs/2configs/shack/glados/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'krebs') diff --git a/krebs/2configs/shack/glados/default.nix b/krebs/2configs/shack/glados/default.nix index 06350db2a..7abc55af1 100644 --- a/krebs/2configs/shack/glados/default.nix +++ b/krebs/2configs/shack/glados/default.nix @@ -134,10 +134,10 @@ in { cache = true; time_memory = 57600; } - #{ platform = "picotts"; - # language = "de-DE"; - # service_name = "say"; - #} + { platform = "picotts"; + language = "de-DE"; + service_name = "pico"; + } ]; sun = {}; -- cgit v1.2.3 From 72d34fccb48e5a1c303db72e708f434225306fc9 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 19 Feb 2020 14:43:44 +0100 Subject: shack/glados: use kiosk to say something, add picotts package --- krebs/2configs/shack/glados/automation/shack-startup.nix | 4 ++-- krebs/2configs/shack/glados/default.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'krebs') diff --git a/krebs/2configs/shack/glados/automation/shack-startup.nix b/krebs/2configs/shack/glados/automation/shack-startup.nix index 10051d60a..35314923b 100644 --- a/krebs/2configs/shack/glados/automation/shack-startup.nix +++ b/krebs/2configs/shack/glados/automation/shack-startup.nix @@ -17,8 +17,8 @@ in condition = "template"; value_template = "{{ trigger.from_state.state != 'No Keyholder' }}"; }; - #action = glados.say.lounge "Danke {{trigger.to_state.state}} für das Übernehmen des Keys von {{trigger.from_state.state}}"; - action = []; + action = glados.say.kiosk "Danke {{trigger.to_state.state}} für das Übernehmen des Keys von {{trigger.from_state.state}}"; + # action = []; } { diff --git a/krebs/2configs/shack/glados/default.nix b/krebs/2configs/shack/glados/default.nix index 7abc55af1..d8ee199cc 100644 --- a/krebs/2configs/shack/glados/default.nix +++ b/krebs/2configs/shack/glados/default.nix @@ -39,7 +39,7 @@ in { ''; })).override { extraPackages = ps: with ps; [ - python-forecastio jsonrpc-async jsonrpc-websocket mpd2 + python-forecastio jsonrpc-async jsonrpc-websocket mpd2 picotts ]; }; autoExtraComponents = true; -- 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') 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/default.nix | 20 ++- krebs/2configs/shack/glados/lib/default.nix | 143 --------------------- krebs/2configs/shack/glados/multi/rollos.nix | 13 ++ .../2configs/shack/glados/multi/schlechte_luft.nix | 26 ---- krebs/2configs/shack/glados/sensors/darksky.nix | 21 +++ krebs/2configs/shack/glados/sensors/hass.nix | 5 - krebs/2configs/shack/glados/sensors/mate.nix | 16 +++ krebs/2configs/shack/glados/sensors/power.nix | 7 +- krebs/2configs/shack/glados/sensors/spaceapi.nix | 52 ++++++++ krebs/2configs/shack/glados/sensors/unifi.nix | 6 + 10 files changed, 124 insertions(+), 185 deletions(-) create mode 100644 krebs/2configs/shack/glados/multi/rollos.nix create mode 100644 krebs/2configs/shack/glados/sensors/darksky.nix delete mode 100644 krebs/2configs/shack/glados/sensors/hass.nix create mode 100644 krebs/2configs/shack/glados/sensors/mate.nix create mode 100644 krebs/2configs/shack/glados/sensors/spaceapi.nix create mode 100644 krebs/2configs/shack/glados/sensors/unifi.nix (limited to 'krebs') diff --git a/krebs/2configs/shack/glados/default.nix b/krebs/2configs/shack/glados/default.nix index d8ee199cc..3f3b1cac5 100644 --- a/krebs/2configs/shack/glados/default.nix +++ b/krebs/2configs/shack/glados/default.nix @@ -39,7 +39,7 @@ in { ''; })).override { extraPackages = ps: with ps; [ - python-forecastio jsonrpc-async jsonrpc-websocket mpd2 picotts + python-forecastio jsonrpc-async jsonrpc-websocket mpd2 pkgs.picotts ]; }; autoExtraComponents = true; @@ -76,6 +76,8 @@ in { client_id = "home-assistant"; keepalive = 60; protocol = 3.1; + discovery = true; #enable esphome discovery + discovery_prefix = "homeassistant"; birth_message = { topic = "glados/hass/status/LWT"; payload = "Online"; @@ -90,7 +92,7 @@ in { }; }; switch = wasser.switch; - light = badair.light; + light = []; media_player = [ { platform = "mpd"; name = "lounge"; @@ -103,13 +105,17 @@ in { ]; sensor = - (import ./sensors/hass.nix) - ++ (import ./sensors/power.nix) + (import ./sensors/power.nix) + ++ (import ./sensors/mate.nix) + ++ (import ./sensors/darksky.nix { inherit lib;}) ++ shackopen.sensor - ++ badair.sensor; - airquality = (import ./sensors/sensemap.nix ); + ; + air_quality = (import ./sensors/sensemap.nix ); - binary_sensor = shackopen.binary_sensor; + binary_sensor = + shackopen.binary_sensor + ++ (import ./sensors/spaceapi.nix) + ; camera = []; 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}: diff --git a/krebs/2configs/shack/glados/multi/rollos.nix b/krebs/2configs/shack/glados/multi/rollos.nix new file mode 100644 index 000000000..1febad525 --- /dev/null +++ b/krebs/2configs/shack/glados/multi/rollos.nix @@ -0,0 +1,13 @@ +let + glados = import ../lib; +in +{ + # LED + light = [ + ]; + sensor = [ + ]; + automation = + [ + ]; +} diff --git a/krebs/2configs/shack/glados/multi/schlechte_luft.nix b/krebs/2configs/shack/glados/multi/schlechte_luft.nix index c02287d56..529454a41 100644 --- a/krebs/2configs/shack/glados/multi/schlechte_luft.nix +++ b/krebs/2configs/shack/glados/multi/schlechte_luft.nix @@ -2,32 +2,6 @@ let glados = import ../lib; in { - # LED - light = [ - (glados.esphome.led { name = "Fablab LED"; host = "fablab_led"; topic = "led_ring"; }) - - (glados.esphome.led { name = "Fablab LED Part A"; host = "fablab_led"; topic = "A";}) - (glados.esphome.led { name = "Fablab LED Part B"; host = "fablab_led"; topic = "B";}) - (glados.esphome.led { name = "Fablab LED Part C"; host = "fablab_led"; topic = "C";}) - (glados.esphome.led { name = "Fablab LED Part D"; host = "fablab_led"; topic = "D";}) - ]; - sensor = [ - (glados.esphome.ip { host = "fablab_feinstaub";}) - (glados.esphome.wifi { host = "fablab_feinstaub";}) - (glados.esphome.temp { host = "fablab_feinstaub";}) - (glados.esphome.dust_25m { host = "fablab_feinstaub";}) - (glados.esphome.dust_100m { host = "fablab_feinstaub";}) - - (glados.esphome.ip { host = "fablab_led";}) - (glados.esphome.wifi { host = "fablab_led";}) - - (glados.esphome.ip { host = "rz_feinstaub";}) - (glados.esphome.wifi { host = "rz_feinstaub";}) - (glados.esphome.temp { host = "rz_feinstaub";}) - (glados.esphome.hum { host = "rz_feinstaub";}) - (glados.esphome.dust_25m { host = "rz_feinstaub";}) - (glados.esphome.dust_100m { host = "rz_feinstaub";}) - ]; automation = [ { alias = "Gute Luft Fablab"; diff --git a/krebs/2configs/shack/glados/sensors/darksky.nix b/krebs/2configs/shack/glados/sensors/darksky.nix new file mode 100644 index 000000000..c8725b868 --- /dev/null +++ b/krebs/2configs/shack/glados/sensors/darksky.nix @@ -0,0 +1,21 @@ +{lib,...}: +[ + { platform = "darksky"; + api_key = lib.removeSuffix "\n" + (builtins.readFile ); + language = "de"; + monitored_conditions = [ + "summary" "icon" + "nearest_storm_distance" "precip_probability" + "precip_intensity" + "temperature" # "temperature_high" "temperature_low" + "apparent_temperature" + "hourly_summary" # next 24 hours text + "humidity" + "pressure" + "uv_index" + ]; + units = "si" ; + scan_interval = "00:15:00"; + } +] diff --git a/krebs/2configs/shack/glados/sensors/hass.nix b/krebs/2configs/shack/glados/sensors/hass.nix deleted file mode 100644 index 8de0ef391..000000000 --- a/krebs/2configs/shack/glados/sensors/hass.nix +++ /dev/null @@ -1,5 +0,0 @@ -let - glados = import ../lib; -in - (map (host: glados.esphome.temp {inherit host;}) [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ]) - ++ (map (host: glados.esphome.hum {inherit host;}) [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ]) diff --git a/krebs/2configs/shack/glados/sensors/mate.nix b/krebs/2configs/shack/glados/sensors/mate.nix new file mode 100644 index 000000000..1bb0e71eb --- /dev/null +++ b/krebs/2configs/shack/glados/sensors/mate.nix @@ -0,0 +1,16 @@ +let + fuellstand = name: id: { + platform = "rest"; + resource = "https://ora5.tutschonwieder.net/ords/lick_prod/v1/get/fuellstand/1/${toString id}"; + method = "GET"; + name = "Füllstand ${name}"; + value_template = "{{ value_json.fuellstand }}"; + }; +in [ + (fuellstand "Wasser" 1) + (fuellstand "Mate Cola" 2) + (fuellstand "Apfelschorle" 3) + (fuellstand "Zitronensprudel" 4) + (fuellstand "Mate 1" 26) + (fuellstand "Mate 2" 27) +] diff --git a/krebs/2configs/shack/glados/sensors/power.nix b/krebs/2configs/shack/glados/sensors/power.nix index 1aa250a19..b168f2beb 100644 --- a/krebs/2configs/shack/glados/sensors/power.nix +++ b/krebs/2configs/shack/glados/sensors/power.nix @@ -2,7 +2,6 @@ let power_x = name: phase: { platform = "mqtt"; name = "${phase} ${name}"; - # device_class = "power"; state_topic = "/power/total/${phase}/${name}"; availability_topic = "/power/lwt"; payload_available = "Online"; @@ -11,17 +10,17 @@ let power_consumed = { platform = "mqtt"; name = "Power Consumed"; - #device_class = "power"; + device_class = "power"; state_topic = "/power/total/consumed"; availability_topic = "/power/lwt"; payload_available = "Online"; payload_not_available = "Offline"; }; power_volt = power_x "Voltage"; - power_watt = power_x "Power"; + power_watt = (power_x "Power") ; power_curr = power_x "Current"; in (map power_volt [ "L1" "L2" "L3" ]) -++ (map power_watt [ "L1" "L2" "L3" ]) +++ (map (x: ((power_watt x) // { device_class = "power"; })) [ "L1" "L2" "L3" ]) ++ (map power_curr [ "L1" "L2" "L3" ]) ++ [ power_consumed ] diff --git a/krebs/2configs/shack/glados/sensors/spaceapi.nix b/krebs/2configs/shack/glados/sensors/spaceapi.nix new file mode 100644 index 000000000..11cab11c9 --- /dev/null +++ b/krebs/2configs/shack/glados/sensors/spaceapi.nix @@ -0,0 +1,52 @@ +[ + { + platform = "rest"; + resource = "https://spaceapi.afra-berlin.de/v1/status.json"; + method = "GET"; + name = "Door AFRA Berlin"; + device_class = "door"; + value_template = "{{ value_json.open }}"; + } + { + platform = "rest"; + resource = "http://club.entropia.de/spaceapi"; + method = "GET"; + name = "Door Entropia"; + device_class = "door"; + value_template = "{{ value_json.open }}"; + } + { + platform = "rest"; + resource = "http://www.c-base.org/status.json"; + method = "GET"; + name = "Door C-Base Berlin"; + device_class = "door"; + value_template = "{{ value_json.open }}"; + } + { + platform = "rest"; + resource = "https://status.raumzeitlabor.de/api/full.json"; + method = "GET"; + name = "Door RZL"; + device_class = "door"; + value_template = "{{ value_json.status }}"; + } + { + platform = "rest"; + resource = "https://datenobservatorium.de/"; + method = "GET"; + name = "Door Datenobservatorium"; + device_class = "door"; + value_template = "false"; + scan_interval = 2592000; + } + { + platform = "rest"; + resource = "https://infuanfu.de/"; + method = "GET"; + name = "Door Infuanfu"; + device_class = "door"; + value_template = "false"; + scan_interval = 2592000; + } +] diff --git a/krebs/2configs/shack/glados/sensors/unifi.nix b/krebs/2configs/shack/glados/sensors/unifi.nix new file mode 100644 index 000000000..f64e3feb6 --- /dev/null +++ b/krebs/2configs/shack/glados/sensors/unifi.nix @@ -0,0 +1,6 @@ +{ + controllers = { + host = "unifi.shack"; + site = "shackspace"; + }; +} -- cgit v1.2.3 From 6cc25488bf92b3d5345dae3ea93b66f7652b6255 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 13 Mar 2020 10:50:18 +0100 Subject: shack: update node-light, update glados --- krebs/2configs/shack/glados/default.nix | 5 ++++- krebs/2configs/shack/glados/switch/power.nix | 32 ++++++++++++++++++++++++++++ krebs/2configs/shack/node-light.nix | 6 +++--- 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 krebs/2configs/shack/glados/switch/power.nix (limited to 'krebs') diff --git a/krebs/2configs/shack/glados/default.nix b/krebs/2configs/shack/glados/default.nix index 3f3b1cac5..920f2ed2f 100644 --- a/krebs/2configs/shack/glados/default.nix +++ b/krebs/2configs/shack/glados/default.nix @@ -91,7 +91,10 @@ in { retain = true; }; }; - switch = wasser.switch; + switch = + wasser.switch + ++ (import ./switch/power.nix) + ; light = []; media_player = [ { platform = "mpd"; diff --git a/krebs/2configs/shack/glados/switch/power.nix b/krebs/2configs/shack/glados/switch/power.nix new file mode 100644 index 000000000..4e9a45c28 --- /dev/null +++ b/krebs/2configs/shack/glados/switch/power.nix @@ -0,0 +1,32 @@ +# 1 - haupt +# 2 - dusche +# 3 - warmwasser +# 4 - or +# 5 - kueche +let + nodelight = type: ident: name: { + platform = "mqtt"; + name = "${type} ${name}"; + command_topic = "${type}/${toString ident}/command"; + state_topic = "${type}/${toString ident}/state"; + payload_on = "on"; + payload_off = "off"; + }; + power = nodelight "power"; + light = ident: name: { icon = "mdi:lightbulb";} // nodelight "light" ident name; +in +[ + (power 1 "Hauptschalter") + (power 2 "Dusche") + (power 3 "Warmwasser") + (power 4 "Optionsräume") + (power 5 "Küche") + (light 1 "Decke Lounge 1") + (light 2 "Decke Lounge 2") + (light 3 "Decke Lounge 3") + (light 4 "Decke Lounge 4") + (light 5 "Decke Lounge 5") + (light 6 "Decke Lounge 6") + (light 7 "Decke Lounge 7") + (light 8 "Decke Lounge 8") +] diff --git a/krebs/2configs/shack/node-light.nix b/krebs/2configs/shack/node-light.nix index 9e3828463..b471f2af5 100644 --- a/krebs/2configs/shack/node-light.nix +++ b/krebs/2configs/shack/node-light.nix @@ -4,9 +4,9 @@ let pkg = pkgs.callPackage ( pkgs.fetchgit { url = "https://git.shackspace.de/rz/node-light.git"; - rev = "9c3fe451897cf170fb192a2643180fdfe22388e8"; - sha256 = "1zsc38idg452r8wpcna5m3yqx0ri11bd1bw60bl0kpz96dqqnyba"; - }) { mkYarnPackage = pkgs.yarn2nix-moretea.mkYarnPackage; }; + rev = "90a9347b73af3a9960bd992e6293b357226ef6a0"; + sha256 = "1av9w3w8aknlra25jw6gqxzbb01i9kdlfziy29lwz7mnryjayvwk"; + }) { }; home = "/var/lib/node-light"; port = "8082"; in { -- cgit v1.2.3 From 345fc92cbf1975da935909e3769935e733890e88 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 13 Mar 2020 10:51:34 +0100 Subject: ma gum.r: add board.euer, rss.euer --- krebs/3modules/makefu/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'krebs') diff --git a/krebs/3modules/makefu/default.nix b/krebs/3modules/makefu/default.nix index 56d313528..c76ed0ad1 100644 --- a/krebs/3modules/makefu/default.nix +++ b/krebs/3modules/makefu/default.nix @@ -182,6 +182,8 @@ in { gum IN A ${nets.internet.ip4.addr} io IN NS gum.krebsco.de. iso.euer IN A ${nets.internet.ip4.addr} + board.euer IN A ${nets.internet.ip4.addr} + rss.euer IN A ${nets.internet.ip4.addr} mediengewitter IN CNAME over.dose.io. mon.euer IN A ${nets.internet.ip4.addr} netdata.euer IN A ${nets.internet.ip4.addr} @@ -202,7 +204,6 @@ in { ip6.addr = "2a01:4f8:191:12f6::2"; aliases = [ "gum.i" - "nextgum.i" ]; }; wiregrill = { @@ -238,6 +239,7 @@ in { "tracker.makefu.r" "wiki.gum.r" "wiki.makefu.r" + "warrior.gum.r" "sick.makefu.r" ]; }; -- cgit v1.2.3 From 59aa15467972da51d3e051c8cb0bccfe6bdec3ea Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 13 Mar 2020 11:58:30 +0100 Subject: krebs test-secrets: add darksky.apikey --- krebs/0tests/data/secrets/hass/darksky.apikey | 1 + 1 file changed, 1 insertion(+) create mode 100644 krebs/0tests/data/secrets/hass/darksky.apikey (limited to 'krebs') diff --git a/krebs/0tests/data/secrets/hass/darksky.apikey b/krebs/0tests/data/secrets/hass/darksky.apikey new file mode 100644 index 000000000..4932cd639 --- /dev/null +++ b/krebs/0tests/data/secrets/hass/darksky.apikey @@ -0,0 +1 @@ +LOL -- cgit v1.2.3