From 8cf4e0ebfa856a0b3ed12d66b35f78b2a67cd312 Mon Sep 17 00:00:00 2001
From: Trefor Southwell <48591903+springfall2008@users.noreply.github.com>
Date: Mon, 11 Dec 2023 11:23:06 +0000
Subject: [PATCH 1/6] Add calculate fast plan toggle
---
apps/predbat/predbat.py | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/apps/predbat/predbat.py b/apps/predbat/predbat.py
index 18f11d7f..7a3022da 100644
--- a/apps/predbat/predbat.py
+++ b/apps/predbat/predbat.py
@@ -16,7 +16,7 @@
import appdaemon.plugins.hass.hassapi as hass
import adbase as ad
-THIS_VERSION = "v7.14.7"
+THIS_VERSION = "v7.14.8"
TIME_FORMAT = "%Y-%m-%dT%H:%M:%S%z"
TIME_FORMAT_SECONDS = "%Y-%m-%dT%H:%M:%S.%f%z"
TIME_FORMAT_OCTOPUS = "%Y-%m-%d %H:%M:%S%z"
@@ -343,8 +343,9 @@
{"name": "car_charging_plan_smart", "friendly_name": "Car Charging Plan Smart", "type": "switch", "default": False},
{"name": "car_charging_from_battery", "friendly_name": "Allow car to charge from battery", "type": "switch", "default": False},
{"name": "calculate_discharge_oncharge", "friendly_name": "Calculate Discharge on charge slots", "type": "switch", "enable": "expert_mode", "default": True},
+ {"name": "calculate_fast_plan", "friendly_name": "Calculate plan faster (less accurate)", "type": "switch", "enable": "expert_mode", "default": True},
{"name": "calculate_second_pass", "friendly_name": "Calculate full second pass (slower)", "type": "switch", "enable": "expert_mode", "default": False},
- {"name": "calculate_tweak_plan", "friendly_name": "Calculate tweak second pass (faster)", "type": "switch", "enable": "expert_mode", "default": False},
+ {"name": "calculate_tweak_plan", "friendly_name": "Calculate tweak second pass", "type": "switch", "enable": "expert_mode", "default": False},
{"name": "calculate_inday_adjustment", "friendly_name": "Calculate in-day adjustment", "type": "switch", "enable": "expert_mode", "default": True},
{
"name": "calculate_plan_every",
@@ -5469,6 +5470,7 @@ def publish_html_plan(self, pv_forecast_minute_step, load_minutes_step, end_reco
if self.set_charge_freeze and (limit == self.reserve):
state = "FreezeChrg→"
state_color = "#EEEEEE"
+ limit = soc_percent
elif limit_percent == soc_percent_min:
state = "HoldChrg→"
state_color = "#34dbeb"
@@ -5568,7 +5570,10 @@ def publish_html_plan(self, pv_forecast_minute_step, load_minutes_step, end_reco
html += "
" + state + " | "
elif not in_span:
html += "" + state + " | "
- html += " " + show_limit + " | "
+ if start_span:
+ html += " " + show_limit + " | "
+ elif not in_span:
+ html += " " + show_limit + " | "
html += "" + str(pv_forecast) + pv_symbol + " | "
html += "" + str(load_forecast) + " | "
if self.num_cars > 0: # Don't display car charging data if there's no car
@@ -8891,8 +8896,13 @@ def fetch_config_options(self):
self.debug_enable = self.get_arg("debug_enable")
self.previous_status = self.get_state(self.prefix + ".status")
forecast_hours = self.get_arg("forecast_hours", 48)
+ self.calculate_fast_plan = self.get_arg("calculate_fast_plan")
+
+ if self.calculate_fast_plan:
+ self.calculate_max_windows = max(int(forecast_hours * 2), 24)
+ else:
+ self.calculate_max_windows = max(int(forecast_hours), 12)
- self.calculate_max_windows = max(int(forecast_hours), 24)
self.num_cars = self.get_arg("num_cars", 1)
self.inverter_type = self.get_arg("inverter_type", "GE", indirect=False)
self.calculate_plan_every = max(self.get_arg("calculate_plan_every"), 5)
From 8a89b08565b8f2184e725e8ecbc33c51dcb6b739 Mon Sep 17 00:00:00 2001
From: Trefor Southwell <48591903+springfall2008@users.noreply.github.com>
Date: Mon, 11 Dec 2023 11:26:25 +0000
Subject: [PATCH 2/6] Freezecharge reporting on html to show SOC of hold
---
apps/predbat/predbat.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/apps/predbat/predbat.py b/apps/predbat/predbat.py
index 7a3022da..52f7604b 100644
--- a/apps/predbat/predbat.py
+++ b/apps/predbat/predbat.py
@@ -5470,7 +5470,7 @@ def publish_html_plan(self, pv_forecast_minute_step, load_minutes_step, end_reco
if self.set_charge_freeze and (limit == self.reserve):
state = "FreezeChrg→"
state_color = "#EEEEEE"
- limit = soc_percent
+ limit_percent = soc_percent
elif limit_percent == soc_percent_min:
state = "HoldChrg→"
state_color = "#34dbeb"
From ef0b31c2cfbcc6151945aca753050ce07f53515f Mon Sep 17 00:00:00 2001
From: Trefor Southwell <48591903+springfall2008@users.noreply.github.com>
Date: Mon, 11 Dec 2023 11:28:50 +0000
Subject: [PATCH 3/6] Update customisation.md
---
docs/customisation.md | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/docs/customisation.md b/docs/customisation.md
index de0fa681..d2eb381a 100644
--- a/docs/customisation.md
+++ b/docs/customisation.md
@@ -62,9 +62,12 @@ especially on more complex tariffs like Agile when run on lower power machines s
You can tweak **input_number.predbat_calculate_plan_every** (_expert mode_) to reduce the frequency of replanning while
keeping the inverter control in the 5 minute slots. E.g. a value of 10 or 15 minutes should also give good results.
-If you have performance problems leave **switch.predbat_calculate_second_pass** (_expert mode_) turned off as it's
+If you have performance problems leave **switch.predbat_calculate_second_pass** (_expert mode_) turned Off as it's
quite CPU intensive and provides very little improvement for most systems.
+If you have performance problems leave **switch.predbat_calculate_fast_plan** (_expert mode_) turned On to help
+reduce your CPU load.
+
## Battery loss options
**input_number.battery_loss** accounts for energy lost charging the battery, default 0.05 is 5%
@@ -151,6 +154,11 @@ if **car_charging_planned** is set correctly in apps.yaml to detect your car bei
See the Predbat mode setting as above for basic calculation options
+**switch.predbat_calculate_fast_plan** (_expert mode_) When True (default) the plan is calculated with a limited number of
+windows to make calculations faster. When False all windows are considered but planning will take a little longer but be
+more accurate. The end result is unlikely to change in fast mode as the next windows are always considered but the longer
+term plan will be last accurate.
+
**switch.predbat_calculate_discharge_oncharge** (_expert mode_) When True calculated discharge slots will
disable or move charge slots, allowing them to intermix. When False discharge slots will never be placed into charge slots.
From f4aa0ef908e8f2f4d3e2232dfda09ad49d984cdf Mon Sep 17 00:00:00 2001
From: "pre-commit-ci-lite[bot]"
<117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Date: Mon, 11 Dec 2023 11:31:08 +0000
Subject: [PATCH 4/6] [pre-commit.ci lite] apply automatic fixes
---
apps/predbat/predbat.py | 4 ++--
docs/customisation.md | 4 ++--
templates/appdaemon.yaml | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/apps/predbat/predbat.py b/apps/predbat/predbat.py
index 52f7604b..a5e664e2 100644
--- a/apps/predbat/predbat.py
+++ b/apps/predbat/predbat.py
@@ -343,9 +343,9 @@
{"name": "car_charging_plan_smart", "friendly_name": "Car Charging Plan Smart", "type": "switch", "default": False},
{"name": "car_charging_from_battery", "friendly_name": "Allow car to charge from battery", "type": "switch", "default": False},
{"name": "calculate_discharge_oncharge", "friendly_name": "Calculate Discharge on charge slots", "type": "switch", "enable": "expert_mode", "default": True},
- {"name": "calculate_fast_plan", "friendly_name": "Calculate plan faster (less accurate)", "type": "switch", "enable": "expert_mode", "default": True},
+ {"name": "calculate_fast_plan", "friendly_name": "Calculate plan faster (less accurate)", "type": "switch", "enable": "expert_mode", "default": True},
{"name": "calculate_second_pass", "friendly_name": "Calculate full second pass (slower)", "type": "switch", "enable": "expert_mode", "default": False},
- {"name": "calculate_tweak_plan", "friendly_name": "Calculate tweak second pass", "type": "switch", "enable": "expert_mode", "default": False},
+ {"name": "calculate_tweak_plan", "friendly_name": "Calculate tweak second pass", "type": "switch", "enable": "expert_mode", "default": False},
{"name": "calculate_inday_adjustment", "friendly_name": "Calculate in-day adjustment", "type": "switch", "enable": "expert_mode", "default": True},
{
"name": "calculate_plan_every",
diff --git a/docs/customisation.md b/docs/customisation.md
index d2eb381a..bb33f7f2 100644
--- a/docs/customisation.md
+++ b/docs/customisation.md
@@ -65,7 +65,7 @@ keeping the inverter control in the 5 minute slots. E.g. a value of 10 or 15 min
If you have performance problems leave **switch.predbat_calculate_second_pass** (_expert mode_) turned Off as it's
quite CPU intensive and provides very little improvement for most systems.
-If you have performance problems leave **switch.predbat_calculate_fast_plan** (_expert mode_) turned On to help
+If you have performance problems leave **switch.predbat_calculate_fast_plan** (_expert mode_) turned On to help
reduce your CPU load.
## Battery loss options
@@ -155,7 +155,7 @@ if **car_charging_planned** is set correctly in apps.yaml to detect your car bei
See the Predbat mode setting as above for basic calculation options
**switch.predbat_calculate_fast_plan** (_expert mode_) When True (default) the plan is calculated with a limited number of
-windows to make calculations faster. When False all windows are considered but planning will take a little longer but be
+windows to make calculations faster. When False all windows are considered but planning will take a little longer but be
more accurate. The end result is unlikely to change in fast mode as the next windows are always considered but the longer
term plan will be last accurate.
diff --git a/templates/appdaemon.yaml b/templates/appdaemon.yaml
index f8e3d554..3ff5b1a0 100644
--- a/templates/appdaemon.yaml
+++ b/templates/appdaemon.yaml
@@ -15,6 +15,6 @@ admin:
api:
hadashboard:
logs:
- main_log:
+ main_log:
filename: /homeassistant/appdaemon/appdaemon.log
- log_size: 10000000
\ No newline at end of file
+ log_size: 10000000
From 7e8c7c739d22057396ccf2c1e95238e1a64399ee Mon Sep 17 00:00:00 2001
From: Trefor Southwell <48591903+springfall2008@users.noreply.github.com>
Date: Mon, 11 Dec 2023 11:38:08 +0000
Subject: [PATCH 5/6] Update install.md - appdaemon info
---
docs/install.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/docs/install.md b/docs/install.md
index 52c8d560..297d5410 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -14,7 +14,8 @@ The Integration that communicates with your inverter will be depend on the brand
## AppDaemon install
- Install the AppDaemon add-on [https://github.com/hassio-addons/addon-appdaemon](https://github.com/hassio-addons/addon-appdaemon)
-- You will find the appdaemon.yaml file in addon_configs/a0d7b954_appdaemon
+- You will find the appdaemon.yaml file in addon_configs/a0d7b954_appdaemon ![image](https://github.com/springfall2008/batpred/assets/48591903/bf8bf9cf-75b1-4a8d-a1c5-fbb7b3b17521)
+ - If using the File Editor remember to turn off **enforce base path** to allow access: ![image](https://github.com/springfall2008/batpred/assets/48591903/298c7a19-3be9-43d6-9f1b-b46467701ca7)
- Add to the appdaemon: section **apps_dir** which should point to /homeassistant/appdaemon/apps
- Set the **time_zone** correctly in appdaemon.yaml (e.g. Europe/London)
- Add **thread_duration_warning_threshold: 120** to the appdaemon.yaml file in the appdaemon section
From 30f5c702c811d95a1db47130c4da4f0295d8d690 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci-lite[bot]"
<117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Date: Mon, 11 Dec 2023 11:38:54 +0000
Subject: [PATCH 6/6] [pre-commit.ci lite] apply automatic fixes
---
docs/install.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/install.md b/docs/install.md
index 297d5410..575e1af7 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -15,7 +15,7 @@ The Integration that communicates with your inverter will be depend on the brand
- Install the AppDaemon add-on [https://github.com/hassio-addons/addon-appdaemon](https://github.com/hassio-addons/addon-appdaemon)
- You will find the appdaemon.yaml file in addon_configs/a0d7b954_appdaemon ![image](https://github.com/springfall2008/batpred/assets/48591903/bf8bf9cf-75b1-4a8d-a1c5-fbb7b3b17521)
- - If using the File Editor remember to turn off **enforce base path** to allow access: ![image](https://github.com/springfall2008/batpred/assets/48591903/298c7a19-3be9-43d6-9f1b-b46467701ca7)
+ - If using the File Editor remember to turn off **enforce base path** to allow access: ![image](https://github.com/springfall2008/batpred/assets/48591903/298c7a19-3be9-43d6-9f1b-b46467701ca7)
- Add to the appdaemon: section **apps_dir** which should point to /homeassistant/appdaemon/apps
- Set the **time_zone** correctly in appdaemon.yaml (e.g. Europe/London)
- Add **thread_duration_warning_threshold: 120** to the appdaemon.yaml file in the appdaemon section