shack/glados: init shackopen and auto watering
This commit is contained in:
parent
39b1e08ad1
commit
fce2c4275c
@ -1,5 +1,7 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
shackopen = import ./multi/shackopen.nix;
|
||||
wasser = import ./multi/wasser.nix;
|
||||
in {
|
||||
services.nginx.virtualHosts."hass.shack".locations."/" = {
|
||||
proxyPass = "http://localhost:8123";
|
||||
@ -81,17 +83,21 @@ in {
|
||||
retain = true;
|
||||
};
|
||||
};
|
||||
switch = [];
|
||||
switch = wasser.switch;
|
||||
light = [];
|
||||
media_player = [
|
||||
{ platform = "mpd";
|
||||
host = "lounge.mpd.shack";
|
||||
}
|
||||
];
|
||||
|
||||
sensor =
|
||||
[{ platform = "version"; }]
|
||||
++ (import ./sensors/hass.nix)
|
||||
++ (import ./sensors/power.nix);
|
||||
++ (import ./sensors/power.nix)
|
||||
++ shackopen.sensor;
|
||||
|
||||
binary_sensor = shackopen.binary_sensor;
|
||||
|
||||
camera = [];
|
||||
|
||||
@ -123,7 +129,7 @@ in {
|
||||
recorder = {};
|
||||
sun = {};
|
||||
|
||||
automation = [];
|
||||
automation = wasser.automation;
|
||||
device_tracker = [];
|
||||
};
|
||||
};
|
||||
|
23
krebs/2configs/shack/glados/multi/shackopen.nix
Normal file
23
krebs/2configs/shack/glados/multi/shackopen.nix
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
binary_sensor = [
|
||||
{ platform = "mqtt";
|
||||
name = "Portal Lock";
|
||||
device_class = "door";
|
||||
state_topic = "portal/gateway/status";
|
||||
availability_topic = "portal/gateway/lwt";
|
||||
payload_on = "open";
|
||||
payload_off = "closed";
|
||||
payload_available = "online";
|
||||
payload_not_available = "offline";
|
||||
}
|
||||
];
|
||||
sensor = [
|
||||
{ platform = "mqtt";
|
||||
name = "Keyholder";
|
||||
state_topic = "portal/gateway/keyholder";
|
||||
availability_topic = "portal/gateway/lwt";
|
||||
payload_available = "online";
|
||||
payload_not_available = "offline";
|
||||
}
|
||||
];
|
||||
}
|
65
krebs/2configs/shack/glados/multi/wasser.nix
Normal file
65
krebs/2configs/shack/glados/multi/wasser.nix
Normal file
@ -0,0 +1,65 @@
|
||||
let
|
||||
tasmota_plug = name: topic:
|
||||
{ platform = "mqtt";
|
||||
inherit name;
|
||||
state_topic = "sonoff/stat/${topic}/POWER1";
|
||||
command_topic = "sonoff/cmnd/${topic}/POWER1";
|
||||
availability_topic = "sonoff/tele/${topic}/LWT";
|
||||
payload_on= "ON";
|
||||
payload_off= "OFF";
|
||||
payload_available= "Online";
|
||||
payload_not_available= "Offline";
|
||||
retain = false;
|
||||
qos = 1;
|
||||
};
|
||||
in
|
||||
{
|
||||
switch = [
|
||||
(tasmota_plug "Wasser" "plug")
|
||||
];
|
||||
automation =
|
||||
[
|
||||
{ alias = "Water the plant for 10 seconds";
|
||||
trigger = [
|
||||
{ # trigger at 20:00 no matter what
|
||||
# TODO: retry or run only if switch.wasser is available
|
||||
platform = "time";
|
||||
at = "20:00:00";
|
||||
}
|
||||
];
|
||||
action =
|
||||
[
|
||||
{
|
||||
service = "homeassistant.turn_on";
|
||||
entity_id = [
|
||||
"switch.wasser"
|
||||
];
|
||||
}
|
||||
{ delay.seconds = 10; }
|
||||
{
|
||||
service = "homeassistant.turn_off";
|
||||
entity_id = [
|
||||
"switch.wasser"
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
{ alias = "Always turn off water after 15 seconds";
|
||||
trigger = [
|
||||
{
|
||||
platform = "state";
|
||||
entity_id = "switch.wasser";
|
||||
to = "on";
|
||||
for.seconds = 15;
|
||||
}
|
||||
];
|
||||
action =
|
||||
[
|
||||
{
|
||||
service = "homeassistant.turn_off";
|
||||
entity_id = [ "switch.wasser" ];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
@ -2,6 +2,7 @@ let
|
||||
power_x = name: phase:
|
||||
{ platform = "mqtt";
|
||||
name = "${phase} ${name}";
|
||||
# device_class = "power";
|
||||
state_topic = "/power/total/${phase}/${name}";
|
||||
availability_topic = "/power/lwt";
|
||||
payload_available = "Online";
|
||||
@ -10,6 +11,7 @@ let
|
||||
power_consumed =
|
||||
{ platform = "mqtt";
|
||||
name = "Power Consumed";
|
||||
#device_class = "power";
|
||||
state_topic = "/power/total/consumed";
|
||||
availability_topic = "/power/lwt";
|
||||
payload_available = "Online";
|
||||
|
Loading…
Reference in New Issue
Block a user