def startup(self, bridge_ip): from Plugins import Plugins from HueBridge import HueBridge HueBridge.init(bridge_ip) HueBridge.update() self.plugins = Plugins #expose it for cherrypy # Automatically update every minute Scheduler.add_interval_job(HueBridge.update, minutes=1)
def index(self): # for debug purposes: #HueBridge.update() template = mako.template.Template(filename='plugins/HueControl/HueControl.tmpl') try: # Check the authentication with the bridge HueBridge.authenticate() HueBridge.update() except ConnectionException as e: return Template.render_template("", error="Bridge is not authenticated! Press the link button and <a href=\"\"> try again</a>!") rendered_template = template.render(lights=HueBridge.lights, groups=HueBridge.groups) return Template.render_template(rendered_template)
def index(self): # for debug purposes: #HueBridge.update() template = mako.template.Template( filename='plugins/HueControl/HueControl.tmpl') try: # Check the authentication with the bridge HueBridge.authenticate() HueBridge.update() except ConnectionException as e: return Template.render_template( "", error= "Bridge is not authenticated! Press the link button and <a href=\"\"> try again</a>!" ) rendered_template = template.render(lights=HueBridge.lights, groups=HueBridge.groups) return Template.render_template(rendered_template)