My Sinowealth BMS is not found when I install v1.0 (and never, incl betas from @mr-manuel ) version of the driver. If I roll back to v0.14.3 i can get i work again.
How to reproduce
Install following the guide, latest or specific version ( >= 1.0) makes no difference in output.
Edit dbus-serialbattery.py and remove # in front of 'from bms.sinowealth import Sinowealth' and '{"bms": Sinowealth},'
Edit config.ini and added this row: BMS_TYPE = Sinowealth
Reboot
Expected behavior
Sinowealth BMS found on one of the Serial ports.
Driver version
v1.0.20230531
Venus OS device type
Raspberry Pi
Venus OS version
v2.92
BMS type
Sinowealth
Cell count
4
Connection type
Serial USB adapter to TTL
Config file
//First part of dbus-serialbattery.py ----------------------------
#!/usr/bin/python
# -*- coding: utf-8 -*-
from typing import Union
from time import sleep
from dbus.mainloop.glib import DBusGMainLoop
# from threading import Thread ## removed with https://github.com/Louisvdw/dbus-serialbattery/pull/582
import sys
if sys.version_info.major == 2:
import gobject
else:
from gi.repository import GLib as gobject
# Victron packages
# from ve_utils import exit_on_error
from dbushelper import DbusHelper
from utils import logger
import utils
from battery import Battery
# import battery classes
from bms.daly import Daly
from bms.ecs import Ecs
from bms.heltecmodbus import HeltecModbus
from bms.hlpdatabms4s import HLPdataBMS4S
from bms.jkbms import Jkbms
from bms.lifepower import Lifepower
from bms.lltjbd import LltJbd
from bms.renogy import Renogy
from bms.seplos import Seplos
from bms.sinowealth import Sinowealth
# from bms.ant import Ant
# from bms.mnb import MNB
supported_bms_types = [
{"bms": Daly, "baud": 9600, "address": b"\x40"},
{"bms": Daly, "baud": 9600, "address": b"\x80"},
{"bms": Ecs, "baud": 19200},
{"bms": HeltecModbus, "baud": 9600},
{"bms": HLPdataBMS4S, "baud": 9600},
{"bms": Jkbms, "baud": 115200},
{"bms": Lifepower, "baud": 9600},
{"bms": LltJbd, "baud": 9600},
{"bms": Renogy, "baud": 9600, "address": b"\x30"},
{"bms": Renogy, "baud": 9600, "address": b"\xF7"},
{"bms": Seplos, "baud": 19200},
{"bms": Sinowealth},
# {"bms": Ant, "baud": 19200},
# {"bms": MNB, "baud": 9600},
]
expected_bms_types = [
battery_type
for battery_type in supported_bms_types
if battery_type["bms"].__name__ == utils.BMS_TYPE or utils.BMS_TYPE == ""
]
logger.info("")
logger.info("Starting dbus-serialbattery")
def main():
def poll_battery(loop):
helper.publish_battery(loop)
return True
def get_battery(_port) -> Union[Battery, None]:
# all the different batteries the driver support and need to test for
# try to establish communications with the battery 3 times, else exit
count = 3
while count > 0:
# create a new battery object that can read the battery and run connection test
for test in expected_bms_types:
# noinspection PyBroadException
try:
logger.info("Testing " + test["bms"].__name__)
batteryClass = test["bms"]
baud = test["baud"]
battery: Battery = batteryClass(
port=_port, baud=baud, address=test.get("address")
)
if battery.test_connection():
logger.info(
"Connection established to " + battery.__class__.__name__
)
return battery
except KeyboardInterrupt:
return None
except Exception:
# Ignore any malfunction test_function()
pass
count -= 1
sleep(0.5)
return None
def get_port() -> str:
# Get the port we need to use from the argument
if len(sys.argv) > 1:
port = sys.argv[1]
if port not in utils.EXCLUDED_DEVICES:
return port
else:
logger.info(
"Stopping dbus-serialbattery: "
+ str(port)
+ " is excluded trough the config file"
)
sleep(86400)
sys.exit(0)
else:
# just for MNB-SPI
logger.info("No Port needed")
return "/dev/ttyUSB9"
logger.info("dbus-serialbattery v" + str(utils.DRIVER_VERSION))
config.ini ---------------------------------
[DEFAULT]
; --------- Additional settings ---------
; Specify only one BMS type to load else leave empty to try to load all available
; -- Available BMS:
; Daly, Ecs, HeltecModbus, HLPdataBMS4S, Jkbms, Lifepower, LltJbd, Renogy, Seplos
; -- Available BMS, but disabled by default:
; https://louisvdw.github.io/dbus-serialbattery/general/install#how-to-enable-a-disabled-bms
; Ant, MNB, Sinowealth
BMS_TYPE = Sinowealth
Relevant log output
dbus-serialbattery.ttyUSB1/current:
@400000006484e4192ecb7054 INFO:SerialBattery:
@400000006484e4192ed36764 INFO:SerialBattery:Starting dbus-serialbattery
@400000006484e4192ede9a94 INFO:SerialBattery:dbus-serialbattery v1.0.20230531
@400000006484e4192ee58bec INFO:SerialBattery:Testing Sinowealth
@400000006484e41a112970b4 INFO:SerialBattery:Testing Sinowealth
@400000006484e41a2f0911ac INFO:SerialBattery:Testing Sinowealth
@400000006484e41b114e6d74 ERROR:SerialBattery:ERROR >>> No battery connection at /dev/ttyUSB1
Serial-starter/current:
@400000006484e6df284db5fc INFO: Start service vedirect-interface.ttyUSB1 once
@400000006484e6e439ae22dc INFO: Start service dbus-serialbattery.ttyUSB1 once
@400000006484e6e80c6f384c INFO: Start service gps-dbus.ttyUSB1 once
Any other information that may be helpful
If I manually test the connection with another python module within NodeRed straight after I get the "No battery connection" error from the driver, I get a correct response. So the BMS is connected to that specific USB port and works as expected.
If I also uninstalls the => 1.0 version and installs v0.14.3 I get a connection as well, however I got hard times to get all my devices (SmartSolar, SmartShunt and Sinowealth BMS) working all together since the "some devices identified as Sinowealth BMS" bug.
Describe the bug
My Sinowealth BMS is not found when I install v1.0 (and never, incl betas from @mr-manuel ) version of the driver. If I roll back to v0.14.3 i can get i work again.
How to reproduce
Expected behavior
Sinowealth BMS found on one of the Serial ports.
Driver version
v1.0.20230531
Venus OS device type
Raspberry Pi
Venus OS version
v2.92
BMS type
Sinowealth
Cell count
4
Connection type
Serial USB adapter to TTL
Config file
Relevant log output
Any other information that may be helpful
If I manually test the connection with another python module within NodeRed straight after I get the "No battery connection" error from the driver, I get a correct response. So the BMS is connected to that specific USB port and works as expected.
If I also uninstalls the => 1.0 version and installs v0.14.3 I get a connection as well, however I got hard times to get all my devices (SmartSolar, SmartShunt and Sinowealth BMS) working all together since the "some devices identified as Sinowealth BMS" bug.