Skip to content

Commit

Permalink
Bug Fix for Solax v24.03.x
Browse files Browse the repository at this point in the history
  • Loading branch information
fboundy committed Mar 20, 2024
1 parent 45a9456 commit eef6b15
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 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.11.0
# PV Opt: Home Assistant Solar/Battery Optimiser v3.11.1

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
1 change: 1 addition & 0 deletions apps/pv_opt/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pv_opt:

consumption_history_days: 7
read_only: false
debug: false

# ========================================
# Plant parameters
Expand Down
2 changes: 1 addition & 1 deletion apps/pv_opt/pv_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

USE_TARIFF = True

VERSION = "3.11.0"
VERSION = "3.11.1"
DEBUG = False

DATE_TIME_FORMAT_LONG = "%Y-%m-%d %H:%M:%S%z"
Expand Down
17 changes: 15 additions & 2 deletions apps/pv_opt/solis.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
"Self-Use - No Grid Charging": 1,
"Timed Charge/Discharge - No Grid Charging": 3,
"Backup/Reserve - No Grid Charging": 17,
"Self-Use": 33,
"SelfUse": 33,
"Self-Use - No Timed Charge/Discharge": 33,
"Self-Use": 35,
"Timed Charge/Discharge": 35,
"Off-Grid Mode": 37,
"Battery Awaken": 41,
Expand Down Expand Up @@ -426,10 +427,13 @@ def _solis_set_mode_switch(self, **kwargs):
status = self._solis_core_mode_switch()

switches = status["switches"]
if self.host.debug:
self.log(f">>> kwargs: {kwargs}")
self.log(">>> Solis switch status:")

for switch in switches:
if switch in kwargs:
if self.host.debug:
self.log("Solis switch status:")
self.log(f">>> {switch}: {kwargs[switch]}")
switches[switch] = kwargs[switch]

Expand All @@ -443,6 +447,12 @@ def _solis_set_mode_switch(self, **kwargs):
modes = {INVERTER_DEFS[self.type]["codes"].get(mode): mode for mode in entity_modes}
# mode = INVERTER_DEFS[self.type]["modes"].get(code)
mode = modes.get(code)
if self.host.debug:
self.log(f">>> Inverter Code: {code}")
self.log(f">>> Entity modes: {entity_modes}")
self.log(f">>> Modes: {modes}")
self.log(f">>> Inverter Mode: {mode}")

if mode is not None:
if self.host.get_state(entity_id=entity_id) != mode:
self.host.call_service("select/select_option", entity_id=entity_id, option=mode)
Expand All @@ -459,6 +469,9 @@ def _solis_solax_solarman_mode_switch(self):
else:
modes = INVERTER_DEFS[self.type]["modes"]
code = {modes[m]: m for m in modes}[inverter_mode]
if self.host.debug:
self.log(f">>> Inverter Mode: {inverter_mode}")
self.log(f">>> Inverter Code: {code}")

bits = INVERTER_DEFS[self.type]["bits"]
switches = {bit: (code & 2**i == 2**i) for i, bit in enumerate(bits)}
Expand Down

0 comments on commit eef6b15

Please sign in to comment.