Added script query_device.py

This commit is contained in:
mj
2021-11-26 20:34:32 +01:00
parent 1bcbae877b
commit cfb945408e
3 changed files with 223 additions and 10 deletions

View File

@@ -67,7 +67,7 @@ print(f'Baudrates: {baud}')
print('---- Looking for device ----')
total_devices = 0
tried_devices = 0
CO2_addr = Sensor.input_register_offset['CO2_addr']
CO2_offset = Sensor.input_register_offset['CO2']
for a in addr:
for b in baud:
print(f'Address {a : >3} baud {b : >6}: ', end='')
@@ -82,7 +82,7 @@ for a in addr:
instrument.mode = minimalmodbus.MODE_RTU # rtu or ascii mode
instrument.clear_buffers_before_each_transaction = True
##
CO2 = instrument.read_register(CO2_addr, 1, functioncode=4) * 10
CO2 = instrument.read_register(CO2_offset, 1, functioncode=4) * 10
print('DEVICE RESPONDED')
total_devices += 1
except minimalmodbus.NoResponseError: