mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Added support for YAML configuration files
This commit is contained in:
parent
4ef17270b5
commit
356732189c
@ -110,12 +110,15 @@ 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))
|
||||
|
||||
# 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] = {}
|
||||
|
||||
|
@ -29,3 +29,6 @@ pushbullet.py>=0.7.1
|
||||
|
||||
# thermostat.nest
|
||||
python-nest>=2.1
|
||||
|
||||
# pyyaml
|
||||
pyyaml
|
||||
|
Loading…
x
Reference in New Issue
Block a user