Skip to content
Snippets Groups Projects
Commit 9df16452 authored by Dinko Ferencek's avatar Dinko Ferencek
Browse files

Python 3 compatibility

parent 1c14c290
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,7 @@ def main(host='localhost', port=8086, db='mydb'):
modules = {}
module = YModule.FirstModule()
while module is not None:
#print module.get_serialNumber()
#print(module.get_serialNumber())
if module.get_serialNumber().startswith('METEOMK') and module.isOnline():
modules[module.get_serialNumber()] = module.get_logicalName()
module = module.nextModule()
......@@ -61,7 +61,7 @@ def main(host='localhost', port=8086, db='mydb'):
# Get sensor readings
for target in modules.keys():
#print modules[target]
#print(modules[target])
name = modules[target]
humSensor = YHumidity.FindHumidity(target+'.humidity')
pressSensor = YPressure.FindPressure(target+'.pressure')
......@@ -76,9 +76,9 @@ def main(host='localhost', port=8086, db='mydb'):
logger.info("Readings obtained")
cmd = "curl -i -XPOST 'http://%s:%i/write?db=%s' --data-binary 'yoctopuce %s=%f,%s=%f,%s=%f,%s=%f'"%(host,port,db,name+'_humidity',hum,name+'_pressure',press,name+'_temperature',temp,name+'_dewpoint',dew)
#print cmd
#print(cmd)
args = shlex.split(cmd)
#print args
#print(args)
logger.info("Sending sensor readings to the database...")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment