diff options
-rw-r--r-- | makefu/2configs/bureautomation/camera/comic.nix | 6 | ||||
-rw-r--r-- | makefu/2configs/bureautomation/comic-updater.nix | 28 | ||||
-rw-r--r-- | makefu/2configs/bureautomation/default.nix | 29 |
3 files changed, 59 insertions, 4 deletions
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 ba2e5649f..d745d894a 100644 --- a/makefu/2configs/bureautomation/default.nix +++ b/makefu/2configs/bureautomation/default.nix @@ -8,6 +8,7 @@ let in { imports = [ ./ota.nix + ./comic-updater.nix ]; networking.firewall.allowedTCPPorts = [ 8123 ]; state = [ "/var/lib/hass/known_devices.yaml" ]; @@ -114,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"; }] ++ @@ -123,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 = @@ -175,6 +179,7 @@ in { "group.team" "group.nachtlicht" "group.switches" + "group.aramark" ]; }; automation = []; @@ -196,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" @@ -206,6 +210,7 @@ in { "camera.Baumarkt" "camera.Autobahn_Heilbronn" "camera.Autobahn_Singen" + "camera.poorly_drawn_lines" ]; nachtlicht = [ "switch.nachtlicht_a" @@ -213,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" @@ -222,6 +242,7 @@ in { "sensor.easy2_dht22_humidity" "sensor.easy2_dht22_temperature" "sensor.air_quality" + # "binary_sensor.aramark_pommes" # "binary_sensor.redbutton" ]; outside = [ |