mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Use SCAN_INTERVAL instead of Throttle for google travel time (#31420)
The documentation for google_travel_time was at odds with the implementation. The documentation stated a default scan time of 5 minutes, but the implementation was using Throttle which resulted in the sensor updating at a maximum rate of one API call every 5 minutes. This was especially at odds with a given example at the end of the documentation, which showed updating the sensor every 2 minutes during commute times. This change brings the implementation in line with the docs by adopting the `SCAN_INTERVAL` constant set to the stated default of 5 minutes and removing the Throttle.
This commit is contained in:
parent
7b5b909f0a
commit
2d3b117cb8
@ -19,7 +19,6 @@ from homeassistant.const import (
|
||||
from homeassistant.helpers import location
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -33,7 +32,7 @@ CONF_TRAVEL_MODE = "travel_mode"
|
||||
|
||||
DEFAULT_NAME = "Google Travel Time"
|
||||
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=5)
|
||||
SCAN_INTERVAL = timedelta(minutes=5)
|
||||
|
||||
ALL_LANGUAGES = [
|
||||
"ar",
|
||||
@ -256,7 +255,6 @@ class GoogleTravelTimeSensor(Entity):
|
||||
"""Return the unit this state is expressed in."""
|
||||
return self._unit_of_measurement
|
||||
|
||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||
def update(self):
|
||||
"""Get the latest data from Google."""
|
||||
options_copy = self._options.copy()
|
||||
|
Loading…
x
Reference in New Issue
Block a user