diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 99278a6a426..c246b822dc3 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -110,17 +110,20 @@ def from_config_file(config_path, hass=None): # Set config dir to directory holding config file hass.config_dir = os.path.abspath(os.path.dirname(config_path)) - # Read config - config = configparser.ConfigParser() - config.read(config_path) + # check config file type + if(os.path.splitext(config_path)[1] == '.yaml'): + # Read yaml + config_dict = yaml.load(io.open(config_path, 'r')) + else: + # Read config + config = configparser.ConfigParser() + config.read(config_path) - config_dict = {} + for section in config.sections(): + config_dict[section] = {} - for section in config.sections(): - config_dict[section] = {} - - for key, val in config.items(section): - config_dict[section][key] = val + for key, val in config.items(section): + config_dict[section][key] = val return from_config_dict(config_dict, hass) diff --git a/requirements.txt b/requirements.txt index 4bf9fc83d6a..f4cd404beaf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -29,3 +29,6 @@ pushbullet.py>=0.7.1 # thermostat.nest python-nest>=2.1 + +# pyyaml +pyyaml