Skip to content

Commit 1242d30

Browse files
committed
#296: Simplify charging detection logic to detect when the battery is balancing as well (here the power could be > 0)
1 parent b224a01 commit 1242d30

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/vehicle.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -778,12 +778,8 @@ def handle_charge_status(self, charge_info_resp: ChrgMgmtDataResp) -> None:
778778
round(power_usage_since_last_charge, 2)
779779
)
780780

781-
# We are charging if the charging gun is connected and we are feeding power into the battery
782-
self.is_charging = (
783-
charge_status.chargingGunState
784-
and is_valid_power
785-
and charge_mgmt_data.decoded_power < 0
786-
)
781+
# We are charging if the BMS tells us so
782+
self.is_charging = charge_mgmt_data.is_bms_charging
787783
self.publisher.publish_bool(
788784
self.get_topic(mqtt_topics.DRIVETRAIN_CHARGING),
789785
self.is_charging

0 commit comments

Comments
 (0)