summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/shack/glados/lib
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2020-01-08 10:16:21 +0100
committermakefu <github@syntax-fehler.de>2020-01-08 10:16:21 +0100
commit5d2e66eb2c0cb5c4c6a5592e53d1baad21721430 (patch)
tree9c68690cb233350864b7786b8c5a442cade54df8 /krebs/2configs/shack/glados/lib
parent4ad85faacedc755fd25b7edd0df41234c98876f0 (diff)
shack/glados: enable schlechte_luft
Diffstat (limited to 'krebs/2configs/shack/glados/lib')
-rw-r--r--krebs/2configs/shack/glados/lib/default.nix73
1 files changed, 67 insertions, 6 deletions
diff --git a/krebs/2configs/shack/glados/lib/default.nix b/krebs/2configs/shack/glados/lib/default.nix
index debe8e5c2..19c657e64 100644
--- a/krebs/2configs/shack/glados/lib/default.nix
+++ b/krebs/2configs/shack/glados/lib/default.nix
@@ -1,34 +1,95 @@
let
- lib = import <nixpkgs/lib>;
prefix = "glados";
in
{
esphome =
{
- temp = name:
+ temp = {name, topic ? "temperature" }:
{
platform = "mqtt";
name = "${name} 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";
payload_available = "online";
payload_not_available = "offline";
};
- hum = name:
+ hum = {name, topic ? "humidity" }:
{
platform = "mqtt";
+ unit_of_measurement = "%";
+ icon = "mdi:water-percent";
device_class = "humidity";
name = "${name} Humidity";
- state_topic = "${prefix}/${name}/sensor/humidity/state";
+ state_topic = "${prefix}/${name}/sensor/${topic}/state";
availability_topic = "${prefix}/${name}/status";
payload_available = "online";
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 =
{
- plug = name: topic:
+ plug = {name, topic ? name }:
{
platform = "mqtt";
inherit name;