From 29335dd7eab0da33c0299008da0f5f1e69602827 Mon Sep 17 00:00:00 2001
From: Trefor Southwell <48591903+springfall2008@users.noreply.github.com>
Date: Sat, 13 Jan 2024 14:00:58 +0000
Subject: [PATCH 1/4] Change default metric battery cycle to 1.0
---
apps/predbat/predbat.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/apps/predbat/predbat.py b/apps/predbat/predbat.py
index ff0e3720a..e26de8b59 100644
--- a/apps/predbat/predbat.py
+++ b/apps/predbat/predbat.py
@@ -18,7 +18,7 @@
import os
import yaml
-THIS_VERSION = "v7.14.39"
+THIS_VERSION = "v7.14.40"
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"
@@ -272,7 +272,7 @@
"unit": "p/kWh",
"icon": "mdi:currency-usd",
"enable": "expert_mode",
- "default": 2.0,
+ "default": 1.0,
},
{
"name": "metric_battery_value_scaling",
@@ -8855,7 +8855,7 @@ def execute_plan(self):
if (self.minutes_now < minutes_end) and (
(minutes_start - self.minutes_now) <= self.set_window_minutes or (inverter.charge_start_time_minutes - self.minutes_now) <= self.set_window_minutes
):
- if ((minutes_start - self.minutes_now) > self.set_window_minutes) and (minutes_end - self.minutes_now) >= 24 * 60:
+ if ((minutes_start - self.minutes_now) > self.set_window_minutes) and (minutes_end - self.minutes_now) >= 24*60:
self.log("Charge window would wrap, disabling until later")
inverter.disable_charge_window()
else:
@@ -10177,7 +10177,7 @@ def save_settings(self):
basename = "/predbat_restore_settings.yaml"
filename = None
text = ""
- text += 'alias: "Restore Predbat settings from {}"\n'.format(self.time_abs_str(self.minutes_now))
+ text += "alias: \"Restore Predbat settings from {}\"\n".format(self.time_abs_str(self.minutes_now))
text += "mode: single\n"
text += "trigger: []\n"
text += "condition: []\n"
@@ -10198,7 +10198,7 @@ def save_settings(self):
enable = item.get("enable", None)
if entity == "select.predbat_update":
- # Do not restore predbat version
+ # Do not restore predbat version
continue
if enable == try_enable and self.user_config_item_enabled(item):
@@ -10223,7 +10223,7 @@ def save_settings(self):
text += " target:\n"
text += " entity_id: {}\n".format(entity)
text += " data:\n"
- text += ' option: "{}"\n'.format(value)
+ text += " option: \"{}\"\n".format(value)
with open(filename, "w") as file:
file.write(text)
self.log("Wrote settings to {}".format(filename))
From a21b8c6c0a0012998bed36ec1225f244b399d017 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci-lite[bot]"
<117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Date: Sat, 13 Jan 2024 14:02:22 +0000
Subject: [PATCH 2/4] [pre-commit.ci lite] apply automatic fixes
---
apps/predbat/predbat.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/apps/predbat/predbat.py b/apps/predbat/predbat.py
index e26de8b59..39c20db4e 100644
--- a/apps/predbat/predbat.py
+++ b/apps/predbat/predbat.py
@@ -8855,7 +8855,7 @@ def execute_plan(self):
if (self.minutes_now < minutes_end) and (
(minutes_start - self.minutes_now) <= self.set_window_minutes or (inverter.charge_start_time_minutes - self.minutes_now) <= self.set_window_minutes
):
- if ((minutes_start - self.minutes_now) > self.set_window_minutes) and (minutes_end - self.minutes_now) >= 24*60:
+ if ((minutes_start - self.minutes_now) > self.set_window_minutes) and (minutes_end - self.minutes_now) >= 24 * 60:
self.log("Charge window would wrap, disabling until later")
inverter.disable_charge_window()
else:
@@ -10177,7 +10177,7 @@ def save_settings(self):
basename = "/predbat_restore_settings.yaml"
filename = None
text = ""
- text += "alias: \"Restore Predbat settings from {}\"\n".format(self.time_abs_str(self.minutes_now))
+ text += 'alias: "Restore Predbat settings from {}"\n'.format(self.time_abs_str(self.minutes_now))
text += "mode: single\n"
text += "trigger: []\n"
text += "condition: []\n"
@@ -10198,7 +10198,7 @@ def save_settings(self):
enable = item.get("enable", None)
if entity == "select.predbat_update":
- # Do not restore predbat version
+ # Do not restore predbat version
continue
if enable == try_enable and self.user_config_item_enabled(item):
@@ -10223,7 +10223,7 @@ def save_settings(self):
text += " target:\n"
text += " entity_id: {}\n".format(entity)
text += " data:\n"
- text += " option: \"{}\"\n".format(value)
+ text += ' option: "{}"\n'.format(value)
with open(filename, "w") as file:
file.write(text)
self.log("Wrote settings to {}".format(filename))
From 0d4a991ea2c547c94e4e00196f36ec61f8732781 Mon Sep 17 00:00:00 2001
From: Trefor Southwell <48591903+springfall2008@users.noreply.github.com>
Date: Sat, 13 Jan 2024 14:03:10 +0000
Subject: [PATCH 3/4] Update customisation.md
---
docs/customisation.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/customisation.md b/docs/customisation.md
index 917132f3b..52a57159e 100644
--- a/docs/customisation.md
+++ b/docs/customisation.md
@@ -82,7 +82,7 @@ you have inverter losses as it's AC coupled battery.
**input_number.metric_battery_cycle** (_expert mode_) Sets the cost in pence per kWh of using your battery for charging and discharging.
Higher numbers will reduce battery cycles at the expense of using higher energy costs.
-Figures of around 1p-5p are recommended, the default is 2p.
+Figures of around 1p-5p are recommended, the default is 1p per kWh.
**input_number.predbat_metric_battery_value_scaling** (_expert mode_) Can be used to scale the value of the energy
in the battery at the end of the plan. The battery value is accounted for in the optimisations at the lowest future
From 037cfd2b8e3e7cc4a694ab16b79a507a73ccbb04 Mon Sep 17 00:00:00 2001
From: Trefor Southwell <48591903+springfall2008@users.noreply.github.com>
Date: Sat, 13 Jan 2024 14:03:31 +0000
Subject: [PATCH 4/4] Update configuration-guide.md
---
docs/configuration-guide.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/configuration-guide.md b/docs/configuration-guide.md
index e1a1b4ce1..d7e818a3a 100644
--- a/docs/configuration-guide.md
+++ b/docs/configuration-guide.md
@@ -16,7 +16,7 @@ Also set **switch.inverter_hybrid** to True or False depending upon if you have
The setting **input_number.metric_battery_cycle** (_expert mode_) can be used to put a 'virtual cost' in pence on using your battery for charging and discharging.
In theory if you think your battery will last say 6000 complete cycles and cost you £4000 and is 9.5kWh then each cycle is 19kWh and so the cost per cycle is £4000 / 19 / 6000 = 3.5p.
If you configure this number higher then more expensive plans will be selected which avoids charging and discharging your battery as much.
-The default is 2p but can be set to 0 if you want to turn this feature off.
+The default is 1p but can be set to 0 if you want to turn this feature off.
Note that the cycle cost will not be included in the cost predictions that Predbat produces, its just taken into account in the planning stage.
_NB: Setting this to a non-zero value will increase your daily cost, but will reduce your home battery usage._