Use vol.Coerce for notify SourceType enum (#77930)

pull/78613/head
Marc Mueller 2022-09-16 16:46:26 +02:00 committed by GitHub
parent 501b8b341f
commit 0b97dcf0bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -71,12 +71,7 @@ from .const import (
SERVICE_SEE: Final = "see"
SOURCE_TYPES: Final[tuple[str, ...]] = (
SourceType.GPS,
SourceType.ROUTER,
SourceType.BLUETOOTH,
SourceType.BLUETOOTH_LE,
)
SOURCE_TYPES = [cls.value for cls in SourceType]
NEW_DEVICE_DEFAULTS_SCHEMA = vol.Any(
None,
@ -108,7 +103,7 @@ SERVICE_SEE_PAYLOAD_SCHEMA: Final[vol.Schema] = vol.Schema(
ATTR_GPS_ACCURACY: cv.positive_int,
ATTR_BATTERY: cv.positive_int,
ATTR_ATTRIBUTES: dict,
ATTR_SOURCE_TYPE: vol.In(SOURCE_TYPES),
ATTR_SOURCE_TYPE: vol.Coerce(SourceType),
ATTR_CONSIDER_HOME: cv.time_period,
# Temp workaround for iOS app introduced in 0.65
vol.Optional("battery_status"): str,