shack/glados: enable schlechte_luft
This commit is contained in:
parent
4ad85faace
commit
5d2e66eb2c
@ -90,7 +90,7 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
switch = wasser.switch;
|
switch = wasser.switch;
|
||||||
light = [];
|
light = badair.light;
|
||||||
media_player = [
|
media_player = [
|
||||||
{ platform = "mpd";
|
{ platform = "mpd";
|
||||||
host = "lounge.mpd.shack";
|
host = "lounge.mpd.shack";
|
||||||
@ -100,7 +100,8 @@ in {
|
|||||||
sensor =
|
sensor =
|
||||||
(import ./sensors/hass.nix)
|
(import ./sensors/hass.nix)
|
||||||
++ (import ./sensors/power.nix)
|
++ (import ./sensors/power.nix)
|
||||||
++ shackopen.sensor;
|
++ shackopen.sensor
|
||||||
|
++ badair.sensor;
|
||||||
|
|
||||||
binary_sensor = shackopen.binary_sensor;
|
binary_sensor = shackopen.binary_sensor;
|
||||||
|
|
||||||
@ -127,7 +128,7 @@ in {
|
|||||||
#recorder = {};
|
#recorder = {};
|
||||||
sun = {};
|
sun = {};
|
||||||
|
|
||||||
automation = wasser.automation;
|
automation = wasser.automation ++ badair.automation;
|
||||||
device_tracker = [];
|
device_tracker = [];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,34 +1,95 @@
|
|||||||
let
|
let
|
||||||
lib = import <nixpkgs/lib>;
|
|
||||||
prefix = "glados";
|
prefix = "glados";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
esphome =
|
esphome =
|
||||||
{
|
{
|
||||||
temp = name:
|
temp = {name, topic ? "temperature" }:
|
||||||
{
|
{
|
||||||
platform = "mqtt";
|
platform = "mqtt";
|
||||||
name = "${name} Temperature";
|
name = "${name} Temperature";
|
||||||
device_class = "temperature";
|
device_class = "temperature";
|
||||||
state_topic = "${prefix}/${name}/sensor/temperature/state";
|
unit_of_measurement = "°C";
|
||||||
|
icon = "mdi:thermometer";
|
||||||
|
state_topic = "${prefix}/${name}/sensor/${topic}/state";
|
||||||
availability_topic = "${prefix}/${name}/status";
|
availability_topic = "${prefix}/${name}/status";
|
||||||
payload_available = "online";
|
payload_available = "online";
|
||||||
payload_not_available = "offline";
|
payload_not_available = "offline";
|
||||||
};
|
};
|
||||||
hum = name:
|
hum = {name, topic ? "humidity" }:
|
||||||
{
|
{
|
||||||
platform = "mqtt";
|
platform = "mqtt";
|
||||||
|
unit_of_measurement = "%";
|
||||||
|
icon = "mdi:water-percent";
|
||||||
device_class = "humidity";
|
device_class = "humidity";
|
||||||
name = "${name} Humidity";
|
name = "${name} Humidity";
|
||||||
state_topic = "${prefix}/${name}/sensor/humidity/state";
|
state_topic = "${prefix}/${name}/sensor/${topic}/state";
|
||||||
availability_topic = "${prefix}/${name}/status";
|
availability_topic = "${prefix}/${name}/status";
|
||||||
payload_available = "online";
|
payload_available = "online";
|
||||||
payload_not_available = "offline";
|
payload_not_available = "offline";
|
||||||
};
|
};
|
||||||
|
# copied from "homeassistant/light/fablab_led/led_ring/config"
|
||||||
|
led = {name, topic ? "led", host ? name }:
|
||||||
|
{ # name: fablab_led
|
||||||
|
# topic: led_ring
|
||||||
|
platform = "mqtt";
|
||||||
|
inherit name;
|
||||||
|
schema = "json";
|
||||||
|
brightness = true;
|
||||||
|
rgb = true;
|
||||||
|
effect = true;
|
||||||
|
effect_list = [ # TODO: may be different
|
||||||
|
"Random"
|
||||||
|
"Strobe"
|
||||||
|
"Rainbow"
|
||||||
|
"Color Wipe"
|
||||||
|
"Scan"
|
||||||
|
"Twinkle"
|
||||||
|
"Fireworks"
|
||||||
|
"Addressable Flicker"
|
||||||
|
"None"
|
||||||
|
];
|
||||||
|
state_topic = "${prefix}/${host}/light/${topic}/state";
|
||||||
|
command_topic = "${prefix}/${host}/light/${topic}/command";
|
||||||
|
availability_topic = "${prefix}/${host}/status";
|
||||||
|
payload_available = "online";
|
||||||
|
payload_not_available = "offline";
|
||||||
|
qos = 1;
|
||||||
|
};
|
||||||
|
# Feinstaub
|
||||||
|
dust_25m = { host, name ? "${host} < 2.5µm", topic ? "particulate_matter_25m_concentration" }:
|
||||||
|
{
|
||||||
|
platform = "mqtt";
|
||||||
|
unit_of_measurement = "µg/m³";
|
||||||
|
icon = "mdi:chemical-weapon";
|
||||||
|
inherit name;
|
||||||
|
state_topic = "${prefix}/${host}/sensor/${topic}/state";
|
||||||
|
availability_topic = "${prefix}/${name}/status";
|
||||||
|
};
|
||||||
|
dust_100m = {host, name ? "${host} < 10µm", topic ? "particulate_matter_100m_concentration" }:
|
||||||
|
{
|
||||||
|
platform = "mqtt";
|
||||||
|
unit_of_measurement = "µg/m³";
|
||||||
|
icon = "mdi:chemical-weapon";
|
||||||
|
inherit name;
|
||||||
|
state_topic = "${prefix}/${name}/sensor/${topic}/state";
|
||||||
|
availability_topic = "${prefix}/${name}/status";
|
||||||
|
};
|
||||||
|
switch = {host, name ? "${host} Button", topic ? "btn" }:
|
||||||
|
# host: ampel
|
||||||
|
# name: Button 1
|
||||||
|
# topic: btn1
|
||||||
|
{
|
||||||
|
inherit name;
|
||||||
|
platform = "mqtt";
|
||||||
|
state_topic = "${prefix}/${host}/sensor/${topic}/state";
|
||||||
|
command_topic = "${prefix}/${host}/switch/${topic}/state";
|
||||||
|
availability_topic = "${prefix}/${host}/status";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
tasmota =
|
tasmota =
|
||||||
{
|
{
|
||||||
plug = name: topic:
|
plug = {name, topic ? name }:
|
||||||
{
|
{
|
||||||
platform = "mqtt";
|
platform = "mqtt";
|
||||||
inherit name;
|
inherit name;
|
||||||
|
@ -1,19 +1,84 @@
|
|||||||
let
|
let
|
||||||
airlevel = name: threshold: color:
|
glados = import ../lib;
|
||||||
{ alias = "${name} Air trigger ${color}";
|
|
||||||
trigger = [
|
|
||||||
];
|
|
||||||
action =
|
|
||||||
[
|
|
||||||
# create spark effect with color
|
|
||||||
];
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# LED
|
# LED
|
||||||
switch = [
|
light = [
|
||||||
|
(glados.esphome.led { name = "Fablab LED"; host = "fablab_led"; topic = "led_ring"; })
|
||||||
|
|
||||||
|
(glados.esphome.led { name = "Fablab LED Part A"; host = "fablab_led"; topic = "A";})
|
||||||
|
(glados.esphome.led { name = "Fablab LED Part B"; host = "fablab_led"; topic = "B";})
|
||||||
|
(glados.esphome.led { name = "Fablab LED Part C"; host = "fablab_led"; topic = "C";})
|
||||||
|
(glados.esphome.led { name = "Fablab LED Part D"; host = "fablab_led"; topic = "D";})
|
||||||
|
];
|
||||||
|
sensor = [
|
||||||
|
(glados.esphome.dust_25m { host = "fablab_feinstaub";})
|
||||||
|
(glados.esphome.dust_100m { host = "fablab_feinstaub";})
|
||||||
];
|
];
|
||||||
automation =
|
automation =
|
||||||
[
|
[
|
||||||
|
{ alias = "Gute Luft Fablab";
|
||||||
|
trigger = [
|
||||||
|
{
|
||||||
|
platform = "numeric_state";
|
||||||
|
below = 25;
|
||||||
|
entity_id = "sensor.fablab_feinstaub_25m";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
action =
|
||||||
|
[
|
||||||
|
{ service = "light.turn_on";
|
||||||
|
data = {
|
||||||
|
entity = "fablab_led";
|
||||||
|
effect = "Twinkle";
|
||||||
|
color_name = "green";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{ alias = "mäßige Luft Fablab";
|
||||||
|
trigger = [
|
||||||
|
#{
|
||||||
|
# platform = "numeric_state";
|
||||||
|
# above = 25;
|
||||||
|
# entity_id = "sensor.fablab_feinstaub_25m";
|
||||||
|
#}
|
||||||
|
{
|
||||||
|
platform = "numeric_state";
|
||||||
|
above = 25;
|
||||||
|
below = 50;
|
||||||
|
entity_id = "sensor.fablab_feinstaub_25m";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
action =
|
||||||
|
[
|
||||||
|
{ service = "light.turn_on";
|
||||||
|
data = {
|
||||||
|
entity = "fablab_led";
|
||||||
|
effect = "Twinkle";
|
||||||
|
color_name = "yellow";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{ alias = "schlechte Luft Fablab";
|
||||||
|
trigger = [
|
||||||
|
{
|
||||||
|
platform = "numeric_state";
|
||||||
|
above = 50;
|
||||||
|
entity_id = "sensor.fablab_feinstaub_25m";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
action =
|
||||||
|
[
|
||||||
|
{ service = "light.turn_on";
|
||||||
|
data = {
|
||||||
|
entity = "fablab_led";
|
||||||
|
effect = "Twinkle";
|
||||||
|
color_name = "red";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
switch = [
|
switch = [
|
||||||
(glados.tasmota.plug "Wasser" "plug")
|
(glados.tasmota.plug { name = "Wasser"; topic = "plug";} )
|
||||||
];
|
];
|
||||||
|
|
||||||
automation =
|
automation =
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
let
|
let
|
||||||
glados = import ../lib;
|
glados = import ../lib;
|
||||||
in
|
in
|
||||||
(map glados.esphome.temp [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])
|
(map (name: glados.esphome.temp {inherit name;}) [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])
|
||||||
++ (map glados.esphome.hum [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])
|
++ (map (name: glados.esphome.hum {inherit name;}) [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])
|
||||||
|
Loading…
Reference in New Issue
Block a user