summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/shack/glados/sensors/power.nix
diff options
context:
space:
mode:
authorlassulus <lass@xerxes.r>2019-09-06 15:37:58 +0200
committerlassulus <lass@xerxes.r>2019-09-06 15:37:58 +0200
commited97000b20623a952e41e808756ea8c8dfb666e6 (patch)
treef039f642bc03388704a66d94fc8ace402b583945 /krebs/2configs/shack/glados/sensors/power.nix
parentc2773285ebf8165fd725065047df7a58da01fb42 (diff)
parentfce2c4275caf7df064fb13a4280291a9aefaef1f (diff)
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'krebs/2configs/shack/glados/sensors/power.nix')
-rw-r--r--krebs/2configs/shack/glados/sensors/power.nix27
1 files changed, 27 insertions, 0 deletions
diff --git a/krebs/2configs/shack/glados/sensors/power.nix b/krebs/2configs/shack/glados/sensors/power.nix
new file mode 100644
index 000000000..1aa250a19
--- /dev/null
+++ b/krebs/2configs/shack/glados/sensors/power.nix
@@ -0,0 +1,27 @@
+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";
+ payload_not_available = "Offline";
+ };
+ power_consumed =
+ { platform = "mqtt";
+ name = "Power Consumed";
+ #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_curr = power_x "Current";
+in
+ (map power_volt [ "L1" "L2" "L3" ])
+++ (map power_watt [ "L1" "L2" "L3" ])
+++ (map power_curr [ "L1" "L2" "L3" ])
+++ [ power_consumed ]