Skip to content

Commit

Permalink
Fix power averaging
Browse files Browse the repository at this point in the history
  • Loading branch information
fboundy committed Apr 14, 2024
1 parent fadad4e commit cd26ddd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PV Opt: Home Assistant Solar/Battery Optimiser v3.14.1
# PV Opt: Home Assistant Solar/Battery Optimiser v3.14.2

Solar / Battery Charging Optimisation for Home Assistant. This appDaemon application attempts to optimise charging and discharging of a home solar/battery system to minimise cost electricity cost on a daily basis using freely available solar forecast data from SolCast. This is particularly beneficial for Octopus Agile but is also benefeficial for other time-of-use tariffs such as Octopus Flux or simple Economy 7.

Expand Down
3 changes: 2 additions & 1 deletion apps/pv_opt/pv_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from numpy import nan
import re

VERSION = "3.14.1"
VERSION = "3.14.2"

OCTOPUS_PRODUCT_URL = r"https://api.octopus.energy/v1/products/"

Expand Down Expand Up @@ -2273,6 +2273,7 @@ def _get_hass_power_from_daily_kwh(self, entity_id, start=None, end=None, days=N
df.index = pd.to_datetime(df.index)
x = df.diff().clip(0).fillna(0).cumsum() + df.iloc[0]
x.index = x.index.round("1s")
x = x[~x.index.duplicated()]
y = -pd.concat([x.resample("1s").interpolate().resample("30min").asfreq(), x.iloc[-1:]]).diff(-1)
dt = y.index.diff().total_seconds() / pd.Timedelta("60min").total_seconds() / 1000
df = y[1:-1] / dt[2:]
Expand Down

0 comments on commit cd26ddd

Please sign in to comment.