예제 #1
0
def check_dp():

    print "starting"

    w_url = 'http://api.wunderground.com/api/{}/geolookup/conditions/q/{}/{}.json'.format(args.apikey, args.state, args.city)

    w_raw = requests.get(w_url)
    w_cond = w_raw.json().get('current_observation','')
    w_dp = w_cond.get('dewpoint_f','')

    for structure in napi.structures:
        for device in structure.devices:

            temp = nest_utils.c_to_f(device.temperature)

            if w_dp >= args.dewpoint:
                print "temp was %s" % temp
                device.temperature = nest_utils.f_to_c(args.temp)
                print "dewpoint is at or above %s deg f, changed temp to %s" % (args.dewpoint, args.temp)

            elif w_dp < args.dewpoint:
                print "temp was %s" % temp
                device.temperature = nest_utils.f_to_c(args.temp + 1)
                print "dewpoint is below %s deg f, changed temp to %s" % (args.dewpoint, args.temp)

            else:
                print "can't determine dewpoint"
                pass

    print "finishing. checking again in %d minutes" % args.delay

    time.sleep(60 * args.delay)
예제 #2
0
 def _setlow(self, **kwargs):
     inc = False
     val = None
     try:
         try:
             val = int(kwargs.get('value'))
         except TypeError:
             inc = True
         self._checkconnect()
         for device in self.napi.devices:
             if self.address == device.serial[-14:].lower():
                 if device.mode == 'range':
                     if not inc:
                         device.temperature = (nest_utils.f_to_c(val), device.target[1])
                         self.logger.info("Mode is ranged, Setting lower bound to %i F", val)
                     else:
                         val = int(round(nest_utils.c_to_f(device.target[0]) - 1))
                         self.logger.info("Mode is ranged, decrementing lower bound to %i F", val)
                         device.temperature = (nest_utils.f_to_c(val), device.target[1])
                 else:
                     if not inc:
                         device.temperature = nest_utils.f_to_c(val)
                     else:
                         val = int(round(nest_utils.c_to_f(device.target) - 1))
                         device.temperature = nest_utils.f_to_c(val)
                     self.logger.info("Setting temperature to %i F.", val)
                 self.set_driver('CLISPH', val)
     except requests.exceptions.HTTPError as e:
         self.logger.error('NestThermostat _settemp Caught exception: %s', e)
     return True
예제 #3
0
def set_temp(napi, temp):
    """
    Set the temperature given an integer value in degrees F
    """
    for device in napi.devices:
        f_temp = temp
        device.temperature = nest_utils.f_to_c(f_temp)
        print("Setting nest temp to {} degrees".format(f_temp))
예제 #4
0
def set_temp(napi, temp):
    """
    Set the temperature given an integer value in degrees F
    """
    for device in napi.devices:
        f_temp = temp
        device.temperature = nest_utils.f_to_c(f_temp)
        print("Setting nest temp to {} degrees".format(f_temp))
예제 #5
0
 def _setlow(self, **kwargs):
     inc = False
     try:
         try:
             val = int(kwargs.get('value'))
         except TypeError:
             inc = True
         self._checkconnect()
         for device in self.napi.devices:
             if self.address == device.serial[-14:].lower():
                 if device.mode == 'range':
                     if not inc:
                         device.temperature = (nest_utils.f_to_c(val),
                                               device.target[1])
                         self.LOGGER.info(
                             "Mode is ranged, Setting lower bound to %i F",
                             val)
                     else:
                         val = int(
                             round(nest_utils.c_to_f(device.target[0]) - 1))
                         self.LOGGER.info(
                             "Mode is ranged, decrementing lower bound to %i F",
                             val)
                         device.temperature = (nest_utils.f_to_c(val),
                                               device.target[1])
                 else:
                     self.LOGGER.info("Setting temperature to %i F.", val)
                     if not inc:
                         device.temperature = nest_utils.f_to_c(val)
                     else:
                         val = int(
                             round(nest_utils.c_to_f(device.target) - 1))
                         device.temperature = nest_utils.f_to_c(val)
                 self.set_driver('CLISPH', val)
     except requests.exceptions.HTTPError as e:
         self.LOGGER.error('NestThermostat _settemp Caught exception: %s',
                           e)
     return True
예제 #6
0
  def setNest(self, settings):
    from core import ffNest
    from nest import utils as nest_utils
    from core import ffScheduler

    self.deviceIndex(ffNest)
    structure = ffNest.structures[0]
    device = ffNest.devices[self._device_index]

    setting_options = settings.keys()

    if 'away' in setting_options:
      structure.away = settings['away']

    if 'target' in setting_options:
      if self._f:
        device.target = nest_utils.f_to_c(settings['target'])
      else:
        device.target = settings['target']

    ffScheduler.runInS(10, self.update, job_id='nest-update-in-10')
예제 #7
0
파일: ffNest.py 프로젝트: zpriddy/Firefly
  def setNest(self, settings):
    from core import ffNestModule
    from nest import utils as nest_utils
    from core import ffScheduler

    self.deviceIndex(ffNestModule)
    structure = ffNestModule.structures[0]
    device = ffNestModule.devices[self._device_index]

    setting_options = settings.keys()

    if 'away' in setting_options:
      structure.away = settings['away']

    if 'target' in setting_options:
      if self._f:
        device.target = nest_utils.f_to_c(settings['target'])
      else:
        device.target = settings['target']

    ffScheduler.runInS(10, self.update, job_id='nest-update-in-10')
예제 #8
0
import nest
import json
import glob
import urllib2
from time import gmtime, strftime
from nest import utils as nest_utils
import argparse

parser = argparse.ArgumentParser(description='Set temp')
parser.add_argument('device_room_target_temp', type=float)
args = parser.parse_args()
device_room_target_temp = nest_utils.f_to_c(args.device_room_target_temp)

#device_room_target_temp = 73
#device_room_target_temp = nest_utils.f_to_c(device_room_target_temp)

min_diff_to_alter_temp = 1 / 1.8

# Read Nest sensors
print 'Reading Nest sensors'
username = '******'
password = '******'
napi = nest.Nest(username, password)
structure = napi.structures[0]
nest = structure.devices[0]

# Read device room temp
print 'Reading PEP sensors'
str_data=urllib2.urlopen("http://10.0.1.11/temp").read()
device_temp = float(str_data.split(",")[0])
예제 #9
0
 def f_to_c(self, temp):
     return nest_utils.f_to_c(temp)
예제 #10
0
def set_temp(device, target_temp):
    device.target = nest_utils.f_to_c(target_temp)
예제 #11
0
 def on_direct_message(self, status):
     new_temp = status.direct_message['text']
     print("Nest is changing the temp to {temp}".format(temp=new_temp))
     self._napi.devices[0].temperature = nest_utils.f_to_c(new_temp)
예제 #12
0
파일: remote_temp.py 프로젝트: jvsd/nest
def set_temp(nest_api,temp):
    nest_api.devices[0].temperature = n_utils.f_to_c(temp)
def com_nest_f_to_c(temp_data):
    """
    F to C temp conversion
    """
    return nest_utils.f_to_c(temp_data)