From 183936375f6b1cf03ccff4481ca9bb05563254bc Mon Sep 17 00:00:00 2001 From: Simon Szustkowski Date: Sun, 2 Oct 2016 07:29:06 +0200 Subject: [PATCH] Add a Timeout for InfluxDB connections (#3563) * Add a Timeout for InfluxDB connections * Removed trailing whitespace --- homeassistant/components/influxdb.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/influxdb.py b/homeassistant/components/influxdb.py index 1ce137ffc91..6bac1fa7cfb 100644 --- a/homeassistant/components/influxdb.py +++ b/homeassistant/components/influxdb.py @@ -28,6 +28,7 @@ DEFAULT_PORT = 8086 DEFAULT_SSL = False DEFAULT_VERIFY_SSL = False DOMAIN = 'influxdb' +TIMEOUT = 5 CONFIG_SCHEMA = vol.Schema({ DOMAIN: vol.Schema({ @@ -69,7 +70,8 @@ def setup(hass, config): try: influx = InfluxDBClient( host=host, port=port, username=username, password=password, - database=database, ssl=ssl, verify_ssl=verify_ssl) + database=database, ssl=ssl, verify_ssl=verify_ssl, + timeout=TIMEOUT) influx.query("select * from /.*/ LIMIT 1;") except exceptions.InfluxDBClientError as exc: _LOGGER.error("Database host is not accessible due to '%s', please "