From e4c836b9c4901f99fe870dae8c338dbe648494ac Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 2 Sep 2019 13:57:06 +0200 Subject: shack/glados: init home-assistant config --- krebs/2configs/shack/glados/sensors/power.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 krebs/2configs/shack/glados/sensors/power.nix (limited to 'krebs/2configs/shack/glados/sensors/power.nix') diff --git a/krebs/2configs/shack/glados/sensors/power.nix b/krebs/2configs/shack/glados/sensors/power.nix new file mode 100644 index 000000000..940888c7d --- /dev/null +++ b/krebs/2configs/shack/glados/sensors/power.nix @@ -0,0 +1,25 @@ +let + power_x = name: phase: + { platform = "mqtt"; + name = "${phase} ${name}"; + state_topic = "/power/total/${phase}/${name}"; + availability_topic = "/power/lwt"; + payload_available = "Online"; + payload_not_available = "Offline"; + }; + power_consumed = + { platform = "mqtt"; + name = "Power Consumed"; + 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 ] -- cgit v1.2.3