Skip to content

Commit

Permalink
feat(battery): track pending state of lynx parallel bms
Browse files Browse the repository at this point in the history
  • Loading branch information
mman committed Aug 15, 2024
1 parent 1cfc16d commit 9350ad3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app/Marine2/components/boxes/Battery/Battery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const Battery = ({ battery, unit }: Props) => {
<span className="pl-0.5 opacity-70">%</span>
</div>
<div className={classNames("text-victron-gray-300 dark:text-victron-gray-500", activeStyles.valueSubtitle)}>
<p>{batteryStateFor(battery.state, battery.timetogo ?? null)}</p>
<p>{batteryStateFor(battery.state, battery.bmsstate, battery.timetogo ?? null)}</p>
{battery.temperature && (
<p>
{temperatureValueFor(battery.temperature, temperatureUnit)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const BatteryValues: FC<Props> = ({ battery, boxSize }) => {
)}
</div>
<div className={classNames("text-victron-gray dark:text-victron-gray-dark", activeStyles.state)}>
{batteryStateFor(battery.state, battery.timetogo ?? null)}
{batteryStateFor(battery.state, battery.bmsstate, battery.timetogo ?? null)}
</div>
</div>
)
Expand Down
4 changes: 4 additions & 0 deletions src/app/Marine2/utils/constants/devices/batteries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ export const BATTERY = {
CHARGING: 1,
DISCHARGING: 2,
}

export const BMS = {
PENDING: 18,
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { translate } from "react-i18nify"
import { BATTERY } from "../../../constants/devices/batteries"
import { BATTERY, BMS } from "../../../constants/devices/batteries"
import { timeAsStringFormatter } from "../../generic"

export const batteryStateFor = (state: number, timetogo?: number): string | null => {
export const batteryStateFor = (state: number, bmsstate: number, timetogo?: number): string | null => {
if (bmsstate === BMS.PENDING) {
return translate("common.pending")
}
switch (state) {
case BATTERY.CHARGING:
return translate("common.charging")
Expand Down
1 change: 1 addition & 0 deletions src/app/locales/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"off": "Off",
"on": "On",
"passthru": "Passthru",
"pending": "Pending",
"powerSupplyMode": "Power supply mode",
"remainingTime": "Remaining time",
"running": "Running",
Expand Down

0 comments on commit 9350ad3

Please sign in to comment.