Moved bootstrap code to a seperate bootstrap module.

This commit is contained in:
Paulus Schoutsen committed 2013-10-13 10:42:22 -07:00
1 parent 7dfbff31f5
commit 0d156ecbf0
4 files changed
+99 -41

No files matched your search

+2 -39
View File
@@ -1,43 +1,6 @@
#!/usr/bin/python2
""" Starts home assistant with all possible functionality. """
from ConfigParser import SafeConfigParser
import homeassistant.bootstrap
from homeassistant import StateMachine, EventBus, start_home_assistant
from homeassistant import observers
from homeassistant import actors
from homeassistant.httpinterface import HTTPInterface
# Read config
config = SafeConfigParser()
config.read("home-assistant.conf")
# Init core
eventbus = EventBus()
statemachine = StateMachine(eventbus)
# Init observers
tomato = observers.TomatoDeviceScanner(config.get('tomato','host'),
config.get('tomato','username'),
config.get('tomato','password'),
config.get('tomato','http_id'))
devicetracker = observers.DeviceTracker(eventbus, statemachine, tomato)
observers.track_sun(eventbus, statemachine,
config.get("common","latitude"),
config.get("common","longitude"))
# Init actors
actors.LightTrigger(eventbus, statemachine,
devicetracker, actors.HueLightControl())
actors.setup_chromecast(eventbus, config.get("chromecast", "host"))
actors.setup_file_downloader(eventbus, config.get("downloader", "download_dir"))
actors.setup_webbrowser(eventbus)
actors.setup_media_buttons(eventbus)
# Init HTTP interface
HTTPInterface(eventbus, statemachine, config.get("common","api_password"))
start_home_assistant(eventbus)
homeassistant.bootstrap.from_config_file("home-assistant.conf")