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

Merge dev into master #678

Merged
merged 33 commits into from
May 31, 2023
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3831890
Merge pull request #646 from Louisvdw/master
mr-manuel May 16, 2023
2f6ea71
Changes 2023.05.18 (#649)
mr-manuel May 18, 2023
3c21953
Limit control voltage to max cell voltage
ogurevich May 20, 2023
c0056c6
Limit dynamic CVL to max charge voltage
mr-manuel May 20, 2023
3811281
Rework serial parser (#12)
transistorgit May 21, 2023
361146e
Merge branch 'Louisvdw:dev' into dev
mr-manuel May 21, 2023
a69118e
updated changelog
mr-manuel May 21, 2023
96d7c38
fix black lint error
mr-manuel May 21, 2023
f7d7621
fixed black lint error
mr-manuel May 21, 2023
e17ebab
added infos to battery template
mr-manuel May 22, 2023
bb93ee3
JDB BLE support (#499)
idstein May 23, 2023
cffd869
Merge branch 'Louisvdw:dev' into dev
mr-manuel May 23, 2023
a0a5ebf
updated changelog
mr-manuel May 23, 2023
5aa6163
Optimized Daly driver
mr-manuel May 23, 2023
f19e004
Add Supoprt for HeltecSmartBMS (YYBMS) using modbus via RS485 connect…
ramack May 24, 2023
fc95f6b
Changes 2023.05.24 (#667)
mr-manuel May 24, 2023
886005d
fix Jkbms_Ble error
mr-manuel May 25, 2023
81ddf57
updated changelog
mr-manuel May 25, 2023
8151719
Merge pull request #668 from mr-manuel/dev
mr-manuel May 25, 2023
94ece81
updated readme and added donation link
mr-manuel May 26, 2023
72ffaae
Merge branch 'dev' of https://github.com/mr-manuel/venus-os_dbus-seri…
mr-manuel May 26, 2023
02d4d9c
bugfix: Heltec BMS test_connection breaks on other modbus compliant B…
May 26, 2023
d899504
bugfix: LLTJBD BMS ignore non ASCII letters for hardware version
May 26, 2023
97d2c70
updated readme
mr-manuel May 26, 2023
51c2786
Merge pull request #673 from idstein/bugfix/lltjbd-decode-name
mr-manuel May 26, 2023
b11ef67
Merge pull request #672 from idstein/bugfix/heltec-bms-test-connection
mr-manuel May 26, 2023
cece2d1
Suppress daly read errors (#13)
transistorgit May 26, 2023
2a31994
Merge branch 'Louisvdw:dev' into dev
mr-manuel May 26, 2023
4923329
updated descriptions
mr-manuel May 26, 2023
262a200
Changed logging level and give better feedback
mr-manuel May 26, 2023
8f0d676
small fixes
mr-manuel May 26, 2023
ca4e3ee
Merge pull request #677 from mr-manuel/dev
mr-manuel May 31, 2023
2ad0e7c
Merge branch 'master' into dev
mr-manuel May 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
JDB BLE support (#499)
* Implementing JBD BLE support. It is built upon Bleak
* Additionally, it provides some handling of for up to 4 temperature probes labels T1 (NTC2), T2 (NTC3), T3 (NTC4) and T4 (NTC5). NTC1 is the BMS module temperature itself
* The device page has been extend to provide more details about the actual used hardware (= product name), firmware version and BLE address
idstein authored May 23, 2023

Verified

This commit was signed with the committer’s verified signature.
myii Imran Iqbal
commit bb93ee3269c2bb8e49a5d97f0cf67ec7b52dd482
104 changes: 81 additions & 23 deletions etc/dbus-serialbattery/battery.py
Original file line number Diff line number Diff line change
@@ -96,6 +96,8 @@ def init_values(self):
self.temp_sensors = None
self.temp1 = None
self.temp2 = None
self.temp3 = None
self.temp4 = None
self.temp_mos = None
self.cells: List[Cell] = []
self.control_charging = None
@@ -127,6 +129,15 @@ def test_connection(self) -> bool:
# return false when failed, true if successful
return False

def connection_name(self) -> str:
return "Serial " + self.port

def custom_name(self) -> str:
return "SerialBattery(" + self.type + ")"

def product_name(self) -> str:
return "SerialBattery(" + self.type + ")"

@abstractmethod
def get_settings(self) -> bool:
"""
@@ -164,6 +175,10 @@ def to_temp(self, sensor: int, value: float) -> None:
self.temp1 = min(max(value, -20), 100)
if sensor == 2:
self.temp2 = min(max(value, -20), 100)
if sensor == 3:
self.temp3 = min(max(value, -20), 100)
if sensor == 4:
self.temp4 = min(max(value, -20), 100)

def manage_charge_voltage(self) -> None:
"""
@@ -808,14 +823,10 @@ def get_balancing(self) -> int:
return 1
return 0

def extract_from_temp_values(self, extractor) -> Union[float, None]:
if self.temp1 is not None and self.temp2 is not None:
return extractor(self.temp1, self.temp2)
if self.temp1 is not None and self.temp2 is None:
return self.temp1
if self.temp1 is None and self.temp2 is not None:
return self.temp2
else:
def get_temperatures(self) -> Union[List[float], None]:
temperatures = [self.temp1, self.temp2, self.temp3, self.temp4]
result = [(t, i) for (t, i) in enumerate(temperatures) if t is not None]
if not result:
return None

def get_temp(self) -> Union[float, None]:
@@ -824,46 +835,93 @@ def get_temp(self) -> Union[float, None]:
return self.temp1
elif utils.TEMP_BATTERY == 2:
return self.temp2
elif utils.TEMP_BATTERY == 3:
return self.temp3
elif utils.TEMP_BATTERY == 4:
return self.temp4
else:
return self.extract_from_temp_values(
extractor=lambda temp1, temp2: round(
(float(temp1) + float(temp2)) / 2, 2
)
)
temps = [
t
for t in [self.temp1, self.temp2, self.temp3, self.temp4]
if t is not None
]
n = len(temps)
if not temps or n == 0:
return None
data = sorted(temps)
if n % 2 == 1:
return data[n // 2]
else:
i = n // 2
return (data[i - 1] + data[i]) / 2
except TypeError:
return None

def get_min_temp(self) -> Union[float, None]:
try:
return self.extract_from_temp_values(
extractor=lambda temp1, temp2: min(temp1, temp2)
)
temps = [
t
for t in [self.temp1, self.temp2, self.temp3, self.temp4]
if t is not None
]
if not temps:
return None
return min(temps)
except TypeError:
return None

def get_min_temp_id(self) -> Union[str, None]:
try:
if self.temp1 < self.temp2:
temps = [
(t, i)
for i, t in enumerate([self.temp1, self.temp2, self.temp3, self.temp4])
if t is not None
]
if not temps:
return None
index = min(temps)[1]
if index == 0:
return utils.TEMP_1_NAME
else:
if index == 1:
return utils.TEMP_2_NAME
if index == 2:
return utils.TEMP_3_NAME
if index == 3:
return utils.TEMP_4_NAME
except TypeError:
return None

def get_max_temp(self) -> Union[float, None]:
try:
return self.extract_from_temp_values(
extractor=lambda temp1, temp2: max(temp1, temp2)
)
temps = [
t
for t in [self.temp1, self.temp2, self.temp3, self.temp4]
if t is not None
]
if not temps:
return None
return max(temps)
except TypeError:
return None

def get_max_temp_id(self) -> Union[str, None]:
try:
if self.temp1 > self.temp2:
temps = [
(t, i)
for i, t in enumerate([self.temp1, self.temp2, self.temp3, self.temp4])
if t is not None
]
if not temps:
return None
index = max(temps)[1]
if index == 0:
return utils.TEMP_1_NAME
else:
if index == 1:
return utils.TEMP_2_NAME
if index == 2:
return utils.TEMP_3_NAME
if index == 3:
return utils.TEMP_4_NAME
except TypeError:
return None

Loading