Use schema validators already avaialble
This commit is contained in:
parent
6f57d36134
commit
ddec28da4b
1 changed files with 3 additions and 3 deletions
|
@ -11,7 +11,7 @@ import requests
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.config_validation import ensure_list
|
from homeassistant.helpers.config_validation import (ensure_list, string)
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
from homeassistant.const import (CONF_PLATFORM, CONF_MONITORED_CONDITIONS,
|
from homeassistant.const import (CONF_PLATFORM, CONF_MONITORED_CONDITIONS,
|
||||||
CONF_API_KEY, TEMP_FAHRENHEIT, TEMP_CELSIUS,
|
CONF_API_KEY, TEMP_FAHRENHEIT, TEMP_CELSIUS,
|
||||||
|
@ -57,8 +57,8 @@ SENSOR_TYPES = {
|
||||||
|
|
||||||
PLATFORM_SCHEMA = vol.Schema({
|
PLATFORM_SCHEMA = vol.Schema({
|
||||||
vol.Required(CONF_PLATFORM): "wunderground",
|
vol.Required(CONF_PLATFORM): "wunderground",
|
||||||
vol.Required(CONF_API_KEY): vol.Coerce(str),
|
vol.Required(CONF_API_KEY): string,
|
||||||
CONF_PWS_ID: vol.Coerce(str),
|
vol.Optional(CONF_PWS_ID): string,
|
||||||
vol.Required(CONF_MONITORED_CONDITIONS,
|
vol.Required(CONF_MONITORED_CONDITIONS,
|
||||||
default=[]): vol.All(ensure_list, [vol.In(SENSOR_TYPES)]),
|
default=[]): vol.All(ensure_list, [vol.In(SENSOR_TYPES)]),
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue