mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
Add the option to add additional tags when logging to InfluxDB (#2613)
This commit is contained in:
parent
f1632496f0
commit
de6f49c06f
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user