Skip to content

Commit

Permalink
[pre-commit.ci lite] apply automatic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci-lite[bot] authored Dec 24, 2024
1 parent 3ae927a commit 8d124dd
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 151 deletions.
2 changes: 1 addition & 1 deletion apps/predbat/ha.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def update_state_item(self, item, entity_id, nodb=False):
entity_id = entity_id.lower()
attributes = item.get("attributes", {})
last_changed = item.get("last_changed", item.get("last_updated", None))
if 'state' in item:
if "state" in item:
state = item["state"]
self.state_data[entity_id] = {"state": state, "attributes": attributes, "last_changed": last_changed}
if not nodb and self.db_mirror_ha and (entity_id in self.db_mirror_list):
Expand Down
3 changes: 1 addition & 2 deletions apps/predbat/inverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ def create_entity(self, entity_name, value, uom=None, device_class="None"):
attributes["unit_of_measurement"] = uom
if device_class is not None:
attributes["device_class"] = device_class

self.created_attributes[entity_id] = attributes

if self.base.get_state_wrapper(entity_id) is None:
Expand Down Expand Up @@ -2228,7 +2228,6 @@ def rest_getData(self, url):
else:
return None


def rest_setChargeTarget(self, target):
"""
Configure charge target % via REST
Expand Down
7 changes: 2 additions & 5 deletions apps/predbat/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -1993,10 +1993,7 @@ def optimise_all_windows(self, best_metric, metric_keep, debug_mode=False):
record_charge_windows = max(self.max_charge_windows(self.end_record + self.minutes_now, self.charge_window_best), 1)
record_export_windows = max(self.max_charge_windows(self.end_record + self.minutes_now, self.export_window_best), 1)
window_sorted, window_index, price_set, price_links = self.sort_window_by_price_combined(
self.charge_window_best[:record_charge_windows],
self.export_window_best[:record_export_windows],
calculate_import_low_export=self.calculate_import_low_export,
calculate_export_high_import=self.calculate_export_high_import
self.charge_window_best[:record_charge_windows], self.export_window_best[:record_export_windows], calculate_import_low_export=self.calculate_import_low_export, calculate_export_high_import=self.calculate_export_high_import
)

self.rate_best_cost_threshold_charge = best_price
Expand Down Expand Up @@ -3178,7 +3175,7 @@ def plan_iboost_smart(self):

# Avoid duplicate slots
if minute in used_slots:
rate_okay = False
rate_okay = False

# Boost on import/export rate
if price > self.iboost_rate_threshold:
Expand Down
2 changes: 1 addition & 1 deletion apps/predbat/prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def run_prediction(self, charge_limit, charge_window, export_window, export_limi
else:
keep_minute_scaling = min(((minute - 4 * 60) / (2 * 60)), 1.0) * self.best_soc_keep_weight
else:
keep_minute_scaling = self.best_soc_keep_weight
keep_minute_scaling = self.best_soc_keep_weight

# Find charge & discharge windows
charge_window_n = charge_window_optimised.get(minute_absolute, -1)
Expand Down
Loading

0 comments on commit 8d124dd

Please sign in to comment.