From de6f49c06fce7c033df7f1c63ab77deb38d070a7 Mon Sep 17 00:00:00 2001 From: Open Home Automation Date: Tue, 26 Jul 2016 08:01:57 +0200 Subject: [PATCH] Add the option to add additional tags when logging to InfluxDB (#2613) --- homeassistant/components/influxdb.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/homeassistant/components/influxdb.py b/homeassistant/components/influxdb.py index 311d3fe83df..2070a52085d 100644 --- a/homeassistant/components/influxdb.py +++ b/homeassistant/components/influxdb.py @@ -33,6 +33,7 @@ CONF_PASSWORD = 'password' CONF_SSL = 'ssl' CONF_VERIFY_SSL = 'verify_ssl' CONF_BLACKLIST = 'blacklist' +CONF_TAGS = 'tags' # pylint: disable=too-many-locals @@ -56,6 +57,7 @@ def setup(hass, config): verify_ssl = util.convert(conf.get(CONF_VERIFY_SSL), bool, DEFAULT_VERIFY_SSL) blacklist = conf.get(CONF_BLACKLIST, []) + tags = conf.get(CONF_TAGS, {}) try: influx = InfluxDBClient(host=host, port=port, username=username, @@ -99,6 +101,9 @@ def setup(hass, config): } ] + for tag in tags: + json_body[0]['tags'][tag] = tags[tag] + try: influx.write_points(json_body) except exceptions.InfluxDBClientError: