Fix formatting invalid config text (#10319)

This commit is contained in:
Paulus Schoutsen 2017-11-03 10:12:45 -07:00
parent 986bcfef21
commit af0253b2eb

View file

@ -677,9 +677,18 @@ def async_notify_setup_error(hass, component, link=False):
errors = hass.data[DATA_PERSISTENT_ERRORS] = {}
errors[component] = errors.get(component) or link
_lst = [HA_COMPONENT_URL.format(name.replace('_', '-'), name)
if link else name for name, link in errors.items()]
message = ('The following components and platforms could not be set up:\n'
'* ' + '\n* '.join(list(_lst)) + '\nPlease check your config')
message = 'The following components and platforms could not be set up:\n\n'
for name, link in errors.items():
if link:
part = HA_COMPONENT_URL.format(name.replace('_', '-'), name)
else:
part = name
message += ' - {}\n'.format(part)
message += '\nPlease check your config.'
persistent_notification.async_create(
hass, message, 'Invalid config', 'invalid_config')