def log_incoming_data(packet): """ handle received data packets. log incoming values to server. """ if packet['id'] == 'rx': # some data was received data = packet['rf_data'].decode('utf-8').split('=') if data[1] != '': print('{0} -- Logged: {1}'.format(datetime.datetime.now(), data)) qweb.makeLogEntry(*data) else: print('No data in packet: {0}'.format(packet)) pass
def log(igh_ctrl, ilm_ctrl): response = qweb.getLoggableInfoForNow('igh') sensors = str.split(response, '\n') for sensor in sensors: if sensor != '': found = True loggable_name = '' props = str.split(sensor, ';') for prop in props: keyvals = str.split(prop, '=') if keyvals[0] == 'loggable_name': loggable_name = keyvals[1] # IGH North if loggable_name == 'ighn_temp_sorb': val = igh_ctrl.SorbTemp elif loggable_name == 'ighn_temp_1k': val = igh_ctrl.OneKPotTemp elif loggable_name == 'ighn_temp_mix': val = igh_ctrl.MixChTemp elif loggable_name == 'ighn_power_mix': val = igh_ctrl.MixChPower elif loggable_name == 'ighn_power_still': val = igh_ctrl.StillPower elif loggable_name == 'ighn_power_sorb': val = igh_ctrl.SorbPower elif loggable_name == 'ighn_pres_g1': val = igh_ctrl.G1 elif loggable_name == 'ighn_pres_g2': val = igh_ctrl.G2 elif loggable_name == 'ighn_pres_g3': val = igh_ctrl.G3 elif loggable_name == 'ighn_pres_p1': val = igh_ctrl.P1 elif loggable_name == 'ighn_pres_p2': val = igh_ctrl.P2 elif loggable_name == 'ighn_nv': val = igh_ctrl.NV elif loggable_name == 'ighn_res_mix': val = igh_ctrl.MixChResistance #ILM elif loggable_name == 'bluedewar_he_level': val = ilm_ctrl.HeliumLevel elif loggable_name == 'bluedewar_ni_level': val = ilm_ctrl.NitrogenLevel else: found = False if found: qweb.makeLogEntry(loggable_name, val)
def log_new_data(data): """ push new database entries to the sql database using the web service """ for d in data: qweb.makeLogEntry(name_reference[d[1]], d[2])