示例#1
0
def startSensor(devId, i2cAddress):
    global sensors, sensor
    global startTime
    global gasBaseLine, gasBurnIn
    global BMEsensor, firstValue
    U.toLog(-1, "==== Start BME680 ===== @ i2c= " + unicode(i2cAddress))
    startTime = time.time()
    gasBaseLine = 0
    gasBurnIn = []

    i2cAdd = U.muxTCA9548A(
        sensors[sensor][devId]
    )  # switch mux on if requested and use the i2c address of the mix if enabled
    print " starting with ic2= " + str(i2cAdd)

    try:
        BMEsensor[devId] = BME680(i2c_addr=i2cAdd)

    except Exception, e:
        U.toLog(
            -1,
            u"in Line '%s' has error='%s'" % (sys.exc_traceback.tb_lineno, e))
        BMEsensor[devId] = ""
        U.muxTCA9548Areset()
        return
示例#2
0
def getValues(devId):
    global sensor, sensors, INAsensor, badSensor
    global actionDistanceOld, actionShortDistance, actionShortDistanceLimit, actionMediumDistance, actionMediumDistanceLimit, actionLongDistance, actionLongDistanceLimit

    i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
    for ii in range(2):
        try:
            ShuntVoltage = INAsensor[devId].getShuntVoltage_V()
            BusVoltage = INAsensor[devId].getBusVoltage_mV()
            Current = INAsensor[devId].getCurrent_mA()
            Power = INAsensor[devId].getPower_mW()
            #print "SV:",ShuntVoltage, "   BV:",BusVoltage, "  C:",Current, "  P:",Power
            data = {
                "ShuntVoltage": ("%7.1f" % ShuntVoltage).strip(),
                "BusVoltage": ("%7d" % BusVoltage).strip(),
                "Power": ("%7d" % Power).strip(),
                "Current": ("%7.1f" % Current).strip()
            }
            badSensor = 0
            U.muxTCA9548Areset()
            return data
        except Exception, e:
            if badSensor > 2 and badSensor < 5:
                U.toLog(
                    -1, u"in Line '%s' has error='%s'" %
                    (sys.exc_traceback.tb_lineno, e))
                U.toLog(-1, u"Current>>" + unicode(Current) + "<<")
            badSensor += 1
示例#3
0
文件: as726x.py 项目: kw123/piBeacon
def getValues(devId):
	global sensor, sensors,	 as726xsensor, badSensor
	global LEDmA, doAverage, LEDBlink, gain

	i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
	data ={"blue":"","green":"","yellow":"","orange":"","red":"","violet":"","temp":"","LEDcurrent":0}
	try:
		for ii in range(20):
			if as726xsensor[devId].data_ready(): break
			time.sleep(.1)
		##print "blue" , as726xsensor[devId].blue()
		data["blue"]		= as726xsensor[devId].blue()
		data["green"]		= as726xsensor[devId].green()
		data["yellow"]		= as726xsensor[devId].yellow()
		data["orange"]		= as726xsensor[devId].orange()
		data["red"]			= as726xsensor[devId].red()
		data["violet"]		= as726xsensor[devId].violet()
		data["temp"]		= as726xsensor[devId].temperature()
		badSensor = 0
		U.muxTCA9548Areset()
		return data

	except	Exception, e:
		if badSensor >-1 and badSensor < 5000: 
			U.toLog(-1, u"getValues in Line '%s' has error='%s'" % (sys.exc_traceback.tb_lineno, e))
			U.toLog(-1, unicode(data) )
						
		badSensor+=1
示例#4
0
文件: as726x.py 项目: kw123/piBeacon
def setLED(devId,value):
	global sensor, sensors,	 as726xsensor
	try:
		i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
		if value == 0:
			as726xsensor[devId].enable_driver_led(False)
		else:
			as726xsensor[devId].set_driver_led_current(value)
			as726xsensor[devId].enable_driver_led(True)
		U.muxTCA9548Areset()
	except	Exception, e:
		U.toLog(-1, u"setLED in Line '%s' has error='%s'" % (sys.exc_traceback.tb_lineno, e))
示例#5
0
def setLED(devId, value):
    global sensor, sensors, as726xsensor
    try:
        i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
        if value == 0:
            as726xsensor[devId].enable_driver_led(False)
        else:
            as726xsensor[devId].set_driver_led_current(value)
            as726xsensor[devId].enable_driver_led(True)
        U.muxTCA9548Areset()
    except Exception, e:
        U.toLog(
            -1, u"setLED in Line '%s' has error='%s'" %
            (sys.exc_traceback.tb_lineno, e))
示例#6
0
文件: tmp006.py 项目: kw123/piBeacon
def getValues(devId):
	global sensor, sensors,	 tmp006sensor, badSensor

	i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
	try:
		temp,ambTemp	 = tmp006sensor[devId].getdata()
		if temp =="" or ambTemp =="" :
			badSensor+=1
			U.muxTCA9548Areset()
			return "badSensor"
		data = {"temp":round(temp,2),"AmbientTemperature":round(ambTemp,2)}
		badSensor = 0
		U.muxTCA9548Areset()
		return data
	except	Exception, e:
		if badSensor >2 and badSensor < 5: 
			U.toLog(-1, u"in Line '%s' has error='%s'" % (sys.exc_traceback.tb_lineno, e))
			U.toLog(-1, u"temp>>" + unicode(temp)+"<<")
		badSensor+=1
示例#7
0
文件: si7021.py 项目: kw123/piBeacon
def getValues(devId):
	global sensor, sensors,	 SI7021sensor, badSensor

	i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
	try:
		temp,hum	 = SI7021sensor[devId].getdata()
		if temp =="" or hum =="" :
			badSensor+=1
			U.muxTCA9548Areset()
			return "badSensor"
		data = {"temp":("%7.1f"%temp).strip(), "hum":("%7d"%hum).strip()}
		badSensor = 0
		U.muxTCA9548Areset()
		return data
	except	Exception, e:
		if badSensor >2 and badSensor < 5: 
			U.toLog(-1, u"in Line '%s' has error='%s'" % (sys.exc_traceback.tb_lineno, e))
			U.toLog(-1, u"temp>>" + unicode(temp)+"<<")
		badSensor+=1
示例#8
0
def getValues(devId):
    global sensor, sensors, SI7021sensor, badSensor

    i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
    try:
        temp, hum = SI7021sensor[devId].getdata()
        if temp == "" or hum == "":
            badSensor += 1
            U.muxTCA9548Areset()
            return "badSensor"
        data = {"temp": ("%7.1f" % temp).strip(), "hum": ("%7d" % hum).strip()}
        badSensor = 0
        U.muxTCA9548Areset()
        return data
    except Exception, e:
        if badSensor > 2 and badSensor < 5:
            U.toLog(
                -1, u"in Line '%s' has error='%s'" %
                (sys.exc_traceback.tb_lineno, e))
            U.toLog(-1, u"temp>>" + unicode(temp) + "<<")
        badSensor += 1
示例#9
0
文件: ina219.py 项目: kw123/piBeacon
def getValues(devId):
	global sensor, sensors,	 INAsensor, badSensor
	global actionDistanceOld, actionShortDistance, actionShortDistanceLimit, actionMediumDistance, actionMediumDistanceLimit, actionLongDistance, actionLongDistanceLimit

	i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
	for ii in range(2):
		try:
			ShuntVoltage = INAsensor[devId].getShuntVoltage_V()
			BusVoltage	 = INAsensor[devId].getBusVoltage_mV()
			Current		 = INAsensor[devId].getCurrent_mA()
			Power		 = INAsensor[devId].getPower_mW()
			#print "SV:",ShuntVoltage, "   BV:",BusVoltage, "  C:",Current, "  P:",Power
			data = {"ShuntVoltage":("%7.1f"%ShuntVoltage).strip(), "BusVoltage":("%7d"%BusVoltage).strip(), "Power":("%7d"%Power).strip(), "Current":("%7.1f"%Current).strip()}
			badSensor = 0
			U.muxTCA9548Areset()
			return data
		except	Exception, e:
			if badSensor >2 and badSensor < 5: 
				U.toLog(-1, u"in Line '%s' has error='%s'" % (sys.exc_traceback.tb_lineno, e))
				U.toLog(-1, u"Current>>" + unicode(Current)+"<<")
			badSensor+=1
示例#10
0
def getValues(devId):
    global sensor, sensors, as726xsensor, badSensor
    global LEDmA, doAverage, LEDBlink, gain

    i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
    data = {
        "blue": "",
        "green": "",
        "yellow": "",
        "orange": "",
        "red": "",
        "violet": "",
        "temp": "",
        "LEDcurrent": 0
    }
    try:
        for ii in range(20):
            if as726xsensor[devId].data_ready(): break
            time.sleep(.1)
        ##print "blue" , as726xsensor[devId].blue()
        data["blue"] = as726xsensor[devId].blue()
        data["green"] = as726xsensor[devId].green()
        data["yellow"] = as726xsensor[devId].yellow()
        data["orange"] = as726xsensor[devId].orange()
        data["red"] = as726xsensor[devId].red()
        data["violet"] = as726xsensor[devId].violet()
        data["temp"] = as726xsensor[devId].temperature()
        badSensor = 0
        U.muxTCA9548Areset()
        return data

    except Exception, e:
        if badSensor > -1 and badSensor < 5000:
            U.toLog(
                -1, u"getValues in Line '%s' has error='%s'" %
                (sys.exc_traceback.tb_lineno, e))
            U.toLog(-1, unicode(data))

        badSensor += 1
示例#11
0
文件: bme680.py 项目: kw123/piBeacon
def startSensor(devId,i2cAddress):
	global sensors,sensor
	global startTime
	global gasBaseLine, gasBurnIn
	global BMEsensor, firstValue
	U.toLog(-1,"==== Start BME680 ===== @ i2c= " +unicode(i2cAddress))
	startTime =time.time()
	gasBaseLine = 0
	gasBurnIn	= []


	i2cAdd = U.muxTCA9548A(sensors[sensor][devId]) # switch mux on if requested and use the i2c address of the mix if enabled
	print " starting with ic2= "+ str(i2cAdd)
	
	try:
		BMEsensor[devId]  = BME680(i2c_addr=i2cAdd)
		
	except	Exception, e:
		U.toLog(-1, u"in Line '%s' has error='%s'" % (sys.exc_traceback.tb_lineno, e))
		BMEsensor[devId] =""
		U.muxTCA9548Areset()
		return
示例#12
0
def getValues(devId):
	global sensor, sensors,	 INAsensor, badSensor
	global actionDistanceOld, actionShortDistance, actionShortDistanceLimit, actionMediumDistance, actionMediumDistanceLimit, actionLongDistance, actionLongDistanceLimit

	i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
	for ll1 in range(2):
		try:
			data ={"Current1":"","Current2":"","Current3":""}
			for ii in range(3):
				ShuntVoltage,Current = INAsensor[devId].getShuntVoltageCurrent(ii)
				BusVoltage			 = INAsensor[devId].getBusVoltage_V(ii)
				#print ii, "SV:",ShuntVoltage, "   BV:",BusVoltage, "  C:",Current
				data["ShuntVoltage"+str(ii+1)] =("%7.1f"%ShuntVoltage).strip()
				data["BusVoltage"+str(ii+1)]   =("%7.3f"%BusVoltage).strip()
				data["Current"+str(ii+1)]	   =("%7.1f"%Current).strip()
			badSensor = 0
			U.muxTCA9548Areset()
			return data
		except	Exception, e:
			if badSensor >2 and badSensor < 5: 
				U.toLog(-1, u"in Line '%s' has error='%s'" % (sys.exc_traceback.tb_lineno, e))
				U.toLog(-1, u"Current>>" + unicode(Current)+"<<")
			badSensor+=1
示例#13
0
文件: si7021.py 项目: kw123/piBeacon
def readParams():
	global sensorList, sensors, logDir, sensor,	 sensorRefreshSecs
	global rawOld
	global deltaX, SI7021sensor, minSendDelta
	global oldRaw, lastRead
	try:



		inp,inpRaw,lastRead2 = U.doRead(lastTimeStamp=lastRead)
		if inp == "": return
		if lastRead2 == lastRead: return
		lastRead   = lastRead2
		if inpRaw == oldRaw: return
		oldRaw	   = inpRaw
		
		externalSensor=False
		sensorList=[]
		sensorsOld= copy.copy(sensors)


		
		U.getGlobalParams(inp)
		  
		if "sensorList"			in inp:	 sensorList=			 (inp["sensorList"])
		if "sensors"			in inp:	 sensors =				 (inp["sensors"])
		if "debugRPI"			in inp:	 G.debug=			  int(inp["debugRPI"]["debugRPISENSOR"])
		
 
		if sensor not in sensors:
			U.toLog(-1, G.program+" is not in parameters = not enabled, stopping "+G.program+".py" )
			exit()
			
				
		deltaX={}
		for devId in sensors[sensor]:
			deltaX[devId]  = 0.1
			try:
				xx = sensors[sensor][devId]["sensorRefreshSecs"].split("#")
				sensorRefreshSecs = float(xx[0]) 
			except:
				sensorRefreshSecs = 90	  


			try:
				if "i2cAddress" in sensors[sensor][devId]: 
					i2cAddress = int(sensors[sensor][devId]["i2cAddress"])
			except:
				i2cAddress = ""	   

			try:
				if "deltaX" in sensors[sensor][devId]: 
					deltaX[devId]= float(sensors[sensor][devId]["deltaX"])/100.
			except:
				deltaX[devId] = 0.05

			try:
				if "minSendDelta" in sensors[sensor][devId]: 
					minSendDelta= float(sensors[sensor][devId]["minSendDelta"])/100.
			except:
				minSendDelta = 5.

				
			if devId not in SI7021sensor:
				U.toLog(-1,"==== Start "+G.program+" ===== @ i2c= " +unicode(i2cAddress))
				i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
				SI7021sensor[devId] = si7021(i2cAddress=i2cAdd)
				U.muxTCA9548Areset()
				
		deldevID={}		   
		for devId in SI7021sensor:
			if devId not in sensors[sensor]:
				deldevID[devId]=1
		for dd in  deldevID:
			del SI7021sensor[dd]
		if len(SI7021sensor) ==0: 
			####exit()
			pass

	except	Exception, e:
		U.toLog(-1, u"in Line '%s' has error='%s'" % (sys.exc_traceback.tb_lineno, e))
示例#14
0
def readParams():
    global sensorList, sensors, logDir, sensor, sensorRefreshSecs
    global rawOld
    global deltaX, INAsensor, minSendDelta
    global oldRaw, lastRead
    try:

        inp, inpRaw, lastRead2 = U.doRead(lastTimeStamp=lastRead)
        if inp == "": return
        if lastRead2 == lastRead: return
        lastRead = lastRead2
        if inpRaw == oldRaw: return
        oldRaw = inpRaw

        externalSensor = False
        sensorList = []
        sensorsOld = copy.copy(sensors)

        U.getGlobalParams(inp)

        if "sensorList" in inp: sensorList = (inp["sensorList"])
        if "sensors" in inp: sensors = (inp["sensors"])
        if "debugRPI" in inp: G.debug = int(inp["debugRPI"]["debugRPISENSOR"])

        if sensor not in sensors:
            U.toLog(
                -1,
                G.program + " is not in parameters = not enabled, stopping " +
                G.program + ".py")
            exit()

        deltaX = {}
        for devId in sensors[sensor]:
            deltaX[devId] = 0.1
            try:
                xx = sensors[sensor][devId]["sensorRefreshSecs"].split("#")
                sensorRefreshSecs = float(xx[0])
            except:
                sensorRefreshSecs = 90

            try:
                if "i2cAddress" in sensors[sensor][devId]:
                    i2cAddress = int(sensors[sensor][devId]["i2cAddress"])
            except:
                i2cAddress = ""

            try:
                if "deltaX" in sensors[sensor][devId]:
                    deltaX[devId] = float(
                        sensors[sensor][devId]["deltaX"]) / 100.
            except:
                deltaX[devId] = 0.1

            try:
                if "minSendDelta" in sensors[sensor][devId]:
                    minSendDelta = float(
                        sensors[sensor][devId]["minSendDelta"]) / 100.
            except:
                minSendDelta = 5.

            try:
                if "minSendDelta" in sensors[sensor][devId]:
                    minSendDelta = float(
                        sensors[sensor][devId]["minSendDelta"]) / 100.
            except:
                minSendDelta = 5.

            try:
                shuntResistor = 0.1
                if "shuntResistor" in sensors[sensor][devId]:
                    shuntResistor = float(
                        sensors[sensor][devId]["shuntResistor"])
            except:
                shuntResistor = 0.1

            if devId not in INAsensor:
                U.toLog(
                    -1, "==== Start " + G.program + " ===== @ i2c= " +
                    unicode(i2cAddress) + ";	  shuntResistor= " +
                    unicode(shuntResistor))
                i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
                INAsensor[devId] = INA219(i2cAddress=i2cAdd,
                                          shuntResistor=shuntResistor)
                U.muxTCA9548Areset()

        deldevID = {}
        for devId in INAsensor:
            if devId not in sensors[sensor]:
                deldevID[devId] = 1
        for dd in deldevID:
            del INAsensor[dd]
        if len(INAsensor) == 0:
            ####exit()
            pass

    except Exception, e:
        U.toLog(
            -1,
            u"in Line '%s' has error='%s'" % (sys.exc_traceback.tb_lineno, e))
示例#15
0
文件: as726x.py 项目: kw123/piBeacon
def readParams():
	global sensorList, sensors, logDir, sensor,	 sensorRefreshSecs
	global rawOld
	global deltaX, as726xsensor, minSendDelta
	global oldRaw, lastRead
	global LEDmA, doAverage, LEDBlink, gain, integrationTime
	try:



		inp,inpRaw,lastRead2 = U.doRead(lastTimeStamp=lastRead)
		if inp == "": return
		if lastRead2 == lastRead: return
		lastRead   = lastRead2
		if inpRaw == oldRaw: return
		oldRaw	   = inpRaw
		
		externalSensor=False
		sensorList=[]
		sensorsOld= copy.copy(sensors)


		
		U.getGlobalParams(inp)
		  
		if "sensorList"			in inp:	 sensorList=			 (inp["sensorList"])
		if "sensors"			in inp:	 sensors =				 (inp["sensors"])
		if "debugRPI"			in inp:	 G.debug=			  int(inp["debugRPI"]["debugRPISENSOR"])
		
 
		if sensor not in sensors:
			U.toLog(-1, G.program+" is not in parameters = not enabled, stopping "+G.program+".py" )
			exit()
			
				
		deltaX={}
		for devId in sensors[sensor]:
			deltaX[devId]  = 0.1
			try:
				xx = sensors[sensor][devId]["sensorRefreshSecs"].split("#")
				sensorRefreshSecs = float(xx[0]) 
			except:
				sensorRefreshSecs = 100	   


			try:
				if "i2cAddress" in sensors[sensor][devId]: 
					i2cAddress = int(sensors[sensor][devId]["i2cAddress"])
			except:
				i2cAddress = ""	   

			try:
				if "deltaX" in sensors[sensor][devId]: 
					deltaX[devId]= float(sensors[sensor][devId]["deltaX"])/100.
			except:
				deltaX[devId] = 0.1

			try:
				if "minSendDelta" in sensors[sensor][devId]: 
					minSendDelta= float(sensors[sensor][devId]["minSendDelta"])/100.
			except:
				minSendDelta = 5.

			try:
				if "gain" in sensors[sensor][devId]: 
					gain= float(sensors[sensor][devId]["gain"])
			except:
				gain = 16

			try:
				if "integrationTime" in sensors[sensor][devId]: 
					integrationTime= float(sensors[sensor][devId]["integrationTime"])
			except:
				integrationTime = 140

			try:
				if "doAverage" in sensors[sensor][devId]: 
					doAverage= int(sensors[sensor][devId]["doAverage"])
			except:
				doAverage = 1

			try:
				if "LEDmA" in sensors[sensor][devId]: 
					LEDmA= float(sensors[sensor][devId]["LEDmA"])
			except:
				LEDmA = 5.

			try:
				if "LEDBlink" in sensors[sensor][devId]: 
					LEDBlink= int(sensors[sensor][devId]["LEDBlink"])
			except:
				LEDBlink = 0



			if devId not in as726xsensor:
				U.toLog(-1,"==== Start "+G.program+" ====== @ i2c= " +unicode(i2cAddress) )
				i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
				as726xsensor[devId] = Adafruit_AS726x(i2cAddress=i2cAdd)
				as726xsensor[devId].set_Conversion_mode(as726xsensor[devId].MODE_2)
				U.muxTCA9548Areset()
			i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
			as726xsensor[devId].set_Integration_time(integrationTime)
			as726xsensor[devId].set_Gain(gain)
			U.muxTCA9548Areset()
			
		deldevID={}		   
		for devId in as726xsensor:
			if devId not in sensors[sensor]:
				deldevID[devId]=1
		for dd in  deldevID:
			del as726xsensor[dd]
		if len(as726xsensor) ==0: 
			####exit()
			pass

	except	Exception, e:
		U.toLog(-1, u"readParams in Line '%s' has error='%s'" % (sys.exc_traceback.tb_lineno, e))
示例#16
0
文件: as726x.py 项目: kw123/piBeacon
		data["orange"]		= as726xsensor[devId].orange()
		data["red"]			= as726xsensor[devId].red()
		data["violet"]		= as726xsensor[devId].violet()
		data["temp"]		= as726xsensor[devId].temperature()
		badSensor = 0
		U.muxTCA9548Areset()
		return data

	except	Exception, e:
		if badSensor >-1 and badSensor < 5000: 
			U.toLog(-1, u"getValues in Line '%s' has error='%s'" % (sys.exc_traceback.tb_lineno, e))
			U.toLog(-1, unicode(data) )
						
		badSensor+=1
	if badSensor >3: 
		U.muxTCA9548Areset()
		return "badSensor"
	U.muxTCA9548Areset()
	return "badSensor"		  






############################################
global rawOld
global sensor, sensors, badSensor
global deltaX, as726xsensor, minSendDelta
global oldRaw, lastRead
global LEDmA, doAverage, LEDBlink, gain, integrationTime
示例#17
0
        data["violet"] = as726xsensor[devId].violet()
        data["temp"] = as726xsensor[devId].temperature()
        badSensor = 0
        U.muxTCA9548Areset()
        return data

    except Exception, e:
        if badSensor > -1 and badSensor < 5000:
            U.toLog(
                -1, u"getValues in Line '%s' has error='%s'" %
                (sys.exc_traceback.tb_lineno, e))
            U.toLog(-1, unicode(data))

        badSensor += 1
    if badSensor > 3:
        U.muxTCA9548Areset()
        return "badSensor"
    U.muxTCA9548Areset()
    return "badSensor"


############################################
global rawOld
global sensor, sensors, badSensor
global deltaX, as726xsensor, minSendDelta
global oldRaw, lastRead
global LEDmA, doAverage, LEDBlink, gain, integrationTime
global formatStr

oldRaw = ""
lastRead = 0
示例#18
0
def readParams():
    global sensorList, sensors, logDir, sensor, sensorRefreshSecs
    global rawOld
    global deltaX, as726xsensor, minSendDelta
    global oldRaw, lastRead
    global LEDmA, doAverage, LEDBlink, gain, integrationTime
    try:

        inp, inpRaw, lastRead2 = U.doRead(lastTimeStamp=lastRead)
        if inp == "": return
        if lastRead2 == lastRead: return
        lastRead = lastRead2
        if inpRaw == oldRaw: return
        oldRaw = inpRaw

        externalSensor = False
        sensorList = []
        sensorsOld = copy.copy(sensors)

        U.getGlobalParams(inp)

        if "sensorList" in inp: sensorList = (inp["sensorList"])
        if "sensors" in inp: sensors = (inp["sensors"])
        if "debugRPI" in inp: G.debug = int(inp["debugRPI"]["debugRPISENSOR"])

        if sensor not in sensors:
            U.toLog(
                -1,
                G.program + " is not in parameters = not enabled, stopping " +
                G.program + ".py")
            exit()

        deltaX = {}
        for devId in sensors[sensor]:
            deltaX[devId] = 0.1
            try:
                xx = sensors[sensor][devId]["sensorRefreshSecs"].split("#")
                sensorRefreshSecs = float(xx[0])
            except:
                sensorRefreshSecs = 100

            try:
                if "i2cAddress" in sensors[sensor][devId]:
                    i2cAddress = int(sensors[sensor][devId]["i2cAddress"])
            except:
                i2cAddress = ""

            try:
                if "deltaX" in sensors[sensor][devId]:
                    deltaX[devId] = float(
                        sensors[sensor][devId]["deltaX"]) / 100.
            except:
                deltaX[devId] = 0.1

            try:
                if "minSendDelta" in sensors[sensor][devId]:
                    minSendDelta = float(
                        sensors[sensor][devId]["minSendDelta"]) / 100.
            except:
                minSendDelta = 5.

            try:
                if "gain" in sensors[sensor][devId]:
                    gain = float(sensors[sensor][devId]["gain"])
            except:
                gain = 16

            try:
                if "integrationTime" in sensors[sensor][devId]:
                    integrationTime = float(
                        sensors[sensor][devId]["integrationTime"])
            except:
                integrationTime = 140

            try:
                if "doAverage" in sensors[sensor][devId]:
                    doAverage = int(sensors[sensor][devId]["doAverage"])
            except:
                doAverage = 1

            try:
                if "LEDmA" in sensors[sensor][devId]:
                    LEDmA = float(sensors[sensor][devId]["LEDmA"])
            except:
                LEDmA = 5.

            try:
                if "LEDBlink" in sensors[sensor][devId]:
                    LEDBlink = int(sensors[sensor][devId]["LEDBlink"])
            except:
                LEDBlink = 0

            if devId not in as726xsensor:
                U.toLog(
                    -1, "==== Start " + G.program + " ====== @ i2c= " +
                    unicode(i2cAddress))
                i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
                as726xsensor[devId] = Adafruit_AS726x(i2cAddress=i2cAdd)
                as726xsensor[devId].set_Conversion_mode(
                    as726xsensor[devId].MODE_2)
                U.muxTCA9548Areset()
            i2cAdd = U.muxTCA9548A(sensors[sensor][devId])
            as726xsensor[devId].set_Integration_time(integrationTime)
            as726xsensor[devId].set_Gain(gain)
            U.muxTCA9548Areset()

        deldevID = {}
        for devId in as726xsensor:
            if devId not in sensors[sensor]:
                deldevID[devId] = 1
        for dd in deldevID:
            del as726xsensor[dd]
        if len(as726xsensor) == 0:
            ####exit()
            pass

    except Exception, e:
        U.toLog(
            -1, u"readParams in Line '%s' has error='%s'" %
            (sys.exc_traceback.tb_lineno, e))