summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/shack/glados/sensors
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2020-04-17 19:21:16 +0200
committertv <tv@krebsco.de>2020-04-17 19:21:16 +0200
commite1bfdd8d839929538d36e421908a96407b3aa0ab (patch)
tree557bf9a711f06997e846a5ef14a4105248f1da8c /krebs/2configs/shack/glados/sensors
parent6ace0f7b6941c1c9476d84944cdba8bedf98d95d (diff)
parent07f18d851a974ee594c92e3332f167ef3b1d259f (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'krebs/2configs/shack/glados/sensors')
-rw-r--r--krebs/2configs/shack/glados/sensors/darksky.nix21
-rw-r--r--krebs/2configs/shack/glados/sensors/hass.nix5
-rw-r--r--krebs/2configs/shack/glados/sensors/mate.nix16
-rw-r--r--krebs/2configs/shack/glados/sensors/power.nix7
-rw-r--r--krebs/2configs/shack/glados/sensors/sensemap.nix6
-rw-r--r--krebs/2configs/shack/glados/sensors/spaceapi.nix52
-rw-r--r--krebs/2configs/shack/glados/sensors/unifi.nix6
7 files changed, 104 insertions, 9 deletions
diff --git a/krebs/2configs/shack/glados/sensors/darksky.nix b/krebs/2configs/shack/glados/sensors/darksky.nix
new file mode 100644
index 000000000..c8725b868
--- /dev/null
+++ b/krebs/2configs/shack/glados/sensors/darksky.nix
@@ -0,0 +1,21 @@
+{lib,...}:
+[
+ { platform = "darksky";
+ api_key = lib.removeSuffix "\n"
+ (builtins.readFile <secrets/hass/darksky.apikey>);
+ language = "de";
+ monitored_conditions = [
+ "summary" "icon"
+ "nearest_storm_distance" "precip_probability"
+ "precip_intensity"
+ "temperature" # "temperature_high" "temperature_low"
+ "apparent_temperature"
+ "hourly_summary" # next 24 hours text
+ "humidity"
+ "pressure"
+ "uv_index"
+ ];
+ units = "si" ;
+ scan_interval = "00:15:00";
+ }
+]
diff --git a/krebs/2configs/shack/glados/sensors/hass.nix b/krebs/2configs/shack/glados/sensors/hass.nix
deleted file mode 100644
index 8de0ef391..000000000
--- a/krebs/2configs/shack/glados/sensors/hass.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-let
- glados = import ../lib;
-in
- (map (host: glados.esphome.temp {inherit host;}) [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])
- ++ (map (host: glados.esphome.hum {inherit host;}) [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])
diff --git a/krebs/2configs/shack/glados/sensors/mate.nix b/krebs/2configs/shack/glados/sensors/mate.nix
new file mode 100644
index 000000000..1bb0e71eb
--- /dev/null
+++ b/krebs/2configs/shack/glados/sensors/mate.nix
@@ -0,0 +1,16 @@
+let
+ fuellstand = name: id: {
+ platform = "rest";
+ resource = "https://ora5.tutschonwieder.net/ords/lick_prod/v1/get/fuellstand/1/${toString id}";
+ method = "GET";
+ name = "Füllstand ${name}";
+ value_template = "{{ value_json.fuellstand }}";
+ };
+in [
+ (fuellstand "Wasser" 1)
+ (fuellstand "Mate Cola" 2)
+ (fuellstand "Apfelschorle" 3)
+ (fuellstand "Zitronensprudel" 4)
+ (fuellstand "Mate 1" 26)
+ (fuellstand "Mate 2" 27)
+]
diff --git a/krebs/2configs/shack/glados/sensors/power.nix b/krebs/2configs/shack/glados/sensors/power.nix
index 1aa250a19..b168f2beb 100644
--- a/krebs/2configs/shack/glados/sensors/power.nix
+++ b/krebs/2configs/shack/glados/sensors/power.nix
@@ -2,7 +2,6 @@ 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";
@@ -11,17 +10,17 @@ let
power_consumed =
{ platform = "mqtt";
name = "Power Consumed";
- #device_class = "power";
+ device_class = "power";
state_topic = "/power/total/consumed";
availability_topic = "/power/lwt";
payload_available = "Online";
payload_not_available = "Offline";
};
power_volt = power_x "Voltage";
- power_watt = power_x "Power";
+ power_watt = (power_x "Power") ;
power_curr = power_x "Current";
in
(map power_volt [ "L1" "L2" "L3" ])
-++ (map power_watt [ "L1" "L2" "L3" ])
+++ (map (x: ((power_watt x) // { device_class = "power"; })) [ "L1" "L2" "L3" ])
++ (map power_curr [ "L1" "L2" "L3" ])
++ [ power_consumed ]
diff --git a/krebs/2configs/shack/glados/sensors/sensemap.nix b/krebs/2configs/shack/glados/sensors/sensemap.nix
new file mode 100644
index 000000000..dff29c3c4
--- /dev/null
+++ b/krebs/2configs/shack/glados/sensors/sensemap.nix
@@ -0,0 +1,6 @@
+[
+ {
+ platform = "opensensemap";
+ station_id = "56a0de932cb6e1e41040a68b";
+ }
+]
diff --git a/krebs/2configs/shack/glados/sensors/spaceapi.nix b/krebs/2configs/shack/glados/sensors/spaceapi.nix
new file mode 100644
index 000000000..11cab11c9
--- /dev/null
+++ b/krebs/2configs/shack/glados/sensors/spaceapi.nix
@@ -0,0 +1,52 @@
+[
+ {
+ platform = "rest";
+ resource = "https://spaceapi.afra-berlin.de/v1/status.json";
+ method = "GET";
+ name = "Door AFRA Berlin";
+ device_class = "door";
+ value_template = "{{ value_json.open }}";
+ }
+ {
+ platform = "rest";
+ resource = "http://club.entropia.de/spaceapi";
+ method = "GET";
+ name = "Door Entropia";
+ device_class = "door";
+ value_template = "{{ value_json.open }}";
+ }
+ {
+ platform = "rest";
+ resource = "http://www.c-base.org/status.json";
+ method = "GET";
+ name = "Door C-Base Berlin";
+ device_class = "door";
+ value_template = "{{ value_json.open }}";
+ }
+ {
+ platform = "rest";
+ resource = "https://status.raumzeitlabor.de/api/full.json";
+ method = "GET";
+ name = "Door RZL";
+ device_class = "door";
+ value_template = "{{ value_json.status }}";
+ }
+ {
+ platform = "rest";
+ resource = "https://datenobservatorium.de/";
+ method = "GET";
+ name = "Door Datenobservatorium";
+ device_class = "door";
+ value_template = "false";
+ scan_interval = 2592000;
+ }
+ {
+ platform = "rest";
+ resource = "https://infuanfu.de/";
+ method = "GET";
+ name = "Door Infuanfu";
+ device_class = "door";
+ value_template = "false";
+ scan_interval = 2592000;
+ }
+]
diff --git a/krebs/2configs/shack/glados/sensors/unifi.nix b/krebs/2configs/shack/glados/sensors/unifi.nix
new file mode 100644
index 000000000..f64e3feb6
--- /dev/null
+++ b/krebs/2configs/shack/glados/sensors/unifi.nix
@@ -0,0 +1,6 @@
+{
+ controllers = {
+ host = "unifi.shack";
+ site = "shackspace";
+ };
+}