PyChromecast properly integrated now.

This commit is contained in:
Paulus Schoutsen committed 2013-10-07 20:23:05 -07:00
1 parent 9cfcf43202
commit df53b05423
6 files changed
+27 -14

No files matched your search

+13 -12
View File
@@ -1,13 +1,13 @@
#!/usr/bin/python2
""" Starts home assistant with all possible functionality. """
from ConfigParser import SafeConfigParser
from homeassistant import StateMachine, EventBus, start_home_assistant
from homeassistant import observers
from homeassistant import actors
from homeassistant.httpinterface import HTTPInterface
from lib.pychromecast import play_youtube_video
# Read config
config = SafeConfigParser()
config.read("home-assistant.conf")
@@ -17,21 +17,22 @@ 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'))
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"))
observers.track_sun(eventbus, statemachine,
config.get("common","latitude"),
config.get("common","longitude"))
# Init actors
actors.LightTrigger(eventbus, statemachine, devicetracker, actors.HueLightControl())
# If a chromecast is specified, add some chromecast specific event triggers
if config.has_option("chromecast", "host"):
eventbus.listen("start_fireplace", lambda event: play_youtube_video(config.get("chromecast","host"), "eyU3bRy2x44"))
eventbus.listen("start_epic_sax", lambda event: play_youtube_video(config.get("chromecast","host"), "kxopViU98Xo"))
actors.LightTrigger(eventbus, statemachine,
devicetracker, actors.HueLightControl())
actors.setup_chromecast(eventbus, config.get("chromecast", "host"))
actors.setup_file_downloader(eventbus, "downloads")
actors.setup_webbrowser(eventbus)