Improve error messages

This commit is contained in:
Otto Winter 2018-06-06 10:27:59 +02:00
parent b5f6b32fad
commit 1267680379
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
2 changed files with 5 additions and 5 deletions

View File

@ -175,7 +175,7 @@ def validate_config(config):
dependencies = getattr(component, 'DEPENDENCIES', []) dependencies = getattr(component, 'DEPENDENCIES', [])
for dependency in dependencies: for dependency in dependencies:
if dependency not in _ALL_COMPONENTS: if dependency not in _ALL_COMPONENTS:
result.add_error(u"Component {} requires {}".format(domain, dependency)) result.add_error(u"Component {} requires component {}".format(domain, dependency))
success = False success = False
if not success: if not success:
continue continue
@ -209,8 +209,8 @@ def validate_config(config):
dependencies = getattr(platform, 'DEPENDENCIES', []) dependencies = getattr(platform, 'DEPENDENCIES', [])
for dependency in dependencies: for dependency in dependencies:
if dependency not in _ALL_COMPONENTS: if dependency not in _ALL_COMPONENTS:
result.add_error(u"Platform {}.{} requires {}".format(domain, p_name, result.add_error(u"Platform {}.{} requires component {}".format(domain, p_name,
dependency)) dependency))
success = False success = False
if not success: if not success:
continue continue

View File

@ -205,12 +205,12 @@ def shorthand_input_pin(value):
PCF8574_OUTPUT_PIN_SCHEMA = vol.Schema({ PCF8574_OUTPUT_PIN_SCHEMA = vol.Schema({
vol.Required(CONF_PCF8574): cv.use_variable_id(pcf8574.PCF8574Component), vol.Required(CONF_PCF8574): cv.use_variable_id(pcf8574.PCF8574Component),
vol.Required(CONF_NUMBER): vol.Coerce(int), vol.Required(CONF_NUMBER): vol.Coerce(int),
vol.Optional(CONF_MODE): vol.All(vol.Upper, "OUTPUT"), vol.Optional(CONF_MODE): vol.All(vol.Upper, cv.one_of("OUTPUT")),
vol.Optional(CONF_INVERTED, default=False): cv.boolean, vol.Optional(CONF_INVERTED, default=False): cv.boolean,
}) })
PCF8574_INPUT_PIN_SCHEMA = PCF8574_OUTPUT_PIN_SCHEMA.extend({ PCF8574_INPUT_PIN_SCHEMA = PCF8574_OUTPUT_PIN_SCHEMA.extend({
vol.Optional(CONF_MODE): vol.All(vol.Upper, vol.Any("INPUT", "INPUT_PULLUP")), vol.Optional(CONF_MODE): vol.All(vol.Upper, cv.one_of("INPUT", "INPUT_PULLUP")),
}) })