def __init__(self): self.http = httplib2.Http() self.config = ConfigurationServer.get('AutoOn') if self.config == None: self.config = { 'lat': 0, 'long': 0, 'city': 'Enter a city here...', 'offset': 0, 'autoOnGroup': 'All Lights', 'groupBri': 255, } else: if not 'autoOnGroup' in self.config.keys(): self.config['autoOnGroup'] = 'All Lights' if not 'groupBri' in self.config.keys(): self.config['groupBri'] = 255 minute = random.randint(0,59) start_date = datetime.datetime.combine(datetime.datetime.today(), datetime.time(hour=12, minute=minute, second=0)) #added randomness to not break earthtools :) if start_date < datetime.datetime.now(): # get the sunset for today, the get_sunset function will take care of the rest self.get_sunset() start_date += datetime.timedelta(days=1) Scheduler.add_interval_job(self.get_sunset, days=1, start_date=start_date)
def __init__(self, bridgeIP): self.bridgeIP = bridgeIP self.http = httplib2.Http() self.base_url = "http://{}".format(bridgeIP) self.api_key = ConfigurationServer.get('HueConnection')