From: Mick S. <mi...@su...> - 2020-08-04 22:53:08
|
Running v3.2p3 on Raspberry Pi, I have set up some DS18B20 sensors on a test system, all of them are powered, but simultaneous does not seem to be working The code is below, when I run it the first loop takes 16 seconds then it loops at 3 seconds for a while, then a 16 second etc. so it looks like it does slow individual conversions, then uses cached values until they expire, then another slow individual conversion, etc. Have I got something wrong here? Thanks Mick #!/usr/bin/python3 # sensor_read.py import pyownet import time def main(): owp = pyownet.protocol.proxy() while True: start = time.time() owp.write('/simultaneous/temperature', b'1') time.sleep(1) print('start of sensor_read.py') sen_lst = ['Solar_Pnl_1A', 'Solar_Pnl_2A','Solar_Pnl_1B', 'Pool_Sol_X', 'Pool_CH_X', 'DHW_Mid_Top', 'DHW_Mid_Btm', 'DHW_Top','Temp5', 'Temp19', 'Temp20','Temp21', 'Temp22', 'Temp23', 'Temp25', 'Temp26', 'Temp27', 'Temp29', 'Temp30'] prop_lst = ['/type', '/power', '/latesttemp'] for p in prop_lst: print('%s ' %p, end = '') print('') for sen in sen_lst: print('\n%s ' %sen, end = '') for prop in prop_lst: try: print('%s ' %(owp.read('/uncached/' + sen + prop).decode()), end = '') except: print('failed! ', end = '') endt = time.time() - start print('\nTime = %f' %endt) if __name__ == "__main__": main() |