shack/glados: update automations
This commit is contained in:
parent
8901bab8ad
commit
4bb7a52e98
|
@ -3,18 +3,21 @@ let
|
||||||
shackopen = import ./multi/shackopen.nix;
|
shackopen = import ./multi/shackopen.nix;
|
||||||
wasser = import ./multi/wasser.nix;
|
wasser = import ./multi/wasser.nix;
|
||||||
in {
|
in {
|
||||||
services.nginx.virtualHosts."hass.shack".locations."/" = {
|
services.nginx.virtualHosts."hass.shack" = {
|
||||||
proxyPass = "http://localhost:8123";
|
serverAliases = [ "glados.shack" ];
|
||||||
extraConfig = ''
|
locations."/" = {
|
||||||
proxy_http_version 1.1;
|
proxyPass = "http://localhost:8123";
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
extraConfig = ''
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_http_version 1.1;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Connection "upgrade";
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
services.home-assistant = let
|
services.home-assistant = let
|
||||||
dwd_pollen = pkgs.fetchFromGitHub {
|
dwd_pollen = pkgs.fetchFromGitHub {
|
||||||
|
|
|
@ -12,6 +12,7 @@ let
|
||||||
retain = false;
|
retain = false;
|
||||||
qos = 1;
|
qos = 1;
|
||||||
};
|
};
|
||||||
|
seconds = 30;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
switch = [
|
switch = [
|
||||||
|
@ -19,7 +20,7 @@ in
|
||||||
];
|
];
|
||||||
automation =
|
automation =
|
||||||
[
|
[
|
||||||
{ alias = "Water the plant for 10 seconds";
|
{ alias = "Water the plant for ${toString seconds} seconds";
|
||||||
trigger = [
|
trigger = [
|
||||||
{ # trigger at 20:00 no matter what
|
{ # trigger at 20:00 no matter what
|
||||||
# TODO: retry or run only if switch.wasser is available
|
# TODO: retry or run only if switch.wasser is available
|
||||||
|
@ -35,7 +36,7 @@ in
|
||||||
"switch.wasser"
|
"switch.wasser"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{ delay.seconds = 10; }
|
{ delay.seconds = seconds; }
|
||||||
{
|
{
|
||||||
service = "homeassistant.turn_off";
|
service = "homeassistant.turn_off";
|
||||||
entity_id = [
|
entity_id = [
|
||||||
|
@ -44,13 +45,13 @@ in
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{ alias = "Always turn off water after 15 seconds";
|
{ alias = "Always turn off water after ${toString (seconds * 2)}seconds";
|
||||||
trigger = [
|
trigger = [
|
||||||
{
|
{
|
||||||
platform = "state";
|
platform = "state";
|
||||||
entity_id = "switch.wasser";
|
entity_id = "switch.wasser";
|
||||||
to = "on";
|
to = "on";
|
||||||
for.seconds = 15;
|
for.seconds = seconds*2;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
action =
|
action =
|
||||||
|
|
Loading…
Reference in a new issue