birdie1 / victron

Victron bluetooth and serial communication at a python script. With MQTT and HomeAssistant support.
GNU General Public License v3.0
125 stars 16 forks source link

Smartshunt Unsynchronized SoC #13

Closed fti7 closed 2 years ago

fti7 commented 2 years ago

When the SoC is not synchronized, it throws an Exception:

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/threading.py", line 1299, in run
    self.function(*self.args, **self.kwargs)
  File "/src/victron.py", line 26, in victron_thread
    v.connect_disconnect_loop()
  File "/src/lib/victron.py", line 52, in connect_disconnect_loop
    self.victron_type.connect_disconnect_loop(self.cmd, self.config['timer'])
  File "/src/lib/victron_serial/victron_serial.py", line 36, in connect_disconnect_loop
    self.victron_device.get_data(self.output)
  File "/src/lib/victron_serial/victron_smartshunt.py", line 73, in get_data
    data = command[4](value, command)
  File "/src/lib/helper.py", line 44, in convert_int_factor
    data = int(value) * command[3]
ValueError: invalid literal for int() with base 10: '---'
birdie1 commented 2 years ago

With commit https://github.com/birdie1/victron/commit/33fff2f8067e71819d944f8e81c5cdf5f1bbd671 it will catch the ValueError and gives back the incoming string. Currently I don't have a device to test it.