From 010e6cb4ba2ccab9a4b02a7d30a6d090ea2253b4 Mon Sep 17 00:00:00 2001 From: Kevin Stillhammer Date: Tue, 22 Feb 2022 08:17:49 +0100 Subject: [PATCH] waze_travel_time: always resolve zones (#66162) --- .../components/waze_travel_time/const.py | 3 -- .../components/waze_travel_time/sensor.py | 36 +++++-------------- 2 files changed, 9 insertions(+), 30 deletions(-) diff --git a/homeassistant/components/waze_travel_time/const.py b/homeassistant/components/waze_travel_time/const.py index 554f3ecf6d8..37278543dfb 100644 --- a/homeassistant/components/waze_travel_time/const.py +++ b/homeassistant/components/waze_travel_time/const.py @@ -25,6 +25,3 @@ UNITS = [CONF_UNIT_SYSTEM_METRIC, CONF_UNIT_SYSTEM_IMPERIAL] REGIONS = ["US", "NA", "EU", "IL", "AU"] VEHICLE_TYPES = ["car", "taxi", "motorcycle"] - -# Attempt to find entity_id without finding address with period. -ENTITY_ID_PATTERN = "(? None: """Handle when entity is added.""" @@ -177,16 +162,8 @@ class WazeTravelTime(SensorEntity): def update(self): """Fetch new state data for the sensor.""" _LOGGER.debug("Fetching Route for %s", self._attr_name) - # Get origin latitude and longitude from entity_id. - if self._origin_entity_id is not None: - self._waze_data.origin = find_coordinates(self.hass, self._origin_entity_id) - - # Get destination latitude and longitude from entity_id. - if self._destination_entity_id is not None: - self._waze_data.destination = find_coordinates( - self.hass, self._destination_entity_id - ) - + self._waze_data.origin = find_coordinates(self.hass, self._origin) + self._waze_data.destination = find_coordinates(self.hass, self._destination) self._waze_data.update() @@ -205,6 +182,11 @@ class WazeTravelTimeData: def update(self): """Update WazeRouteCalculator Sensor.""" + _LOGGER.debug( + "Getting update for origin: %s destination: %s", + self.origin, + self.destination, + ) if self.origin is not None and self.destination is not None: # Grab options on every update incl_filter = self.config_entry.options.get(CONF_INCL_FILTER)