Frankkkkk / python-pylontech

Python lib to talk to pylontech lithium batteries 🔋 (US2000, US3000, ...) using RS485
MIT License
67 stars 32 forks source link

Question: How to use different serial port than ttyUSB0? #13

Closed df8oe closed 2 years ago

df8oe commented 2 years ago

Can I tell pylontech.py to use e.g. ttyUSB11 instead of ttyUSB0? Everything is working fine except my USB devices (I have multiple) are differently enumerated...

Frankkkkk commented 2 years ago

Hi, You can specify the serial port in the constructor: https://github.com/Frankkkkk/python-pylontech/blob/master/pylontech/pylontech.py#L112

Cheers

df8oe commented 2 years ago

Thank you for your reply (and your perfectly working project) - but this breaks pip upgrade/update functionality. After an upgrade via pip changes are lost...

Frankkkkk commented 2 years ago

I don't understand; how do you use the library ? In your code, you should have something like:

p = Pylontech(serial_port='/dev/ttyUSB11')
…

And that shouldn't break when updating via pip ‽ Cheers

df8oe commented 2 years ago

The issue is not at your side - it is at my side. I do not have experiences with python and do not want to poke in pylontech.py. This answer rescues my day - thank you!