* Add config flow for Waze Travel Time * update translations * setup entry is async * fix update logic during setup * support old config method in the interim * fix requirements * fix requirements * add abort string * changes based on @bdraco review * fix tests * add device identifier * Update homeassistant/components/waze_travel_time/__init__.py Co-authored-by: J. Nick Koston <nick@koston.org> * fix tests * Update homeassistant/components/waze_travel_time/sensor.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * log warning for deprecation message * PR feedback * fix tests and bugs * re-add name to config schema to avoid breaking change * handle if we get name from config in entry title * fix name logic * always set up options with defaults * Update homeassistant/components/waze_travel_time/sensor.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Update config_flow.py * Update sensor.py * handle options updates by getting options on every update * patch library instead of sensor * fixes and make sure first update writes the state * validate config entry data during config flow and entry setup * fix input parameters * fix tests * invert if statement * remove unnecessary else * exclude helpers from coverage * remove async_setup because it's no longer needed * fix patch statements Co-authored-by: J. Nick Koston <nick@koston.org> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
"""Constants for waze_travel_time."""
|
|
from homeassistant.const import CONF_UNIT_SYSTEM_IMPERIAL, CONF_UNIT_SYSTEM_METRIC
|
|
|
|
DOMAIN = "waze_travel_time"
|
|
|
|
ATTR_DESTINATION = "destination"
|
|
ATTR_DURATION = "duration"
|
|
ATTR_DISTANCE = "distance"
|
|
ATTR_ORIGIN = "origin"
|
|
ATTR_ROUTE = "route"
|
|
|
|
ATTRIBUTION = "Powered by Waze"
|
|
|
|
CONF_DESTINATION = "destination"
|
|
CONF_ORIGIN = "origin"
|
|
CONF_INCL_FILTER = "incl_filter"
|
|
CONF_EXCL_FILTER = "excl_filter"
|
|
CONF_REALTIME = "realtime"
|
|
CONF_UNITS = "units"
|
|
CONF_VEHICLE_TYPE = "vehicle_type"
|
|
CONF_AVOID_TOLL_ROADS = "avoid_toll_roads"
|
|
CONF_AVOID_SUBSCRIPTION_ROADS = "avoid_subscription_roads"
|
|
CONF_AVOID_FERRIES = "avoid_ferries"
|
|
|
|
DEFAULT_NAME = "Waze Travel Time"
|
|
DEFAULT_REALTIME = True
|
|
DEFAULT_VEHICLE_TYPE = "car"
|
|
DEFAULT_AVOID_TOLL_ROADS = False
|
|
DEFAULT_AVOID_SUBSCRIPTION_ROADS = False
|
|
DEFAULT_AVOID_FERRIES = False
|
|
|
|
ICON = "mdi:car"
|
|
|
|
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 = "(?<![a-zA-Z0-9 ])[a-z_]+[.][a-zA-Z0-9_]+"
|