ma bureautomation: fetch latest xkcd comic
This commit is contained in:
parent
4cb0ff12ba
commit
5ccb8e08e8
@ -3,4 +3,8 @@
|
||||
platform = "generic";
|
||||
still_image_url = http://127.0.0.1:8123/local/lines.png ;
|
||||
}
|
||||
{ name = "XKCD";
|
||||
platform = "generic";
|
||||
still_image_url = http://127.0.0.1:8123/local/xkcd.png ;
|
||||
}
|
||||
]
|
||||
|
@ -6,21 +6,29 @@ let
|
||||
in {
|
||||
systemd.services.comic-updater = {
|
||||
startAt = "daily";
|
||||
description = "Send led change to message queue";
|
||||
description = "update our comics";
|
||||
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" ''
|
||||
ExecStart = pkgs.writeDash "update-comics" ''
|
||||
set -euf
|
||||
mkdir -p www/
|
||||
cd www/
|
||||
# poorly drawn lines
|
||||
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
|
||||
|
||||
#pic=$(curl -L xkcd.com 2>/dev/null | grep imgs.xkcd.com | grep title | sed -n 's/.*src="\([^"]\+\)" .*/https:\1/p')
|
||||
# xkcd
|
||||
pic=$(wget -O- https://xkcd.com/rss.xml \
|
||||
| xml sel -t -v '/rss/channel/item/description' \
|
||||
| head -n 1 | sed -n 's/.*src="\([^"]\+\)".*/\1/p' )
|
||||
wget "$pic" -nc && cp -v "$(basename "$pic")" xkcd.png
|
||||
'';
|
||||
PrivateTmp = true;
|
||||
};
|
||||
|
@ -137,9 +137,9 @@ in {
|
||||
++ frosch.binary_sensor
|
||||
++ aramark.binary_sensor;
|
||||
|
||||
sensor =
|
||||
# [{ platform = "version"; }] ++ # pyhaversion
|
||||
(import ./sensor/pollen.nix)
|
||||
sensor = []
|
||||
++ [{ platform = "version"; }] # pyhaversion
|
||||
++ (import ./sensor/pollen.nix)
|
||||
++ (import ./sensor/espeasy.nix)
|
||||
++ (import ./sensor/airquality.nix)
|
||||
++ ((import ./sensor/outside.nix) {inherit lib;})
|
||||
@ -238,6 +238,7 @@ in {
|
||||
"camera.Autobahn_Singen"
|
||||
"camera.puppies"
|
||||
"camera.poorly_drawn_lines"
|
||||
"camera.xkcd"
|
||||
];
|
||||
nachtlicht = [
|
||||
"switch.nachtlicht_a"
|
||||
|
Loading…
Reference in New Issue
Block a user