From bad3caf595b8a19ca9591519d77bdaf1d00a5c5e Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 27 Jul 2020 13:02:09 +0200 Subject: [PATCH] InfluxDB: New attributes for boiler status and clock --- influx/burrow-influx.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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); -- 2.39.2