summaryrefslogtreecommitdiffstats
path: root/krebs/2configs
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/2configs')
-rw-r--r--krebs/2configs/shack/glados/automation/hass-restart.nix3
-rw-r--r--krebs/2configs/shack/glados/automation/shack-startup.nix82
-rw-r--r--krebs/2configs/shack/glados/default.nix24
-rw-r--r--krebs/2configs/shack/glados/lib/default.nix60
-rw-r--r--krebs/2configs/shack/glados/multi/schlechte_luft.nix12
-rw-r--r--krebs/2configs/shack/glados/sensors/sensemap.nix6
-rw-r--r--krebs/2configs/shack/muellshack.nix5
7 files changed, 184 insertions, 8 deletions
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..7abc55af1 100644
--- a/krebs/2configs/shack/glados/default.nix
+++ b/krebs/2configs/shack/glados/default.nix
@@ -93,8 +93,13 @@ in {
light = badair.light;
media_player = [
{ platform = "mpd";
+ name = "lounge";
host = "lounge.mpd.shack";
}
+ { platform = "mpd";
+ name = "kiosk";
+ host = "lounge.kiosk.shack";
+ }
];
sensor =
@@ -102,6 +107,7 @@ in {
++ (import ./sensors/power.nix)
++ shackopen.sensor
++ badair.sensor;
+ airquality = (import ./sensors/sensemap.nix );
binary_sensor = shackopen.binary_sensor;
@@ -117,19 +123,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 = "pico";
}
- #{ platform = "picotts";
- # language = "de-DE";
- #}
];
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..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
diff --git a/krebs/2configs/shack/glados/multi/schlechte_luft.nix b/krebs/2configs/shack/glados/multi/schlechte_luft.nix
index 9cd2c56f4..c02287d56 100644
--- a/krebs/2configs/shack/glados/multi/schlechte_luft.nix
+++ b/krebs/2configs/shack/glados/multi/schlechte_luft.nix
@@ -12,9 +12,21 @@ 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";})
+ (glados.esphome.dust_100m { host = "rz_feinstaub";})
];
automation =
[
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";
+ }
+]
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";