mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Waze action support entities (#139068)
This commit is contained in:
parent
bd919159e5
commit
15ca2fe489
@ -17,6 +17,7 @@ from homeassistant.core import (
|
|||||||
SupportsResponse,
|
SupportsResponse,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.httpx_client import get_async_client
|
from homeassistant.helpers.httpx_client import get_async_client
|
||||||
|
from homeassistant.helpers.location import find_coordinates
|
||||||
from homeassistant.helpers.selector import (
|
from homeassistant.helpers.selector import (
|
||||||
BooleanSelector,
|
BooleanSelector,
|
||||||
SelectSelector,
|
SelectSelector,
|
||||||
@ -115,10 +116,21 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
|||||||
client = WazeRouteCalculator(
|
client = WazeRouteCalculator(
|
||||||
region=service.data[CONF_REGION].upper(), client=httpx_client
|
region=service.data[CONF_REGION].upper(), client=httpx_client
|
||||||
)
|
)
|
||||||
|
|
||||||
|
origin_coordinates = find_coordinates(hass, service.data[CONF_ORIGIN])
|
||||||
|
destination_coordinates = find_coordinates(hass, service.data[CONF_DESTINATION])
|
||||||
|
|
||||||
|
origin = origin_coordinates if origin_coordinates else service.data[CONF_ORIGIN]
|
||||||
|
destination = (
|
||||||
|
destination_coordinates
|
||||||
|
if destination_coordinates
|
||||||
|
else service.data[CONF_DESTINATION]
|
||||||
|
)
|
||||||
|
|
||||||
response = await async_get_travel_times(
|
response = await async_get_travel_times(
|
||||||
client=client,
|
client=client,
|
||||||
origin=service.data[CONF_ORIGIN],
|
origin=origin,
|
||||||
destination=service.data[CONF_DESTINATION],
|
destination=destination,
|
||||||
vehicle_type=service.data[CONF_VEHICLE_TYPE],
|
vehicle_type=service.data[CONF_VEHICLE_TYPE],
|
||||||
avoid_toll_roads=service.data[CONF_AVOID_TOLL_ROADS],
|
avoid_toll_roads=service.data[CONF_AVOID_TOLL_ROADS],
|
||||||
avoid_subscription_roads=service.data[CONF_AVOID_SUBSCRIPTION_ROADS],
|
avoid_subscription_roads=service.data[CONF_AVOID_SUBSCRIPTION_ROADS],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user