def __init__(self, id, params): super(PushDevice,self).__init__("PushDevice", id, params) if not hasattr(self,'port'): self.port=8100 self.apikey = self.params.get('apikey',None) self.mode = self.params.get('mode',"cherrypy") self.drop_unknown_sensors = self.params.get('drop_unknown_sensors',True) if type(self.drop_unknown_sensors)==str: if self.drop_unknown_sensors.upper()=="TRUE": self.drop_unknown_sensors=True elif self.drop_unknown_sensors.upper()=="FALSE": self.drop_unknown_sensors=False if type(self.drop_unknown_sensors)!=bool: logging.error("parameter drop_unknown_sensors for device "+self.type+":"+self.id+" is invalid.") exit(1) self.sensors = self.params.get('sensors',{}) if (type(self.sensors)!=list): self.sensors=[self.sensors] self.sensor_info={} for i,v in enumerate(self.sensors): if type(v)!=dict or (not 'datastream' in v) or (not 'unit' in v) or (not 'device' in v): logging.error("malformed sensor specification %s for device %s:%s"%(v,self.type,self.id)) exit(1) if not v['device'] in self.sensor_info: self.sensor_info[v['device']]={} if not v['datastream'] in self.sensor_info[v['device']]: self.sensor_info[v['device']][v['datastream']]=(v.get('device_name',v['device']),v.get('datastream_name',v['datastream']),v['unit']) #print(self.sensor_info) debug_mesg("Created PushDevice with id: "+id+" on port "+str(self.port))
def __init__(self, id, params): modbus_addr = 1 modbus_func = 3 # some more Eaton specific information self.reg_addr = 999 self.sensors = [ ("Voltage[AN]", "V"), ("Voltage[BN]", "V"), ("Voltage[CN]", "V"), ("Voltage[AB]", "V"), ("Voltage[BC]", "V"), ("Voltage[CA]", "V"), ("Current[A]", "A"), ("Current[B]", "A"), ("Current[C]", "A"), ("RealPower[Total]", "W"), ("ReactivePower[Total]", "VA"), ("ApparentPower[Total]"), ("PowerFactor[Total]", "%"), ("Frequency", "Hz"), ("Current[Neutral]", "A"), ("RealPower[A]", "W"), ("RealPower[B]", "W"), ("RealPower[C]","W"), ("ReactivePower[A]", "VA"), ("ReactivePower[B]", "VA"), ("ReactivePower[C]", "VA"), ("ApparentPower[A]", "VA"), ("ApparentPower[B]", "VA"), ("ApparentPower[C]", "VA"), ("PowerFactor[A]", '%'), ("PowerFactor[B]", "%"), ("PowerFactor[C]", "%") ] super(EatonIQ260,self).__init__("EatonIQ260", id, modbus_addr, modbus_func, params) self.i = 0 if not hasattr(self,'port'): self.port=4660 if not hasattr(self,'host'): logging.error("no host name or IP address specified for device %s:%s"%(self.type,self.id)) exit(1) if not hasattr(self, 'timeout'): self.timeout = 2 self.circuit_names_map = self.params.get('circuit_names_map',{}) for (i,s) in enumerate(self.sensors): self.sensors[i] = (self.circuit_names_map.get(s[0],s[0]),s[1]) debug_mesg("Created EatonIQ260 Device with id: "+id)
def add_stream(self, path, uuid, unit): # adds the initial information about a stream url = "http://128.97.93.240:8079/add/mHRzALUD7OtL9TFi0MbJDm6mKWdA2DJp5wJT" data = {} path = str(path) data[path] = {} data[path]["Readings"] = [] data[path]["uuid"] = str(uuid) properties = {} properties["Timezone"] = "America/Los_Angeles" properties["UnitofMeasure"] = unit properties["ReadingType"] = "double" metadata = {} metadata["SourceName"] = "Manis House" metadata["Instrument"] = { "Model": "Mac Mini", "Manufacturer": "Apple"} metadata["Location"] = {"Building": "Manis House", "City": "Los Angeles", "State": "CA"} data[path]["Properties"] = properties data[path]["Metadata"] = metadata debug_mesg("adding new device: " + str(data)) headers = {"Content-type": "application/json", "Accept": "text/plain"} r = requests.post(url, data=json.dumps(data), headers=headers) if r.status_code != 200: logging.error("Error adding stream:" + str(r.status_code) + r.text) exit(1)
def __init__(self, id, params): super(Vera,self).__init__("Vera", id, params) if not hasattr(self,'port'): self.port=3480 if not hasattr(self,'host'): logging.error("no host name or IP address specified for device %s:%s"%(self.type,self.id)) exit(1) if not hasattr(self, 'timeout'): self.timeout = 2 self.sensors = self.params.get('sensors',{}) if (type(self.sensors)!=list): self.sensors=[self.sensors] self.sensor_to_index_map={} for i,v in enumerate(self.sensors): if type(v)!=dict or (not 'id' in v) or (not 'unit' in v): logging.error("malformed sensor specification %s for device %s:%s"%(self.sensors,self.type,self.id)) exit(1) try: v['id'] = int(v['id']) except: logging.error("non-integer id in sensor specification %s for device %s:%s"%(self.sensors,self.type,self.id)) exit(1) k = (v.get('type',"devices"), v['id']) if not k in self.sensor_to_index_map: self.sensor_to_index_map[k]={v.get('field',"tripped"):(i+1)} else: self.sensor_to_index_map[k][v.get('field',"tripped")]=(i+1) debug_mesg("Created Vera Device with id: "+id)
def __init__(self, type, id, address, objectName, objectIdentifier, maxApduLengthAccepted, segmentationSupported, vendorIdentifier): super(BacnetIPDevice,self).__init__(type, id, params) self.address = address self.objectName = objectName self.objectIdentifier = objectIdentifier self.maxApduLengthAccepted = maxApduLengthAccepted self.segmentationSupported = segmentationSupported self.vendorIdentifier = vendorIdentifier debug_mesg("Created BacnetIPDevice with id: "+id)
def process_sample_dict(self, channel_id_partial, sample): debug_mesg("This sMAP sample is a dict") debug_mesg(sample) logging.error(channel_id_partial) logging.error(sample) for data_stream in sample['datastreams']: for data_value in data_stream['datapoints']: time_stamp = int( calendar.timegm(iso8601.parse_date(data_value['at']).utctimetuple()) ) * 1000 new_datapoint = [time_stamp, data_value['value']] self.buffer_try_submit(channel_id_partial, new_datapoint)
def __init__(self, id, params): # Input: id and params refer to the the "id" and "params" fields # of the sMAP service under the jsonp config file # This super refers to superclassing, but I'm honestly not sure what it does super(sMAP,self).__init__("sMAP", id, params) # self.channel_data holds the sMAP path names and uuids corresponding to sensor # channels devices as they are added. some devices have more sensors than others self.channel_data = {} debug_mesg("Created sMAP Output Service with id: " + id)
def __init__(self, id, params): super(TED5000,self).__init__("TED5000", id, params) self.i=0 self.sensors = self.params.get('sensors',[]) if not hasattr(self,'port'): self.port=80 if not hasattr(self,'host'): logging.error("no host name or IP address specified for device %s:%s"%(self.type,self.id)) exit(1) if not hasattr(self, 'timeout'): self.timeout = 2 debug_mesg("Created TED5000 Device with id: "+id)
def add_sample(self, prepared_data): # this function takes in a sMAP path (path), a time (time_stamp), and a value (sample_value), and then sends it using REST POST url = "http://128.97.93.240:8079/add/mHRzALUD7OtL9TFi0MbJDm6mKWdA2DJp5wJT" js_data = json.dumps(self.build_json(prepared_data)) headers = {"Content-type": "application/json", "Accept": "text/plain"} r = requests.post(url, data = js_data, headers=headers) if r.status_code != 200: debug_mesg(str(js_data)) debug_mesg("Error adding sample:" + str(r.status_code) + r.text) logging.error(str(js_data)) logging.error("Error adding sample:" + str(r.status_code) + r.text) exit(1)
def __init__(self, id, params): super(Shenitech,self).__init__("Shenitech", id, params) self.decription = "Shenitech_STUF200H" if not hasattr(self,'port'): self.port=80 if not hasattr(self,'host'): logging.error("no host name or IP address specified for device %s:%s"%(self.type,self.id)) exit(1) if not hasattr(self, 'timeout'): self.timeout = 2 debug_mesg("Created Shenitech Device with id: "+id) self.i=0
def __init__(self, type, id, mbaddr, mbfunc, params): super(TCPModbusDevice, self).__init__(type, id, params) self.modbus_addr = mbaddr self.modbus_func = mbfunc if not hasattr(self, "port"): self.port = 4660 if not hasattr(self, "host"): logging.error("no host name or IP address specified for device %s:%s" % (self.type, self.id)) exit(1) if not hasattr(self, "timeout"): self.timeout = 2 debug_mesg("Created ModbusDevice with id: " + id)
def __init__(self, id, params): super(Shenitech, self).__init__("Shenitech", id, params) self.decription = "Shenitech_STUF200H" if not hasattr(self, 'port'): self.port = 80 if not hasattr(self, 'host'): logging.error( "no host name or IP address specified for device %s:%s" % (self.type, self.id)) exit(1) if not hasattr(self, 'timeout'): self.timeout = 2 debug_mesg("Created Shenitech Device with id: " + id) self.i = 0
def __init__(self, type, id, mbaddr, mbfunc, params): super(TCPModbusDevice, self).__init__(type, id, params) self.modbus_addr = mbaddr self.modbus_func = mbfunc if not hasattr(self, 'port'): self.port = 4660 if not hasattr(self, 'host'): logging.error( "no host name or IP address specified for device %s:%s" % (self.type, self.id)) exit(1) if not hasattr(self, 'timeout'): self.timeout = 2 debug_mesg("Created ModbusDevice with id: " + id)
def __init__(self, id, params): super(TED5000, self).__init__("TED5000", id, params) self.i = 0 self.sensors = self.params.get('sensors', []) if not hasattr(self, 'port'): self.port = 80 if not hasattr(self, 'host'): logging.error( "no host name or IP address specified for device %s:%s" % (self.type, self.id)) exit(1) if not hasattr(self, 'timeout'): self.timeout = 2 debug_mesg("Created TED5000 Device with id: " + id)
def __init__(self, id, params): super(File,self).__init__("File", id, params) self.folder = params.get('folder',"sam_out") self.prefix = params.get('prefix',"%s"%(self.id)) if not 'flush_interval' in params: self.flush_interval = 5 else: try: self.flush_interval = int(params['flush_interval']) except: logging.error("malformed flush_interval for service %s:%s"%(self.type,self.id)) exit(1) self.open_file_name=None self.open_file_handle=None debug_mesg("Created File Output Service with id: "+id)
def __init__(self, id, params): super(File, self).__init__("File", id, params) self.folder = params.get('folder', "sam_out") self.prefix = params.get('prefix', "%s" % (self.id)) if not 'flush_interval' in params: self.flush_interval = 5 else: try: self.flush_interval = int(params['flush_interval']) except: logging.error("malformed flush_interval for service %s:%s" % (self.type, self.id)) exit(1) self.open_file_name = None self.open_file_handle = None debug_mesg("Created File Output Service with id: " + id)
def __init__(self, id, params): super(PushDevice, self).__init__("PushDevice", id, params) if not hasattr(self, 'port'): self.port = 8100 self.apikey = self.params.get('apikey', None) self.mode = self.params.get('mode', "cherrypy") self.drop_unknown_sensors = self.params.get('drop_unknown_sensors', True) if type(self.drop_unknown_sensors) == str: if self.drop_unknown_sensors.upper() == "TRUE": self.drop_unknown_sensors = True elif self.drop_unknown_sensors.upper() == "FALSE": self.drop_unknown_sensors = False if type(self.drop_unknown_sensors) != bool: logging.error("parameter drop_unknown_sensors for device " + self.type + ":" + self.id + " is invalid.") exit(1) self.sensors = self.params.get('sensors', {}) if (type(self.sensors) != list): self.sensors = [self.sensors] self.sensor_info = {} for i, v in enumerate(self.sensors): if type(v) != dict or (not 'datastream' in v) or ( not 'unit' in v) or (not 'device' in v): logging.error( "malformed sensor specification %s for device %s:%s" % (v, self.type, self.id)) exit(1) if not v['device'] in self.sensor_info: self.sensor_info[v['device']] = {} if not v['datastream'] in self.sensor_info[v['device']]: self.sensor_info[v['device']][v['datastream']] = (v.get( 'device_name', v['device']), v.get('datastream_name', v['datastream']), v['unit']) #print(self.sensor_info) debug_mesg("Created PushDevice with id: " + id + " on port " + str(self.port))
def process_sample(self, sample, params, device_id, queue_id): # Input: # sample contains the actual value # params contains the contents of the "params" fields of the device within the jsonp config file # device_id contains 3 entries, # queue_id contains... not sure device_name = device_id[1] channel_id_partial = "/ManisHouse/" + device_name + "/" debug_mesg("Received sample from device with ID: ") debug_mesg(channel_id_partial) #sample can be a tuple or a list or a dict if type(sample)==tuple or type(sample)==list: channel_listing = device_id[2] #debug_mesg("This device has %s datastreams" % len(channel_listing) ) self.process_sample_list(channel_id_partial, sample, channel_listing) #if we have a dict, slightly different elif type(sample)==dict: self.process_sample_dict(channel_id_partial, sample)
def __init__(self, id, params): super(Raritan,self).__init__("Raritan", id, params) self.i = 0 if 'username' in params: self.username = params['username'] else: self.username = "" if 'password' in params: self.password = params['password'] else: self.password = "" if not hasattr(self,'port'): self.port=161 if not hasattr(self,'host'): logging.error("no host name or IP address specified for device %s:%s"%(self.type,self.id)) exit(1) self.sensors = self.params.get('sensors',[]) if (type(self.sensors)!=list): self.sensors=[self.sensors] self.outlet_names_map = self.params.get('outlet_names_map',{}) debug_mesg("Created Raritan Device with id: "+id)
def __init__(self, id, params): super(eGaugeHTTP,self).__init__("eGaugeHTTP", id, params) self.i=0 if not hasattr(self,'port'): self.port=80 if not hasattr(self,'host'): logging.error("no host name or IP address specified for device %s:%s"%(self.type,self.id)) exit(1) if not hasattr(self, 'timeout'): self.timeout = 2 self.sensors = self.params.get('sensors',[]) if (type(self.sensors)!=list): self.sensors=[self.sensors] self.sensor_to_index_map={} for i,v in enumerate(self.sensors): if type(v)!=dict or (not 'id' in v) or (not 'unit' in v): logging.error("malformed sensor specification %s for device %s:%s"%(self.sensors,self.type,self.id)) exit(1) self.sensor_to_index_map[v['id']]=i+1 #print(self.sensor_to_index_map) debug_mesg("Created eGaugeHTTP Device with id: "+id)
def __init__(self, id, params): modbus_addr = 1 modbus_func = 3 # some more Eaton specific information self.reg_addr = 999 self.sensors = [("Voltage[AN]", "V"), ("Voltage[BN]", "V"), ("Voltage[CN]", "V"), ("Voltage[AB]", "V"), ("Voltage[BC]", "V"), ("Voltage[CA]", "V"), ("Current[A]", "A"), ("Current[B]", "A"), ("Current[C]", "A"), ("RealPower[Total]", "W"), ("ReactivePower[Total]", "VA"), ("ApparentPower[Total]"), ("PowerFactor[Total]", "%"), ("Frequency", "Hz"), ("Current[Neutral]", "A"), ("RealPower[A]", "W"), ("RealPower[B]", "W"), ("RealPower[C]", "W"), ("ReactivePower[A]", "VA"), ("ReactivePower[B]", "VA"), ("ReactivePower[C]", "VA"), ("ApparentPower[A]", "VA"), ("ApparentPower[B]", "VA"), ("ApparentPower[C]", "VA"), ("PowerFactor[A]", '%'), ("PowerFactor[B]", "%"), ("PowerFactor[C]", "%")] super(EatonIQ260, self).__init__("EatonIQ260", id, modbus_addr, modbus_func, params) self.i = 0 if not hasattr(self, 'port'): self.port = 4660 if not hasattr(self, 'host'): logging.error( "no host name or IP address specified for device %s:%s" % (self.type, self.id)) exit(1) if not hasattr(self, 'timeout'): self.timeout = 2 self.circuit_names_map = self.params.get('circuit_names_map', {}) for (i, s) in enumerate(self.sensors): self.sensors[i] = (self.circuit_names_map.get(s[0], s[0]), s[1]) debug_mesg("Created EatonIQ260 Device with id: " + id)
def __init__(self, id, params): modbus_addr = 1 modbus_func = 3 # some more Veris specific information self.max_meter_count = 42 # specifications of meters # (base_register, count, name, unit) self.meter_types = [ (2083, "RealPower", "kW"), (2167, "PowerFactor", "%"), (2251, "Current", "A") ] super(VerisE30A042,self).__init__("VerisE30A042", id, modbus_addr, modbus_func, params) self.i = 0 if not hasattr(self,'port'): self.port=4660 if not hasattr(self,'host'): logging.error("no host name or IP address specified for device %s:%s"%(self.type,self.id)) exit(1) if not hasattr(self, 'timeout'): self.timeout = 2 self.circuit_names_map = self.params.get('circuit_names_map',{}) self.sensors = self.params.get('sensors',[str(i+1) for i in range(self.max_meter_count)]) for (i,s) in enumerate(self.sensors): if s==False: self.sensors[i]=None if len(self.sensors)>self.max_meter_count: # truncate list of sensors self.sensors = self.sensors[0:self.max_meter_count] elif len(self.sensors)<self.max_meter_count: # no need to read all the meters self.max_meter_count = len(self.sensors) debug_mesg("Created VerisE30A042 Device with id: "+id)
def __init__(self, id, params): super(Vera, self).__init__("Vera", id, params) if not hasattr(self, 'port'): self.port = 3480 if not hasattr(self, 'host'): logging.error( "no host name or IP address specified for device %s:%s" % (self.type, self.id)) exit(1) if not hasattr(self, 'timeout'): self.timeout = 2 self.sensors = self.params.get('sensors', {}) if (type(self.sensors) != list): self.sensors = [self.sensors] self.sensor_to_index_map = {} for i, v in enumerate(self.sensors): if type(v) != dict or (not 'id' in v) or (not 'unit' in v): logging.error( "malformed sensor specification %s for device %s:%s" % (self.sensors, self.type, self.id)) exit(1) try: v['id'] = int(v['id']) except: logging.error( "non-integer id in sensor specification %s for device %s:%s" % (self.sensors, self.type, self.id)) exit(1) k = (v.get('type', "devices"), v['id']) if not k in self.sensor_to_index_map: self.sensor_to_index_map[k] = { v.get('field', "tripped"): (i + 1) } else: self.sensor_to_index_map[k][v.get('field', "tripped")] = (i + 1) debug_mesg("Created Vera Device with id: " + id)
def __init__(self, id, params): super(Stdout,self).__init__("Stdout", id, params) debug_mesg("Created Stdout Service with id: "+id)
def __init__(self, id, params): super(Stdout, self).__init__("Stdout", id, params) debug_mesg("Created Stdout Service with id: " + id)
def run(self): while True: current_time = time.time() next_time_to_check = 2147483647 # maximum possible unix timestamp #print(self.parent.feed_state_info) for f in self.parent.feed_state_info: if current_time>=self.parent.feed_state_info[f][1]: # print("Uploading feed %s at %s"%(f,current_time)) q = self.parent.feed_state_info[f][2] xively_message = {} num_datapoints = q.qsize() while not q.empty(): item = q.get() # item is of the form (datastream_id, [datapoint_record, ...]) if not item[0] in xively_message: xively_message[item[0]] = item[1] else: xively_message[item[0]].extend(item[1]) logging.debug(xively_message) # if this feed's queue was empty, there is no message to be sent... move on to the next one if xively_message=={}: continue logging.debug("# of datapoint [method 1] = %s"%num_datapoints), num_datapoints = 0 for ds_id in xively_message: num_datapoints = num_datapoints + len(xively_message[ds_id]) logging.debug("# of datapoint [method 2] = %s"%num_datapoints) update_result = self.update_xively_feed(f,xively_message,num_datapoints) # timestamp1,timestamp2,timestamp3,num_uploaded,num_failed,num_dropped,total_dp_available-num_uploaded-num_dropped #print(update_result) if update_result[6]>0: # some samples got buffered ... let us speed up a bit the polling of this feed debug_mesg("Speeding up Xively feed %s uploads!!!"%(f)) time_for_next_upload_of_this_feed = current_time+min(self.parent.feed_state_info[f][0][1],self.parent.feed_state_info[f][0][0]) else: time_for_next_upload_of_this_feed = current_time+self.parent.feed_state_info[f][0][0] self.parent.feed_state_info[f][1] = time_for_next_upload_of_this_feed next_time_to_check = min(next_time_to_check,time_for_next_upload_of_this_feed) self.parent.feed_state_info[f][3].append(update_result) # remove entries from too far back... while (update_result[0]-self.parent.feed_state_info[f][3][0][0])>self.parent.statistics_window: self.parent.feed_state_info[f][3].pop(0) # compute some stats upload_count = 0 failed_count = 0 dropped_count = 0 api_call_count = 0 for e in self.parent.feed_state_info[f][3]: api_call_count = api_call_count + 1 upload_count = upload_count + e[3] failed_count = failed_count + e[4] dropped_count = dropped_count + e[5] #print("Recent statistics for Xively feed %s:"%(f)), #print(self.parent.feed_state_info[f][3]) #print("Next upload at %s"%time_for_next_upload_of_this_feed) else: next_time_to_check = min(next_time_to_check,self.parent.feed_state_info[f][1]) if (next_time_to_check==2147483647): delta = 1 else: delta=max(1,next_time_to_check-time.time()) # print(next_time_to_check), # print(delta) time.sleep(delta)
def __init__(self, id, params): super(Xively,self).__init__("Xively", id, params) try: self.api_url_format = params.get('api_url_format',"https://api.xively.com/v2/feeds/{0}.json") # do a test test_url = str.format(self.api_url_format,1234) assert(test_url!=self.api_url_format) # just make sure that format had an effect o = urlparse(test_url) self.api_protocol = o.scheme assert(self.api_protocol=="http" or self.api_protocol=="https") x = o.netloc.split(":") assert(len(x)<3) if (len(x)==2): self.api_host = x[0] self.api_port = int(x[1]) else: self.api_host = x[0] assert(is_valid_host(self.api_host)) except: logging.error("parameter api_url_format = "+self.api_url_format+" for service "+self.type+":"+self.id+" is not valid.") exit(1) try: self.api_timeout = float(params.get('api_timeout',"8")) except ValueError: logging.error("parameter api_timeout for service "+self.type+":"+self.id+" is not a float.") exit(1) if not 'api_key' in params: logging.error("no api_key for service %s:%s"%(self.type,self.id)) exit(1) else: self.api_key = params.get('api_key',None) try: self.upload_interval = params.get('upload_interval',{}) assert(type(self.upload_interval)==dict) except AssertionError as e: logging.error("parameter upload_interval for service "+self.type+":"+self.id+" is not a dict.") exit(1) try: self.upload_interval_burst = params.get('upload_interval_burst',{}) assert(type(self.upload_interval_burst)==dict) except AssertionError as e: logging.error("parameter upload_interval_burst for service "+self.type+":"+self.id+" is not a dict.") exit(1) try: self.upload_buffer_size = int(params.get('upload_buffer_size',500)) except ValueError: logging.error("parameter upload_buffer_size for service "+self.type+":"+self.id+" is not an integer.") exit(1) try: self.max_datapoints_per_write = int(params.get('max_datapoints_per_write',"490")) except ValueError as e: logging.error("parameter max_datapoints_per_write for service "+self.type+":"+self.id+" is not an integer.") exit(1) try: self.statistics_window = int(params.get('statistics_window',"120")) assert(self.statistics_window>=0) except ValueError as e: logging.error("parameter statistics_window for service "+self.type+":"+self.id+" is not a number.") exit(1) except AssertionError as e: logging.error("parameter statistics_window for service "+self.type+":"+self.id+" is negative.") exit(1) self.dropped_datapoint_save = params.get('dropped_datapoint_save',True) if type(self.dropped_datapoint_save)==str: if self.dropped_datapoint_save.upper()=="TRUE": self.dropped_datapoint_save=True elif self.dropped_datapoint_save.upper()=="FALSE": self.dropped_datapoint_save=False if type(self.dropped_datapoint_save)!=bool: logging.error("parameter dropped_datapoint_save for service "+self.type+":"+self.id+" is invalid.") exit(1) try: self.dropped_datapoint_folder = params.get('dropped_datapoint_folder',"./xively_dropped") assert(type(self.dropped_datapoint_folder)==str) except AssertionError as e: logging.error("parameter dropped_datapoint_folder = "+self.dropped_datapoint_folder+"for service "+self.type+":"+self.id+" is not a string.") exit(1) if self.dropped_datapoint_save and not os.path.exists(self.dropped_datapoint_folder): os.makedirs(self.dropped_datapoint_folder) # following are per-queue paramters self.xively_feeds = {} # self.xively_feed_maps = {} self.xively_datastream_maps={} # we store feed_id:[(upload_interval,upload_interval_burst), next_processing_time, queue, # [(arrival_time,upload_start_time,upload_end_time,num_uploaded,num_dropped,num_buffered)], # drop_filename, drop_filehandle, pending_buffer} self.feed_state_info={} #default update interval for feeds in seconds self.default_upload_interval = 15 self.default_upload_interval_burst = 10 self.uploader_thread = None debug_mesg("Created Xively Upload Service with id: "+id)
def __init__(self, id, params): super(SensorAct, self).__init__("SensorAct", id) debug_mesg("Created SensorAct:" + id)