diff options
author | makefu <github@syntax-fehler.de> | 2019-09-02 13:57:06 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2019-09-02 13:57:06 +0200 |
commit | e4c836b9c4901f99fe870dae8c338dbe648494ac (patch) | |
tree | 926dbeffadcf1aab6dc69cfb84c5efa4d79ff941 /krebs/2configs/shack/glados/sensors | |
parent | 86592a723309d45dc09ff90872c0ee4aa7e52dc0 (diff) |
shack/glados: init home-assistant config
Diffstat (limited to 'krebs/2configs/shack/glados/sensors')
-rw-r--r-- | krebs/2configs/shack/glados/sensors/hass.nix | 22 | ||||
-rw-r--r-- | krebs/2configs/shack/glados/sensors/power.nix | 25 |
2 files changed, 47 insertions, 0 deletions
diff --git a/krebs/2configs/shack/glados/sensors/hass.nix b/krebs/2configs/shack/glados/sensors/hass.nix new file mode 100644 index 000000000..634758701 --- /dev/null +++ b/krebs/2configs/shack/glados/sensors/hass.nix @@ -0,0 +1,22 @@ +let + esphome_temp = name: + { platform = "mqtt"; + name = "${name} Temperature"; + device_class = "temperature"; + state_topic = "glados/${name}/sensor/temperature/state"; + availability_topic = "glados/${name}/status"; + payload_available = "online"; + payload_not_available = "offline"; + }; + esphome_hum = name: + { platform = "mqtt"; + device_class = "humidity"; + name = "${name} Humidity"; + state_topic = "glados/${name}/sensor/humidity/state"; + availability_topic = "glados/${name}/status"; + payload_available = "online"; + payload_not_available = "offline"; + }; +in + (map esphome_temp [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ]) + ++ (map esphome_hum [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ]) 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 ] |