Skip to content

Commit

Permalink
Merge pull request #127 from fboundy/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
fboundy authored Feb 16, 2024
2 parents 35cb20a + 9b349ab commit e16d50c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 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.8.8
# PV Opt: Home Assistant Solar/Battery Optimiser v3.8.9

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
6 changes: 3 additions & 3 deletions apps/pv_opt/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ pv_opt:
# Octopus account parameters
# ========================================

# octopus_auto: False # Read tariffs from the Octopus Energy integration. If successful this over-rides the following parameters
octopus_auto: False # Read tariffs from the Octopus Energy integration. If successful this over-rides the following parameters

# octopus_account: !secret octopus_account
# octopus_api_key: !secret octopus_api_key
octopus_account: !secret octopus_account
octopus_api_key: !secret octopus_api_key

# The following Can be omitted if either of the above options is working correctly:

Expand Down
20 changes: 6 additions & 14 deletions apps/pv_opt/pv_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#
USE_TARIFF = True

VERSION = "3.8.8"
VERSION = "3.8.9"
DEBUG = False

DATE_TIME_FORMAT_LONG = "%Y-%m-%d %H:%M:%S%z"
Expand All @@ -30,7 +30,7 @@
REDACT_REGEX = [
"[0-9]{2}m[0-9]{7}_[0-9]{13}", # Serial_MPAN
"[0-9]{2}m[0-9]{7}", # Serial
"[0-9]{3}00[0-9]{8}", # MPAN
"^$|\d{13}$", # MPAN
"a_[0-f]{8}", # Account Number
"A-[0-f]{8}", # Account Number
"sk_live_[a-zA-Z0-9]{24}", # API
Expand Down Expand Up @@ -599,12 +599,8 @@ def _load_contract(self):
for entity in entities[imp_exp]:
tariff_code = self.get_state(
entity, attribute="all"
)["attributes"][BOTTLECAP_DAVE["tariff_code"]]
average_rate = self.get_state(
entity, attribute="all"
)["attributes"]["average_rate"]


)["attributes"].get(BOTTLECAP_DAVE["tariff_code"], None)

self.rlog(
f" Found {imp_exp} entity {entity}: Tariff code: {tariff_code} Average Rate: {average_rate} GBP/kWh"
)
Expand All @@ -613,14 +609,10 @@ def _load_contract(self):
for imp_exp in IMPEXP:
if len(entities[imp_exp]) > 0:
tariff_code = self.get_state(
entities[imp_exp][0], attribute="all"
)["attributes"][BOTTLECAP_DAVE["tariff_code"]]

average_rate = self.get_state(
entity, attribute="all"
)["attributes"]["average_rate"]
)["attributes"].get(BOTTLECAP_DAVE["tariff_code"], None)

if average_rate > 0:
if tariff_code is not None:
tariffs[imp_exp] = pv.Tariff(
tariff_code, export=(imp_exp == "export"), host=self
)
Expand Down

0 comments on commit e16d50c

Please sign in to comment.