shack/glados: init hass config
This commit is contained in:
parent
479ce8c4c5
commit
4ad85faace
|
@ -2,6 +2,7 @@
|
|||
let
|
||||
shackopen = import ./multi/shackopen.nix;
|
||||
wasser = import ./multi/wasser.nix;
|
||||
badair = import ./multi/schlechte_luft.nix;
|
||||
in {
|
||||
services.nginx.virtualHosts."hass.shack" = {
|
||||
serverAliases = [ "glados.shack" ];
|
||||
|
|
46
krebs/2configs/shack/glados/lib/default.nix
Normal file
46
krebs/2configs/shack/glados/lib/default.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
let
|
||||
lib = import <nixpkgs/lib>;
|
||||
prefix = "glados";
|
||||
in
|
||||
{
|
||||
esphome =
|
||||
{
|
||||
temp = name:
|
||||
{
|
||||
platform = "mqtt";
|
||||
name = "${name} Temperature";
|
||||
device_class = "temperature";
|
||||
state_topic = "${prefix}/${name}/sensor/temperature/state";
|
||||
availability_topic = "${prefix}/${name}/status";
|
||||
payload_available = "online";
|
||||
payload_not_available = "offline";
|
||||
};
|
||||
hum = name:
|
||||
{
|
||||
platform = "mqtt";
|
||||
device_class = "humidity";
|
||||
name = "${name} Humidity";
|
||||
state_topic = "${prefix}/${name}/sensor/humidity/state";
|
||||
availability_topic = "${prefix}/${name}/status";
|
||||
payload_available = "online";
|
||||
payload_not_available = "offline";
|
||||
};
|
||||
};
|
||||
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;
|
||||
};
|
||||
};
|
||||
}
|
19
krebs/2configs/shack/glados/multi/schlechte_luft.nix
Normal file
19
krebs/2configs/shack/glados/multi/schlechte_luft.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
let
|
||||
airlevel = name: threshold: color:
|
||||
{ alias = "${name} Air trigger ${color}";
|
||||
trigger = [
|
||||
];
|
||||
action =
|
||||
[
|
||||
# create spark effect with color
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
# LED
|
||||
switch = [
|
||||
];
|
||||
automation =
|
||||
[
|
||||
];
|
||||
}
|
|
@ -1,23 +1,12 @@
|
|||
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;
|
||||
};
|
||||
glados = import ../lib;
|
||||
seconds = 20;
|
||||
in
|
||||
{
|
||||
switch = [
|
||||
(tasmota_plug "Wasser" "plug")
|
||||
(glados.tasmota.plug "Wasser" "plug")
|
||||
];
|
||||
|
||||
automation =
|
||||
[
|
||||
{ alias = "Water the plant for ${toString seconds} seconds";
|
||||
|
|
|
@ -1,22 +1,5 @@
|
|||
let
|
||||
esphome_temp = name:
|
||||
{ platform = "mqtt";
|
||||
name = "${name} Temperature";
|
||||
device_class = "temperature";
|
||||
state_topic = "glados/${name}/sensor/temperature/state";
|
||||
availability_topic = "glados/${name}/status";
|
||||
payload_available = "online";
|
||||
payload_not_available = "offline";
|
||||
};
|
||||
esphome_hum = name:
|
||||
{ platform = "mqtt";
|
||||
device_class = "humidity";
|
||||
name = "${name} Humidity";
|
||||
state_topic = "glados/${name}/sensor/humidity/state";
|
||||
availability_topic = "glados/${name}/status";
|
||||
payload_available = "online";
|
||||
payload_not_available = "offline";
|
||||
};
|
||||
glados = import ../lib;
|
||||
in
|
||||
(map esphome_temp [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])
|
||||
++ (map esphome_hum [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])
|
||||
(map glados.esphome.temp [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])
|
||||
++ (map glados.esphome.hum [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])
|
||||
|
|
Loading…
Reference in a new issue