karioja / vedirect

Simple VE.Direct reader for Python
MIT License
94 stars 38 forks source link

How can you run this when connected to the MPPT? #8

Open bigbborn opened 3 years ago

bigbborn commented 3 years ago

The README does a good job of explaining how to use the Example data, but what do you need to do if you're hooked up directly to the MPPT? (sorry, it's probably very basic, but I'm and extremely new Python developer 😅)

kjkoster commented 3 years ago

On a Raspberry Pi, you plug in one of those VE.Direct to USB cables (really just serial to USB) and use something like the following:

$ python3 examples/vedirect_print.py --port /dev/ttyUSB0

Gamma-Software commented 3 years ago

@karioja I'm connected to my Victron devices (2 of them) via Bluetooth then "sudo rfcomm bind 1 $MAC_ADDRESS" to bind to /dev/rfcomm1 and didn't succeed to connect. I get this kind of error:

$ python3 examples/vedirect_print.py --port /dev/rfcomm1 Traceback (most recent call last): File "examples/vedirect_print.py", line 16, in print(ve.read_data_callback(print_data_callback)) File "/home/rudloff/sources/CapsuleScripts/devices_driver/vedirect/vedirect/vedirect.py", line 84, in read_data_callback data = self.ser.read() File "/home/rudloff/sources/CapsuleScripts/devices_driver/vedirect/.venv/lib/python3.8/site-packages/serial/serialposix.py", line 595, in read raise SerialException( serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

But I don't use the serial port anywhere. This connectivity issue is systematic on my 2 devices. I may have done something wrong. Have you experienced something similar and connected via Bluetooth ?

karioja commented 3 years ago

AFAIK the Victron Bluetooth Dongle / Bluetooth enabled devides use a custom protocol. https://community.victronenergy.com/questions/24952/using-bluetooth-to-read-direct-values.html They mention GATT so perhaps the data is available through GATT characteristics.

birdie1 commented 3 years ago

If you want to connect via bluetooth, check out this repo: https://github.com/birdie1/victron. We have reverse engineered parts of the victron bluetooth protocol for different devices and added the new ble gatt protocol from smartshunt as well.

Gamma-Software commented 3 years ago

Nice guys ! thanks for the fast reply. I'll definitely check the links out!