Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
Fix missing step to factor in inefficiency within the battery
  • Loading branch information
hif2k1 authored Nov 29, 2022
1 parent cc29f95 commit 830935e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/battery_sim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def updateBattery(self, import_amount, export_amount):
self._charging = False
self._sensors[BATTERY_MODE] = MODE_DISCHARGING

self._charge_state = float(self._charge_state) + amount_to_charge - amount_to_discharge
self._charge_state = float(self._charge_state) + amount_to_charge - (amount_to_discharge/float(self._battery_efficiency))

self._sensors[ATTR_ENERGY_SAVED] += amount_to_discharge
self._sensors[GRID_IMPORT_SIM] += net_import
Expand Down

0 comments on commit 830935e

Please sign in to comment.