Merge pull request #5348 from freol35241/dev

Remove throttle decorator from miflora platform
pull/5135/merge
Robbie Trencheny 2017-01-24 21:39:42 -08:00 committed by GitHub
commit c355def154
1 changed files with 2 additions and 7 deletions

View File

@ -4,7 +4,6 @@ Support for Xiaomi Mi Flora BLE plant sensor.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.miflora/ https://home-assistant.io/components/sensor.miflora/
""" """
from datetime import timedelta
import logging import logging
import voluptuous as vol import voluptuous as vol
@ -12,7 +11,6 @@ import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle
from homeassistant.const import ( from homeassistant.const import (
CONF_MONITORED_CONDITIONS, CONF_NAME, CONF_MAC) CONF_MONITORED_CONDITIONS, CONF_NAME, CONF_MAC)
@ -31,9 +29,7 @@ DEFAULT_MEDIAN = 3
DEFAULT_NAME = 'Mi Flora' DEFAULT_NAME = 'Mi Flora'
DEFAULT_RETRIES = 2 DEFAULT_RETRIES = 2
DEFAULT_TIMEOUT = 10 DEFAULT_TIMEOUT = 10
DEFAULT_UPDATE_INTERVAL = 1200
UPDATE_INTERVAL = 1200
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=UPDATE_INTERVAL)
# Sensor types are defined like: Name, units # Sensor types are defined like: Name, units
SENSOR_TYPES = { SENSOR_TYPES = {
@ -53,7 +49,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_FORCE_UPDATE, default=DEFAULT_FORCE_UPDATE): cv.boolean, vol.Optional(CONF_FORCE_UPDATE, default=DEFAULT_FORCE_UPDATE): cv.boolean,
vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): cv.positive_int, vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): cv.positive_int,
vol.Optional(CONF_RETRIES, default=DEFAULT_RETRIES): cv.positive_int, vol.Optional(CONF_RETRIES, default=DEFAULT_RETRIES): cv.positive_int,
vol.Optional(CONF_CACHE, default=UPDATE_INTERVAL): cv.positive_int, vol.Optional(CONF_CACHE, default=DEFAULT_UPDATE_INTERVAL): cv.positive_int,
}) })
@ -122,7 +118,6 @@ class MiFloraSensor(Entity):
"""Force update.""" """Force update."""
return self._force_update return self._force_update
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self): def update(self):
""" """
Update current conditions. Update current conditions.