예제 #1
0
파일: ffEcobee.py 프로젝트: zpriddy/Firefly
 def register_ecobee_get_pin(self, args={}):
   url='https://api.ecobee.com/authorize?response_type=ecobeePin&client_id=' + str(self._api_key) + '&scope=smartWrite'
   response = requests.get(url).json()
   self._pin = response.get('ecobeePin')
   self._auth_code = response.get('code')
   ffNotify('all', 'Ecobee Auth Pin: ' + str(self._pin) + '. To finish installing ecobee, goto ecobee.com, login, from the menu on the right. Click Apps, Add App and enter Pin. After this is done you may preceed to the next step.')
   return str(self._pin)
예제 #2
0
파일: location.py 프로젝트: zpriddy/Firefly
 def sunset_handler(self):
   ffNotify('ZachPushover', 'LOCATION: It is sunset!')
   ffEvent('location',{'time':'sunset'})
   now = self.now()
   sunset_time = self._city.sun(date=datetime.now(self._city.tz) + timedelta(days=1), local=True)['sunset']
   logging.debug("Sunset Time: " + str(sunset_time))
   delay_s = (sunset_time - now).total_seconds()
   l_scheduler.runInS(delay_s, self.sunset_handler, replace=True, uuid='SunsetScheduler')
예제 #3
0
파일: location.py 프로젝트: zpriddy/Firefly
 def dusk_handler(self):
   ffNotify('ZachPushover', 'LOCATION: It is dusk!')
   ffEvent('location',{'time':'dusk'})
   now = self.now()
   dusk_time = self._city.sun(date=datetime.now(self._city.tz) + timedelta(days=1), local=True)['dusk']
   logging.debug("Dusk Time: " + str(dusk_time))
   delay_s = (dusk_time - now).total_seconds()
   l_scheduler.runInS(delay_s, self.dusk_handler, replace=True, uuid='DuskScheduler')
예제 #4
0
파일: location.py 프로젝트: zpriddy/Firefly
 def noon_handler(self):
   ffNotify('ZachPushover', 'LOCATION: It is noon!')
   ffEvent('location',{'time':'noon'})
   now = self.now()
   noon_time = self._city.sun(date=datetime.now(self._city.tz) + timedelta(days=1), local=True)['noon']
   logging.debug("Noon Time: " + str(noon_time))
   delay_s = (noon_time - now).total_seconds()
   l_scheduler.runInS(delay_s, self.noon_handler, replace=True, uuid='NoonScheduler')
예제 #5
0
 def register_ecobee_get_pin(self, args={}):
     url = 'https://api.ecobee.com/authorize?response_type=ecobeePin&client_id=' + str(
         self._api_key) + '&scope=smartWrite'
     response = requests.get(url).json()
     self._pin = response.get('ecobeePin')
     self._auth_code = response.get('code')
     ffNotify(
         'all', 'Ecobee Auth Pin: ' + str(self._pin) +
         '. To finish installing ecobee, goto ecobee.com, login, from the menu on the right. Click Apps, Add App and enter Pin. After this is done you may preceed to the next step.'
     )
     return str(self._pin)
예제 #6
0
 def dusk_handler(self):
     ffNotify('ZachPushover', 'LOCATION: It is dusk!')
     ffEvent('location', {'time': 'dusk'})
     now = self.now()
     dusk_time = self._city.sun(date=datetime.now(self._city.tz) +
                                timedelta(days=1),
                                local=True)['dusk']
     logging.debug("Dusk Time: " + str(dusk_time))
     delay_s = (dusk_time - now).total_seconds()
     l_scheduler.runInS(delay_s,
                        self.dusk_handler,
                        replace=True,
                        uuid='DuskScheduler')
예제 #7
0
 def sunset_handler(self):
     ffNotify('ZachPushover', 'LOCATION: It is sunset!')
     ffEvent('location', {'time': 'sunset'})
     now = self.now()
     sunset_time = self._city.sun(date=datetime.now(self._city.tz) +
                                  timedelta(days=1),
                                  local=True)['sunset']
     logging.debug("Sunset Time: " + str(sunset_time))
     delay_s = (sunset_time - now).total_seconds()
     l_scheduler.runInS(delay_s,
                        self.sunset_handler,
                        replace=True,
                        uuid='SunsetScheduler')
예제 #8
0
 def noon_handler(self):
     ffNotify('ZachPushover', 'LOCATION: It is noon!')
     ffEvent('location', {'time': 'noon'})
     now = self.now()
     noon_time = self._city.sun(date=datetime.now(self._city.tz) +
                                timedelta(days=1),
                                local=True)['noon']
     logging.debug("Noon Time: " + str(noon_time))
     delay_s = (noon_time - now).total_seconds()
     l_scheduler.runInS(delay_s,
                        self.noon_handler,
                        replace=True,
                        uuid='NoonScheduler')