Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation not working with smart solar / serial #29

Open
Henschga opened this issue Mar 29, 2024 · 1 comment
Open

Implementation not working with smart solar / serial #29

Henschga opened this issue Mar 29, 2024 · 1 comment

Comments

@Henschga
Copy link

Hi

I recently switched from the bluetooth to serial implementation which works fine for the smarthsunt, but not for the smartsolar products. After triggering the script manual I can see that there are missing dependencies to the library but this should be working (as it works with the smartshunt). Is there any advice that you can give me?

root@raspibus:/opt/victron# python3 victron.py -d 1
/opt/victron/victron.py:237: DeprecationWarning: Callback API version 1 is deprecated, update to latest version
  client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1)
Exception in thread Thread-1 (read_data_callback):
Traceback (most recent call last):
Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
  File "/opt/victron/victron.py", line 267, in <module>
    victron_thread(1, config, devices_config, q)
  File "/opt/victron/victron.py", line 24, in victron_thread
    self.run()
  File "/usr/lib/python3.11/threading.py", line 975, in run
    v = Victron(config, vdevice_config, output, args, thread_count, thread_q)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/victron/lib/victron.py", line 40, in __init__
    pid, ser, fw = self.victron_type.get_device_info()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    self._target(*self._args, **self._kwargs)
  File "/opt/victron/lib/victron_serial/victron_serial.py", line 59, in get_device_info
  File "/opt/victron/lib/victron_serial/victron_serial.py", line 18, in read_data_callback
    pid = self.map['PID'][4](data['PID'], self.map['PID'])
    callbackFunction(packet)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/victron/lib/victron_serial/victron_serial.py", line 40, in <lambda>
  File "/opt/victron/lib/helper.py", line 61, in convert_map_out
    callback_wrapper = lambda packet: self.read_data_callback(packet)
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    return f'{value}: {command[3][value]}'
  File "/opt/victron/lib/victron_serial/victron_serial.py", line 103, in read_data_callback
                       ~~~~~~~~~~^^^^^^^
KeyError: '0xA07D'
    self.process_packet(packet)
  File "/opt/victron/lib/victron_serial/victron_serial.py", line 111, in process_packet
    self.send_out(key, value)
  File "/opt/victron/lib/victron_serial/victron_serial.py", line 119, in send_out
    data = helper_function(value, map_entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/victron/lib/helper.py", line 61, in convert_map_out
    return f'{value}: {command[3][value]}'
                       ~~~~~~~~~~^^^^^^^
KeyError: '0xA07D'
@malocycling
Copy link

malocycling commented Jun 2, 2024

Since I ran into the same issue here's how I fixed it.
The mappings.py in ./lib seems not to be up-to-date and simply does not contain a representation for some newer devices.
In your case you just need to add a line to the PID = {} section containing "0xA07D": "BlueSolar MPPT 75/15 rev3", and the script should be working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants