summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bureautomation
diff options
context:
space:
mode:
Diffstat (limited to 'makefu/2configs/bureautomation')
-rw-r--r--makefu/2configs/bureautomation/automation/bureau-shutdown.nix26
-rw-r--r--makefu/2configs/bureautomation/camera/comic.nix6
-rw-r--r--makefu/2configs/bureautomation/comic-updater.nix28
-rw-r--r--makefu/2configs/bureautomation/default.nix36
-rw-r--r--makefu/2configs/bureautomation/lib/scripts.nix18
-rw-r--r--makefu/2configs/bureautomation/multi/10h_timers.nix (renamed from makefu/2configs/bureautomation/combination/10h_timers.nix)9
-rw-r--r--makefu/2configs/bureautomation/multi/README.md (renamed from makefu/2configs/bureautomation/combination/README.md)0
-rw-r--r--makefu/2configs/bureautomation/multi/aramark.nix24
-rw-r--r--makefu/2configs/bureautomation/multi/matrix.nix (renamed from makefu/2configs/bureautomation/combination/matrix.nix)0
-rw-r--r--makefu/2configs/bureautomation/multi/mittagessen.nix (renamed from makefu/2configs/bureautomation/combination/mittagessen.nix)0
10 files changed, 122 insertions, 25 deletions
diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix
index 007f6064a..b9aa710c3 100644
--- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix
+++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix
@@ -34,18 +34,18 @@
}
{ alias = "Turn off Fernseher after last in group left";
trigger = [
- { # trigger when movement was detected at the time
- platform = "state";
- entity_id = "group.team";
- from = "home";
- to = "not_home";
- }
- { # trigger at 18:00 no matter what
- # to avoid 'everybody left before 18:00:00'
- platform = "time";
- at = "18:00:00";
- }
- ];
+ { # trigger when movement was detected at the time
+ platform = "state";
+ entity_id = "group.team";
+ from = "home";
+ to = "not_home";
+ }
+ { # trigger at 18:00 no matter what
+ # to avoid 'everybody left before 18:00:00'
+ platform = "time";
+ at = "18:00:00";
+ }
+ ];
action = [
{
service = "homeassistant.turn_off";
@@ -58,7 +58,7 @@
}
{
service = "notify.telegrambot";
- data = {
+ data_template = {
title = "Bureau Shutdown";
message = "All devices are turned off due to {{ trigger.platform }}";
};
diff --git a/makefu/2configs/bureautomation/camera/comic.nix b/makefu/2configs/bureautomation/camera/comic.nix
new file mode 100644
index 000000000..a847b0add
--- /dev/null
+++ b/makefu/2configs/bureautomation/camera/comic.nix
@@ -0,0 +1,6 @@
+[
+ { name = "Poorly Drawn Lines";
+ platform = "generic";
+ still_image_url = http://127.0.0.1:8123/local/lines.png ;
+ }
+]
diff --git a/makefu/2configs/bureautomation/comic-updater.nix b/makefu/2configs/bureautomation/comic-updater.nix
new file mode 100644
index 000000000..5f26bc2c7
--- /dev/null
+++ b/makefu/2configs/bureautomation/comic-updater.nix
@@ -0,0 +1,28 @@
+{ config, lib, pkgs, buildPythonPackage, ... }:
+
+let
+ mq = "192.168.8.11";
+ pkg = pkgs.ampel;
+in {
+ systemd.services.comic-updater = {
+ startAt = "daily";
+ description = "Send led change to message queue";
+ after = [ "network-online.target" ] ++ (lib.optional config.services.mosquitto.enable "mosquitto.service");
+ path = with pkgs; [ wget xmlstarlet ];
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ User = "hass";
+ WorkingDirectory = config.services.home-assistant.configDir;
+ ExecStart = pkgs.writeDash "update-poorly-drawn-lines" ''
+ set -euf
+ mkdir -p www/
+ cd www/
+ pic=$(wget -O- http://www.poorlydrawnlines.com/feed/ \
+ | xml sel -t -v '/rss/channel/item/content:encoded' \
+ | head -n 2 | sed -n 's/.*src="\([^"]\+\)".*/\1/p' )
+ wget "$pic" -nc && cp -v "$(basename "$pic")" lines.png
+ '';
+ PrivateTmp = true;
+ };
+ };
+}
diff --git a/makefu/2configs/bureautomation/default.nix b/makefu/2configs/bureautomation/default.nix
index 8ec9dacc2..d745d894a 100644
--- a/makefu/2configs/bureautomation/default.nix
+++ b/makefu/2configs/bureautomation/default.nix
@@ -1,12 +1,14 @@
{ config, pkgs, lib, ... }:
let
kodi-host = "192.168.8.11";
- ten_hours = import ./combination/10h_timers.nix { inherit lib; }; # provides: timer automation script
- mittagessen = import ./combination/mittagessen.nix { inherit lib; }; # provides: automation script
- matrix = import ./combination/matrix.nix { inherit lib; }; # provides: matrix automation
+ ten_hours = import ./multi/10h_timers.nix { inherit lib; }; # provides: timer automation script
+ mittagessen = import ./multi/mittagessen.nix { inherit lib; }; # provides: automation script
+ matrix = import ./multi/matrix.nix { inherit lib; }; # provides: matrix automation
+ aramark = import ./multi/aramark.nix { inherit lib; }; # provides: pommes sensor
in {
imports = [
./ota.nix
+ ./comic-updater.nix
];
networking.firewall.allowedTCPPorts = [ 8123 ];
state = [ "/var/lib/hass/known_devices.yaml" ];
@@ -113,7 +115,8 @@ in {
];
binary_sensor =
(import ./binary_sensor/buttons.nix) ++
- (import ./binary_sensor/motion.nix);
+ (import ./binary_sensor/motion.nix) ++
+ aramark.binary_sensor;
sensor =
[{ platform = "version"; }] ++
@@ -122,10 +125,12 @@ in {
(import ./sensor/airquality.nix) ++
((import ./sensor/outside.nix) {inherit lib;}) ++
(import ./sensor/influxdb.nix) ++
- (import ./sensor/tasmota_firmware.nix);
+ (import ./sensor/tasmota_firmware.nix) ++
+ aramark.sensor;
camera =
- (import ./camera/verkehrskamera.nix);
+ (import ./camera/verkehrskamera.nix)
+ ++ (import ./camera/comic.nix);
# not yet released
#person =
@@ -174,6 +179,7 @@ in {
"group.team"
"group.nachtlicht"
"group.switches"
+ "group.aramark"
];
};
automation = [];
@@ -195,7 +201,6 @@ in {
"device_tracker.carsten_phone"
"device_tracker.thierry_phone"
"device_tracker.frank_phone"
- "device_tracker.anthony_phone"
# "person.thorsten"
# "person.felix"
# "person.ecki"
@@ -205,6 +210,7 @@ in {
"camera.Baumarkt"
"camera.Autobahn_Heilbronn"
"camera.Autobahn_Singen"
+ "camera.poorly_drawn_lines"
];
nachtlicht = [
"switch.nachtlicht_a"
@@ -212,6 +218,21 @@ in {
"switch.nachtlicht_c"
"switch.nachtlicht_d"
];
+ Aramark = [
+ "binary_sensor.pommes"
+ "sensor.menu_1"
+ "sensor.menu_1_text"
+ "sensor.menu_1_preis"
+ "sensor.menu_2"
+ "sensor.menu_2_text"
+ "sensor.menu_2_preis"
+ "sensor.aktion"
+ "sensor.aktion_text"
+ "sensor.aktion_preis"
+ "sensor.mercato"
+ "sensor.mercato_text"
+ "sensor.mercato_preis"
+ ];
sensors = [
"media_player.kodi"
"script.blitz_10s"
@@ -221,6 +242,7 @@ in {
"sensor.easy2_dht22_humidity"
"sensor.easy2_dht22_temperature"
"sensor.air_quality"
+ # "binary_sensor.aramark_pommes"
# "binary_sensor.redbutton"
];
outside = [
diff --git a/makefu/2configs/bureautomation/lib/scripts.nix b/makefu/2configs/bureautomation/lib/scripts.nix
new file mode 100644
index 000000000..d8665f94f
--- /dev/null
+++ b/makefu/2configs/bureautomation/lib/scripts.nix
@@ -0,0 +1,18 @@
+{ lib, ... }:
+{
+ multi_flash = { entity, delays ? [ 500 ], alias ? "${entity}_multi_flash_${toString (lib.length delays)}" }:
+ {
+ inherit alias;
+ sequence = lib.flatten (builtins.map (delay: [
+ { service = "homeassistant.turn_on";
+ data.entity_id = entity;
+ }
+ { delay.milliseconds = delay; }
+ { service = "homeassistant.turn_off";
+ data.entity_id = entity;
+ }
+ { delay.milliseconds = delay; }
+ ]
+ ) delays);
+ };
+}
diff --git a/makefu/2configs/bureautomation/combination/10h_timers.nix b/makefu/2configs/bureautomation/multi/10h_timers.nix
index dec5347a6..53bfd3725 100644
--- a/makefu/2configs/bureautomation/combination/10h_timers.nix
+++ b/makefu/2configs/bureautomation/multi/10h_timers.nix
@@ -1,7 +1,6 @@
{lib, ... }:
let
- persons = [ "frank" "daniel" "thorsten" "carsten" "thierry" "ecki" "felix"
- "anthony" # antony
+ persons = [ "frank" "daniel" "thorsten" "carsten" "ecki" "felix"
"thierry" # tjeri
];
random_zu_lange = name: ''{{ [
@@ -45,7 +44,7 @@ let
"Im Kalender von ${name} sind heute acht Meetings eingeplant, von denen zwei bereits verpasst wurden",
"Das Postfach von ${name} beinhaltet einhundertachtundzwanzig ungelesene E-Mails.",
"Nachricht von Serge: ${name}, bitte melden Sie sich Umgehend bei mir im Büro!",
- "Luftqualität hat sich durch das Eintreffen von ${name} um zweihunder Punkte verschlechtert, bitte alle Fenster öffnen.",
+ "Luftqualität hat sich durch das Eintreffen von ${name} um zweihundert Punkte verschlechtert, bitte alle Fenster öffnen.",
"Die Tür geht auf, wer mag das sein? Schon schreitet hier der ${name} ein. Das Volk, es jubelt, Dirnen schmachten. Fürs Festmahl beginnt man schon zu schlachten. Er wird nur nach dem besten streben! Der ${name}, er soll lange leben!",
"${name} arbeitet gern für seinen Konzern",
"${name} ist nur froh im Großraumbüro",
@@ -147,8 +146,8 @@ let
entity_id = [ "timer.${name}_10h" ] ;
}
{ service = "homeassistant.turn_on";
- entity_id = [
- # "script.buzz_${name}"
+ entity_id = [
+ "switch.fernseher"
"script.blitz_10s"
"script.announce_${name}"
];
diff --git a/makefu/2configs/bureautomation/combination/README.md b/makefu/2configs/bureautomation/multi/README.md
index baad87fda..baad87fda 100644
--- a/makefu/2configs/bureautomation/combination/README.md
+++ b/makefu/2configs/bureautomation/multi/README.md
diff --git a/makefu/2configs/bureautomation/multi/aramark.nix b/makefu/2configs/bureautomation/multi/aramark.nix
new file mode 100644
index 000000000..ebe2cde81
--- /dev/null
+++ b/makefu/2configs/bureautomation/multi/aramark.nix
@@ -0,0 +1,24 @@
+{ lib, ... }:
+let
+ aramark = topic: name:
+ { platform = "mqtt";
+ inherit name;
+ state_topic = "/aramark/thales-deutschland/${topic}";
+ };
+ aramark_menue = menue:
+ [
+ (aramark "${menue}/title" menue)
+ (aramark "${menue}/description" "${menue} Text")
+ ((aramark "${menue}/price" "${menue} Preis") // { unit_of_measurement = "€"; })
+ ];
+in
+{
+ sensor = (aramark_menue "Menü 1")
+ ++ (aramark_menue "Menü 2")
+ ++ (aramark_menue "Mercato")
+ ++ (aramark_menue "Aktion");
+ binary_sensor =
+ [
+ ((aramark "pommes" "Pommes" ) // { payload_on = "True"; payload_off = "False"; })
+ ];
+}
diff --git a/makefu/2configs/bureautomation/combination/matrix.nix b/makefu/2configs/bureautomation/multi/matrix.nix
index 85ba31986..85ba31986 100644
--- a/makefu/2configs/bureautomation/combination/matrix.nix
+++ b/makefu/2configs/bureautomation/multi/matrix.nix
diff --git a/makefu/2configs/bureautomation/combination/mittagessen.nix b/makefu/2configs/bureautomation/multi/mittagessen.nix
index 3ec70998d..3ec70998d 100644
--- a/makefu/2configs/bureautomation/combination/mittagessen.nix
+++ b/makefu/2configs/bureautomation/multi/mittagessen.nix