How can I check that e.g. non existent modbus telegram 10000 returns error please ?
TypeError: not all arguments converted during string formatting Call stack: File "/etc/openhab2/scripts/xcom485i/r_1all.py", line 45, in <module> read_value = xcom485i.read_parameter(xcom485i.addresses.xt_1_device_id, list[0]) # modbus reg File "/usr/local/lib/python3.9/dist-packages/xcom485i/client.py", line 150, in read_parameter logger.error("--> Modbus error : ", e)
I’m trying to sort out nonexistent/ non answering modbus telegrams from primary list and build a secondary list with only valid telegrams.
Thanks
P.S.
Link to Github package file: xcom485i.
But my problem is also the first code.
I need to test, if reading from serial console was OK or not.
The list is build as possible telegramm number lis.
Some from telegrams is correct answered from serial port hardware - they are recognised and returned some e.g. float value.
Some are answered with value None but with above error message, because telegramm number is invalid or belongs to missing hardware part in whole server system.
results always to above error message, because telegramm was not recognised from server (invalid number) or a corresponding hardware part isn’t present in server system and next list number should be used etc.
I’m trying:
while list:
try:
read_value = xcom485i.read_parameter(xcom485i.addresses.xt_1_device_id, list[0])
except Valueerror:
print("non answered telegramm)
don't insert number to new list
else:
insert number to new list
list.pop(0)`