Skip to content

Commit

Permalink
Negate charge diff to get discharge rate for efficiency
Browse files Browse the repository at this point in the history
  • Loading branch information
nshp committed Feb 13, 2024
1 parent 0f39046 commit 616dc22
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions custom_components/lucidmotors/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,10 @@ def _handle_coordinator_update(self) -> None:
# Convert kWh to Wh
charge_diff *= 1000.0

# What we're looking for is the rate of discharge, which is negative
# charge_diff.
charge_diff = -charge_diff

# HA doesn't have automatic unit conversion for Wh/mi type units, so
# we'll have to convert manually here to miles so us non-metric folks
# can survive.
Expand Down

0 comments on commit 616dc22

Please sign in to comment.