summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/shack/glados/sensors
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2021-01-18 15:24:18 +0100
committertv <tv@krebsco.de>2021-01-18 15:24:18 +0100
commitff6f5ef5e1cdbd27b2211c54643fa2754f888cbb (patch)
treeb33763a7ac8040efe988f8bed2fe1c649cc155dd /krebs/2configs/shack/glados/sensors
parent7b7ebd8708885633c926c21a4b71d5d4ce8931cf (diff)
parent2a32b7731496615e43a06ec1049f6716c49a1999 (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'krebs/2configs/shack/glados/sensors')
-rw-r--r--krebs/2configs/shack/glados/sensors/darksky.nix43
-rw-r--r--krebs/2configs/shack/glados/sensors/mate.nix20
-rw-r--r--krebs/2configs/shack/glados/sensors/power.nix5
-rw-r--r--krebs/2configs/shack/glados/sensors/sensemap.nix15
-rw-r--r--krebs/2configs/shack/glados/sensors/spaceapi.nix107
5 files changed, 103 insertions, 87 deletions
diff --git a/krebs/2configs/shack/glados/sensors/darksky.nix b/krebs/2configs/shack/glados/sensors/darksky.nix
index c8725b868..12b33804c 100644
--- a/krebs/2configs/shack/glados/sensors/darksky.nix
+++ b/krebs/2configs/shack/glados/sensors/darksky.nix
@@ -1,21 +1,24 @@
{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";
- }
-]
+{
+ services.home-assistant.config.sensor =
+ [
+ { 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/mate.nix b/krebs/2configs/shack/glados/sensors/mate.nix
index 1bb0e71eb..751856668 100644
--- a/krebs/2configs/shack/glados/sensors/mate.nix
+++ b/krebs/2configs/shack/glados/sensors/mate.nix
@@ -6,11 +6,15 @@ let
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)
-]
+in
+{
+ services.home-assistant.config.sensor =
+ [
+ (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 b168f2beb..d9b5c7c65 100644
--- a/krebs/2configs/shack/glados/sensors/power.nix
+++ b/krebs/2configs/shack/glados/sensors/power.nix
@@ -20,7 +20,10 @@ let
power_watt = (power_x "Power") ;
power_curr = power_x "Current";
in
+{
+ services.home-assistant.config.sensor =
(map power_volt [ "L1" "L2" "L3" ])
++ (map (x: ((power_watt x) // { device_class = "power"; })) [ "L1" "L2" "L3" ])
++ (map power_curr [ "L1" "L2" "L3" ])
-++ [ power_consumed ]
+++ [ power_consumed ];
+}
diff --git a/krebs/2configs/shack/glados/sensors/sensemap.nix b/krebs/2configs/shack/glados/sensors/sensemap.nix
index dff29c3c4..c261a28e1 100644
--- a/krebs/2configs/shack/glados/sensors/sensemap.nix
+++ b/krebs/2configs/shack/glados/sensors/sensemap.nix
@@ -1,6 +1,9 @@
-[
- {
- platform = "opensensemap";
- station_id = "56a0de932cb6e1e41040a68b";
- }
-]
+{
+ services.home-assistant.config.air_quality =
+ [
+ {
+ platform = "opensensemap";
+ station_id = "56a0de932cb6e1e41040a68b";
+ }
+ ];
+}
diff --git a/krebs/2configs/shack/glados/sensors/spaceapi.nix b/krebs/2configs/shack/glados/sensors/spaceapi.nix
index 11cab11c9..ea20ad29d 100644
--- a/krebs/2configs/shack/glados/sensors/spaceapi.nix
+++ b/krebs/2configs/shack/glados/sensors/spaceapi.nix
@@ -1,52 +1,55 @@
-[
- {
- 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;
- }
-]
+{
+ services.home-assistant.config.binary_sensor =
+ [
+ {
+ 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;
+ }
+ ];
+}