summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/shack/glados/sensors/hass.nix
blob: 6347587013d72b79a97604bac92371aadf7d4590 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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" ])