Ejemplo n.º 1
0
 def notify(self):
     import datetime
     from restlets import restlets
     from datetime import timedelta
     sensor_processor = restlets.SensorRestlet({'time': [30, datetime.datetime.now() + timedelta(seconds=30), 'time_var',] })
     sensor_processor.process_sensor_input(0, True)        
     reactor.callLater(5, self.notify)
def check_ac():
    import datetime
    from restlets import restlets
    from datetime import timedelta
    sensor_processor = restlets.SensorRestlet({
                                              'time': [30, datetime.datetime.now() + timedelta(seconds=400), 'time',] ,
                                              'time2': [15, datetime.datetime.now() + timedelta(seconds=400), 'time2',]})
    sensor_processor.process_sensor_input(0, True)        
    reactor.callLater(2, check_ac)
Ejemplo n.º 3
0
 def processLaterResponse(self, response):
     import json 
     import datetime
     f = open('actuator_sensor_end_2.txt', 'a+')
     f.write(str(datetime.datetime.now()) + "\n")
     f.close()
     from datetime import timedelta
     json_obj = json.loads(response.payload)
     light_state = json_obj['state']
     off_time = json_obj['time_off']
     from restlets import restlets
     sensor_processor = restlets.SensorRestlet({'time': [30, datetime.datetime.now() + timedelta(seconds=300), 'time_var',] })
     sensor_processor.process_sensor_input(2)