ma bureautomation: show daily comic

This commit is contained in:
makefu 2019-09-25 14:04:12 +02:00
parent 8e7a845c44
commit 73ea6c9f5e
3 changed files with 59 additions and 4 deletions

View file

@ -0,0 +1,6 @@
[
{ name = "Poorly Drawn Lines";
platform = "generic";
still_image_url = http://127.0.0.1:8123/local/lines.png ;
}
]

View file

@ -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;
};
};
}

View file

@ -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 = [