From: Martin Mares Date: Mon, 27 Jul 2020 11:02:09 +0000 (+0200) Subject: InfluxDB: New attributes for boiler status and clock X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=bad3caf595b8a19ca9591519d77bdaf1d00a5c5e;p=home-hw.git InfluxDB: New attributes for boiler status and clock --- diff --git a/influx/burrow-influx.c b/influx/burrow-influx.c index 611f8da..3105d45 100644 --- a/influx/burrow-influx.c +++ b/influx/burrow-influx.c @@ -35,6 +35,7 @@ struct attr { const char *value_name; const char *topic; uint timeout; + bool is_string; }; static const struct attr attr_table[] = { @@ -244,6 +245,19 @@ static const struct attr attr_table[] = { .topic = "burrow/heating/water/active", .timeout = 660, }, + { + .metric = "heating_error", + .value_name = "err", + .topic = "burrow/heating/error", + .timeout = 300, + }, + { + .metric = "heating_clock", + .value_name = "t", + .topic = "burrow/heating/clock", + .timeout = 660, + .is_string = true, + }, }; /*** MQTT ***/ @@ -452,7 +466,10 @@ int main(int argc UNUSED, char **argv) continue; } - bprintf(f, "%s %s=%s\n", a->metric, a->value_name, val); + if (!a->is_string) + bprintf(f, "%s %s=%s\n", a->metric, a->value_name, val); + else + bprintf(f, "%s %s=\"%s\"\n", a->metric, a->value_name, val); } influx_write_flush(); sleep(INFLUX_INTERVAL);