Removed redundant Throttle decorator (#1862)
parent
7d4b11f4ec
commit
fbfdf5a286
|
@ -5,23 +5,18 @@ For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/sensor.rest/
|
https://home-assistant.io/components/sensor.rest/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from homeassistant.const import CONF_VALUE_TEMPLATE, STATE_UNKNOWN
|
from homeassistant.const import CONF_VALUE_TEMPLATE, STATE_UNKNOWN
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers import template
|
from homeassistant.helpers import template
|
||||||
from homeassistant.util import Throttle
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
DEFAULT_NAME = 'REST Sensor'
|
DEFAULT_NAME = 'REST Sensor'
|
||||||
DEFAULT_METHOD = 'GET'
|
DEFAULT_METHOD = 'GET'
|
||||||
|
|
||||||
# Return cached results if last scan was less then this time ago
|
|
||||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
|
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-variable
|
# pylint: disable=unused-variable
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
@ -96,7 +91,6 @@ class RestData(object):
|
||||||
self._verify_ssl = verify_ssl
|
self._verify_ssl = verify_ssl
|
||||||
self.data = None
|
self.data = None
|
||||||
|
|
||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Get the latest data from REST service with GET method."""
|
"""Get the latest data from REST service with GET method."""
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue