Mar-06-2023, 05:30 PM
At 63 years of age I remember starting my "coding life" in college with Basic, Logo, COBOL, and Pascal...done a lot of other languages since then of course, but I'm liking Python as I dig in a bit. Now that I've retired and live off-grid I have the time (especially in winter when I get snowed in often) to rekindle my interest in coding, so for me that's a good thing...
Regarding your earlier comment about checking the result on the statements...
Again, your thoughtful responses have been enormously helpful!
Regarding your earlier comment about checking the result on the statements...
result = bms.writeCharacteristic(0x15,b'\xdd\xa5\x03\x00\xff\xfd\x77',False) bms.waitForNotifications(5)I think you're spot on. I'm betting the random issue on occasion is the BMS device being slow to provide a response, and the code doesn't seem to care, it just moves on after 5 seconds. That would result in a "short list" and cause the out of bounds reference error. I'll check the method and see if it provides a usable result code that I can test, and test it. And/or I'll adjust the wait time from 5 seconds to 10 seconds and see if that removes the random fails in the short term. You're correct that once you go down a rat hole like "it must be something strange about the print statements fixing the issue" it can be hard to see other alternatives (wish I had a code buddy to bounce these things off of, but I guess that's what these forums are for).
Again, your thoughtful responses have been enormously helpful!