Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust distance unit check in waze travel time #80241

Merged
merged 4 commits into from Oct 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion homeassistant/components/waze_travel_time/sensor.py
Expand Up @@ -17,6 +17,7 @@
CONF_NAME,
CONF_REGION,
CONF_UNIT_SYSTEM_IMPERIAL,
CONF_UNIT_SYSTEM_METRIC,
EVENT_HOMEASSISTANT_STARTED,
LENGTH_KILOMETERS,
LENGTH_MILES,
Expand All @@ -28,6 +29,7 @@
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.location import find_coordinates
from homeassistant.util.unit_conversion import DistanceConverter
from homeassistant.util.unit_system import IMPERIAL_SYSTEM

from .const import (
CONF_AVOID_FERRIES,
Expand Down Expand Up @@ -63,11 +65,13 @@ async def async_setup_entry(
defaults = {
CONF_REALTIME: DEFAULT_REALTIME,
CONF_VEHICLE_TYPE: DEFAULT_VEHICLE_TYPE,
CONF_UNITS: hass.config.units.name,
CONF_UNITS: CONF_UNIT_SYSTEM_METRIC,
CONF_AVOID_FERRIES: DEFAULT_AVOID_FERRIES,
CONF_AVOID_SUBSCRIPTION_ROADS: DEFAULT_AVOID_SUBSCRIPTION_ROADS,
CONF_AVOID_TOLL_ROADS: DEFAULT_AVOID_TOLL_ROADS,
}
if hass.config.units is IMPERIAL_SYSTEM:
defaults[CONF_UNITS] = CONF_UNIT_SYSTEM_IMPERIAL

if not config_entry.options:
new_data = config_entry.data.copy()
Expand Down