From 2d3b117cb87e53d46cebf27aee96bb497dd087b6 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 4 Mar 2020 17:39:28 -0800 Subject: [PATCH] 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. --- homeassistant/components/google_travel_time/sensor.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/homeassistant/components/google_travel_time/sensor.py b/homeassistant/components/google_travel_time/sensor.py index 213f773fb60..dd7d9bf8585 100644 --- a/homeassistant/components/google_travel_time/sensor.py +++ b/homeassistant/components/google_travel_time/sensor.py @@ -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()