Skip to content

Commit

Permalink
Fix rate rounding issue with high threshold (#1894)
Browse files Browse the repository at this point in the history
* Fix rate rounding issue with high threshold

#1891

* [pre-commit.ci lite] apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
  • Loading branch information
springfall2008 and pre-commit-ci-lite[bot] authored Jan 22, 2025
1 parent b446348 commit 6d21f7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions apps/predbat/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,9 @@ def predict_battery_temperature(self, battery_temperature_history, step):
state=dp2(battery_temperature_history.get(0, 20)),
attributes={
"results": self.filtered_times(predict_timestamps),
"temperature_h1": battery_temperature_history.get(60, 20),
"temperature_h2": battery_temperature_history.get(60 * 2, 20),
"temperature_h8": battery_temperature_history.get(60 * 8, 20),
"friendly_name": "Battery temperature",
"state_class": "measurement",
"unit_of_measurement": "c",
Expand Down Expand Up @@ -1530,7 +1533,7 @@ def set_rate_thresholds(self):
else:
# In automatic mode select the only rate or everything but the most expensive
if (self.rate_max == self.rate_min) or (self.rate_export_max > self.rate_max):
self.rate_import_cost_threshold = self.rate_max
self.rate_import_cost_threshold = self.rate_max + 0.1
else:
self.rate_import_cost_threshold = self.rate_max - 0.5

Expand All @@ -1540,7 +1543,7 @@ def set_rate_thresholds(self):
else:
# In automatic mode select the only rate or everything but the most cheapest
if (self.rate_export_max == self.rate_export_min) or (self.rate_export_min > self.rate_min):
self.rate_export_cost_threshold = self.rate_export_min
self.rate_export_cost_threshold = self.rate_export_min - 0.1
else:
self.rate_export_cost_threshold = self.rate_export_min + 0.5

Expand Down
2 changes: 1 addition & 1 deletion apps/predbat/predbat.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import asyncio
import json

THIS_VERSION = "v8.11.3"
THIS_VERSION = "v8.11.4"

# fmt: off
PREDBAT_FILES = ["predbat.py", "config.py", "prediction.py", "gecloud.py","utils.py", "inverter.py", "ha.py", "download.py", "unit_test.py", "web.py", "predheat.py", "futurerate.py", "octopus.py", "solcast.py","execute.py", "plan.py", "fetch.py", "output.py", "userinterface.py"]
Expand Down

0 comments on commit 6d21f7a

Please sign in to comment.