2014-09-24 22:36:52 -05:00
|
|
|
""" Starts home assistant. """
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import os
|
2013-10-07 20:23:05 -07:00
|
|
|
|
2014-04-24 00:40:45 -07:00
|
|
|
import homeassistant
|
2013-10-13 10:42:22 -07:00
|
|
|
import homeassistant.bootstrap
|
2013-09-17 00:32:51 -07:00
|
|
|
|
2014-09-24 22:36:52 -05:00
|
|
|
# Within Docker we load the config from a different path
|
|
|
|
if '--docker' in sys.argv:
|
|
|
|
config_path = '/config/home-assistant.conf'
|
|
|
|
else:
|
|
|
|
config_path = 'config/home-assistant.conf'
|
|
|
|
|
|
|
|
# Ensure a config file exists to make first time usage easier
|
|
|
|
if not os.path.isfile(config_path):
|
|
|
|
with open(config_path, 'w') as conf:
|
|
|
|
conf.write("[http]\n")
|
2014-11-02 09:41:41 -08:00
|
|
|
conf.write("api_password=password\n\n")
|
|
|
|
conf.write("[demo]\n")
|
2014-09-24 22:36:52 -05:00
|
|
|
|
|
|
|
hass = homeassistant.bootstrap.from_config_file(config_path)
|
2014-04-29 00:30:31 -07:00
|
|
|
hass.start()
|
|
|
|
hass.block_till_stopped()
|