question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

We received a buffer length of 1 from the RS485 module, but data buffer length is 0. This should not occur.

See original GitHub issue

Today I did a fresh installation with this commands:

sudo rm -r /etc/twcmanager
sudo rm -r TWCManager
git clone https://github.com/ngardiner/TWCManager
cd TWCManager
git checkout main
make install

Then installed my own 3 files config.json (see pull request #302 ) TWCMaster.py (I use always ‘1’ phases at line 637) Volkszahler.py (see pull request #302) (Note: If I would use all original files then same errors occur.)

Then tryout python -m TWCManager

Result is IndexError: index out of range at line 171 of TWCManager.py if msgLen == 0 and data[0] != 0xC0:

Here is “logLevel”: 10 all info: 12:19:51 TWCMaster 14 Registered module ConsoleLogging 12:19:51 TWCMaster 14 Released module FileLogging 12:19:51 TWCMaster 14 Released module SentryLogging 12:19:51 TWCMaster 14 Registered module TWCProtocol 12:19:51 TWCMaster 14 Registered module RS485 12:19:51 TWCMaster 14 Registered module Policy 12:19:51 TWCMaster 14 Registered module TeslaAPI 12:19:51 TWCMaster 14 Released module WebIPCControl 12:19:51 HTTPContro 20 Serving at port: 8181 12:19:51 TWCMaster 14 Registered module HTTPControl 12:19:51 TWCMaster 14 Released module Kostal 12:19:51 TWCMaster 14 Released module OpenHab 12:19:51 TWCMaster 14 Released module TeslaPowerwall2 12:19:51 TWCMaster 14 Registered module Volkszahler 12:19:51 TWCManager 20 TWC Manager starting as fake Master with id 7777 and sign 77 12:19:51 TWCMaster 13 Send master linkready1 12:19:51 RS485 12 Tx@: C0 FC E1 77 77 77 00 00 00 00 00 00 00 00 46 C0 12:19:51 TWCMaster 13 Send master linkready1 12:19:51 RS485 12 Tx@: C0 FC E1 77 77 77 00 00 00 00 00 00 00 00 46 C0 12:19:52 TWCMaster 13 Send master linkready1 12:19:52 RS485 12 Tx@: C0 FC E1 77 77 77 00 00 00 00 00 00 00 00 46 C0 12:19:52 TWCMaster 13 Send master linkready1 12:19:52 RS485 12 Tx@: C0 FC E1 77 77 77 00 00 00 00 00 00 00 00 46 C0 12:19:52 TWCMaster 13 Send master linkready1 12:19:52 RS485 12 Tx@: C0 FC E1 77 77 77 00 00 00 00 00 00 00 00 46 C0 12:19:52 TWCMaster 13 Send master linkready2 12:19:52 RS485 12 Tx@: C0 FB E2 77 77 77 00 00 00 00 00 00 00 00 47 C0 12:19:52 TWCMaster 13 Send master linkready2 12:19:52 RS485 12 Tx@: C0 FB E2 77 77 77 00 00 00 00 00 00 00 00 47 C0 12:19:52 TWCMaster 13 Send master linkready2 12:19:52 RS485 12 Tx@: C0 FB E2 77 77 77 00 00 00 00 00 00 00 00 47 C0 12:19:52 TWCMaster 13 Send master linkready2 12:19:52 RS485 12 Tx@: C0 FB E2 77 77 77 00 00 00 00 00 00 00 00 47 C0 12:19:52 TWCMaster 13 Send master linkready2 12:19:52 RS485 12 Tx@: C0 FB E2 77 77 77 00 00 00 00 00 00 00 00 47 C0 Traceback (most recent call last): File “/home/pi/TWCManager/TWCManager.py”, line 717, in <module> if msgLen == 0 and data[0] != 0xC0: IndexError: index out of range 12:20:05 TWCManager 20 Unhandled Exception:Traceback (most recent call last): File “/home/pi/TWCManager/TWCManager.py”, line 717, in <module> if msgLen == 0 and data[0] != 0xC0: IndexError: index out of range

Traceback (most recent call last): File “/home/pi/TWCManager/TWCManager.py”, line 717, in <module> if msgLen == 0 and data[0] != 0xC0: IndexError: index out of range 12:20:33 TWCManager 20 Unhandled Exception:Traceback (most recent call last): File “/home/pi/TWCManager/TWCManager.py”, line 717, in <module> if msgLen == 0 and data[0] != 0xC0: IndexError: index out of range

^CTraceback (most recent call last): File “/home/pi/TWCManager/TWCManager.py”, line 717, in <module> if msgLen == 0 and data[0] != 0xC0: IndexError: index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “/usr/lib/python3.7/runpy.py”, line 193, in _run_module_as_main “main”, mod_spec) File “/usr/lib/python3.7/runpy.py”, line 85, in _run_code exec(code, run_globals) File “/home/pi/TWCManager/TWCManager.py”, line 1561, in <module> time.sleep(5) KeyboardInterrupt

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tjikkuncommented, Jun 17, 2021

Just to add some info: You could alternatively use /dev/serial/by-path/platform-3f980000.usb-usb-0:1.4:1.0-port0 or /dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0 in de TCWManager config.json. Use by-path if you always plug in at the same port, this means it will still work if you replace the converter. If you use by-id it doesn’t matter which port, as long as you don’t replace.

0reactions
ngardinercommented, Jun 17, 2021

I have added your instructions to: https://github.com/ngardiner/TWCManager/blob/main/docs/config_examples.md

Thanks for the clear steps, this will be helpful to others with multiple USB to Serial interfaces

Read more comments on GitHub >

github_iconTop Results From Across the Web

Great Cow BASIC - Modbus Slave- commands 3 and 16
Never got implemented yet at the factory but I do have 7 stations ... to start Generator = 40961 For mbi = 1...
Read more >
Max485 Burns up - Hardware - Arduino Forum
One of the MAX485 modules didn't work anymore. ... LOW); // disable sending // init PWM pins for (i = 1; i <...
Read more >
1734-UM009C-EN-P POINT I/O ASCII Modules User Manual
Set Up the Receive Character Buffer Length . ... bandwidth, but causes scanners that do not support variable I/O sizes to malfunction. Do...
Read more >
Serial communication Basic Knowledge -RS-232C/RS-422 ...
The start bit length is fixed as 1 bit so this setting is not necessary. Data bit length: This specifies how many bits...
Read more >
The RS-485 Design Guide (Rev. D) - Texas Instruments
For a 22 AWG cable,. 120 W, UTP, this occurs at approximately 1200 m. Figure 9-1. Cable Length Versus Data Rate. 10 Minimum...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found