]> mj.ucw.cz Git - home-hw.git/commitdiff
Influx: Heating parameters
authorMartin Mares <mj@ucw.cz>
Fri, 28 Feb 2020 17:02:48 +0000 (18:02 +0100)
committerMartin Mares <mj@ucw.cz>
Fri, 28 Feb 2020 17:27:10 +0000 (18:27 +0100)
influx/burrow-influx.c

index 95213003b4ca213ec04c15c8a83054d9bfa6588d..6894062fc8e4ae80ab7a844a56a89f3e75357939 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     A gateway between MQTT and InfluxDB
  *
- *     (c) 2018--2019 Martin Mares <mj@ucw.cz>
+ *     (c) 2018--2020 Martin Mares <mj@ucw.cz>
  */
 
 #include <ucw/lib.h>
@@ -34,6 +34,7 @@ struct attr {
        const char *metric;
        const char *value_name;
        const char *topic;
+       uint timeout;
 };
 
 static const struct attr attr_table[] = {
@@ -183,6 +184,42 @@ static const struct attr attr_table[] = {
                .value_name = "kVArh",
                .topic = "burrow/power/reactive/energy",
        },
+       {
+               .metric = "heating_water_pressure",
+               .value_name = "p",
+               .topic = "burrow/heating/water-pressure",
+               .timeout = 300,
+       },
+       {
+               .metric = "heating_outside_temp",
+               .value_name = "t",
+               .topic = "burrow/heating/outside-temp",
+               .timeout = 300,
+       },
+       {
+               .metric = "heating_room_temp,circuit=1",
+               .value_name = "t",
+               .topic = "burrow/heating/circuit1/room-temp",
+               .timeout = 300,
+       },
+       {
+               .metric = "heating_mix-temp,circuit=1",
+               .value_name = "t",
+               .topic = "burrow/heating/circuit1/mix-temp",
+               .timeout = 300,
+       },
+       {
+               .metric = "heating_mix-valve,circuit=1",
+               .value_name = "x",
+               .topic = "burrow/heating/circuit1/mix-valve",
+               .timeout = 300,
+       },
+       {
+               .metric = "heating_room_temp,circuit=2",
+               .value_name = "t",
+               .topic = "burrow/heating/circuit2/room-temp",
+               .timeout = 300,
+       },
 };
 
 /*** MQTT ***/
@@ -386,7 +423,8 @@ int main(int argc UNUSED, char **argv)
                                continue;
                        if (fields >= 2) {
                                time_t t = atoll(w[1]);
-                               if (t < now - MEASUREMENT_TIMEOUT)
+                               uint timeout = a->timeout ? : MEASUREMENT_TIMEOUT;
+                               if (t < now - timeout)
                                        continue;
                        }