Upgrade influxdb to 5.0.0 (#12156)

* Upgrade influxdb to 5.0.0

* UPdate sensor as well
This commit is contained in:
Fabian Affolter 2018-02-04 18:23:26 +01:00 committed by GitHub
parent 8fe339d2a8
commit 64cbfdfd77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 26 deletions

View file

@ -21,7 +21,7 @@ import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_values import EntityValues
from homeassistant.util import utcnow
REQUIREMENTS = ['influxdb==4.1.1']
REQUIREMENTS = ['influxdb==5.0.0']
_LOGGER = logging.getLogger(__name__)
@ -39,6 +39,7 @@ CONF_RETRY_QUEUE = 'retry_queue_limit'
DEFAULT_DATABASE = 'home_assistant'
DEFAULT_VERIFY_SSL = True
DOMAIN = 'influxdb'
TIMEOUT = 5
COMPONENT_CONFIG_SCHEMA_ENTRY = vol.Schema({
@ -137,7 +138,7 @@ def setup(hass, config):
_LOGGER.error("Database host is not accessible due to '%s', please "
"check your entries in the configuration file (host, "
"port, etc.) and verify that the database exists and is "
"READ/WRITE.", exc)
"READ/WRITE", exc)
return False
def influx_event_listener(event):
@ -145,8 +146,7 @@ def setup(hass, config):
state = event.data.get('new_state')
if state is None or state.state in (
STATE_UNKNOWN, '', STATE_UNAVAILABLE) or \
state.entity_id in blacklist_e or \
state.domain in blacklist_d:
state.entity_id in blacklist_e or state.domain in blacklist_d:
return
try:
@ -301,10 +301,8 @@ class RetryOnError(object):
target = utcnow() + self.retry_delay
tracking = {'target': target}
remove = track_point_in_utc_time(self.hass,
partial(scheduled,
retry + 1,
tracking),
remove = track_point_in_utc_time(
self.hass, partial(scheduled, retry + 1, tracking),
target)
tracking['remove'] = remove
tracking["exc"] = ex

View file

@ -4,25 +4,25 @@ InfluxDB component which allows you to get data from an Influx database.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/sensor.influxdb/
"""
import logging
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (CONF_HOST, CONF_PORT, CONF_USERNAME,
CONF_PASSWORD, CONF_SSL, CONF_VERIFY_SSL,
CONF_NAME, CONF_UNIT_OF_MEASUREMENT,
CONF_VALUE_TEMPLATE)
from homeassistant.const import STATE_UNKNOWN
from homeassistant.util import Throttle
from homeassistant.components.influxdb import CONF_DB_NAME
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_HOST, CONF_NAME, CONF_PASSWORD, CONF_PORT, CONF_SSL,
CONF_UNIT_OF_MEASUREMENT, CONF_USERNAME, CONF_VALUE_TEMPLATE,
CONF_VERIFY_SSL, STATE_UNKNOWN)
from homeassistant.exceptions import TemplateError
from homeassistant.helpers.entity import Entity
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__)
REQUIREMENTS = ['influxdb==4.1.1']
REQUIREMENTS = ['influxdb==5.0.0']
DEFAULT_HOST = 'localhost'
DEFAULT_PORT = 8086
@ -32,13 +32,13 @@ DEFAULT_VERIFY_SSL = False
DEFAULT_GROUP_FUNCTION = 'mean'
DEFAULT_FIELD = 'value'
CONF_DB_NAME = 'database'
CONF_QUERIES = 'queries'
CONF_GROUP_FUNCTION = 'group_function'
CONF_FIELD = 'field'
CONF_MEASUREMENT_NAME = 'measurement'
CONF_WHERE = 'where'
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
_QUERY_SCHEME = vol.Schema({
vol.Required(CONF_NAME): cv.string,
@ -62,9 +62,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_VERIFY_SSL, default=DEFAULT_VERIFY_SSL): cv.boolean
})
# Return cached results if last scan was less then this time ago
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the InfluxDB component."""
@ -122,7 +119,7 @@ class InfluxSensor(Entity):
except exceptions.InfluxDBClientError as exc:
_LOGGER.error("Database host is not accessible due to '%s', please"
" check your entries in the configuration file and"
" that the database exists and is READ/WRITE.", exc)
" that the database exists and is READ/WRITE", exc)
self.connected = False
@property

View file

@ -406,7 +406,7 @@ ihcsdk==2.1.1
# homeassistant.components.influxdb
# homeassistant.components.sensor.influxdb
influxdb==4.1.1
influxdb==5.0.0
# homeassistant.components.insteon_local
insteonlocal==0.53

View file

@ -79,7 +79,7 @@ home-assistant-frontend==20180130.0
# homeassistant.components.influxdb
# homeassistant.components.sensor.influxdb
influxdb==4.1.1
influxdb==5.0.0
# homeassistant.components.dyson
libpurecoollink==0.4.2