mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Limit waze_travel_time to 1 call every 0.5s (#100191)
This commit is contained in:
parent
1f1411b6a5
commit
958b923783
@ -1,6 +1,7 @@
|
||||
"""Support for Waze travel time sensor."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any
|
||||
@ -48,6 +49,10 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
SCAN_INTERVAL = timedelta(minutes=5)
|
||||
|
||||
PARALLEL_UPDATES = 1
|
||||
|
||||
MS_BETWEEN_API_CALLS = 0.5
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
@ -144,6 +149,7 @@ class WazeTravelTime(SensorEntity):
|
||||
self._waze_data.origin = find_coordinates(self.hass, self._origin)
|
||||
self._waze_data.destination = find_coordinates(self.hass, self._destination)
|
||||
await self._waze_data.async_update()
|
||||
await asyncio.sleep(MS_BETWEEN_API_CALLS)
|
||||
|
||||
|
||||
class WazeTravelTimeData:
|
||||
|
Loading…
x
Reference in New Issue
Block a user