Пример #1
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)
Пример #2
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')
Пример #3
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')
Пример #4
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')
Пример #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')