Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions apps/predbat/kraken.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ async def async_fetch_rates(self):

def get_entity_name(self, root, suffix):
"""Construct entity name. Same pattern as OctopusAPI.get_entity_name."""
entity_name = root + ".predbat_kraken_" + self.account_id.replace("-", "_") + "_" + suffix
entity_name = root + "." + self.prefix + "_kraken_" + self.account_id.replace("-", "_") + "_" + suffix
return entity_name.lower()
Comment on lines 267 to 270
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes the published entity IDs depend on the configured prefix, but Components routes events using a hardcoded filter substring ("predbat_kraken_"). With a non-default prefix, select/number events for Kraken entities won’t reach KrakenAPI. Update event_filter to be prefix-aware (or keep backward-compatible naming) to avoid breaking custom-prefix setups.

Copilot uses AI. Check for mistakes.

async def async_fetch_standing_charges(self):
Expand Down Expand Up @@ -307,8 +307,7 @@ async def run(self, seconds, first):
- First run + every 10 min: fetch rates + standing charges from REST
- First run: wire into fetch.py via set_arg
"""
now = datetime.now()
count_minutes = now.minute + now.hour * 60
count_minutes = seconds // 60
had_success = False

# Tariff discovery — first run + every 30 minutes
Expand Down
4 changes: 2 additions & 2 deletions apps/predbat/octopus.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,9 +933,9 @@ def get_entity_name(self, root, suffix, index=""):
Get the entity name
"""
if index:
entity_name = root + ".predbat_octopus_" + self.account_id.replace("-", "_") + "_" + suffix + "_" + index
entity_name = root + "." + self.prefix + "_octopus_" + self.account_id.replace("-", "_") + "_" + suffix + "_" + index
else:
entity_name = root + ".predbat_octopus_" + self.account_id.replace("-", "_") + "_" + suffix
entity_name = root + "." + self.prefix + "_octopus_" + self.account_id.replace("-", "_") + "_" + suffix
Comment on lines 935 to +938
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing Octopus entity IDs to use self.prefix will break component event routing when prefix != "predbat": Components.select_event/number_event filters on the hardcoded substring "predbat_octopus_". With a custom prefix, UI events (select/number) for Octopus entities won’t be forwarded to OctopusAPI. Consider updating the event_filter logic to incorporate the configured prefix (or accept both legacy and prefixed forms for a migration period).

Copilot uses AI. Check for mistakes.
entity_name = entity_name.lower()
return entity_name

Expand Down
4 changes: 0 additions & 4 deletions apps/predbat/predbat.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@

THIS_VERSION = "v8.34.10"

# fmt: off
PREDBAT_FILES = ["predbat.py", "const.py", "hass.py", "config.py", "prediction.py", "gecloud.py", "utils.py", "inverter.py", "ha.py", "download.py", "web.py", "web_helper.py", "predheat.py", "futurerate.py", "octopus.py", "solcast.py", "execute.py", "plan.py", "fetch.py", "output.py", "userinterface.py", "energydataservice.py", "alertfeed.py", "compare.py", "db_manager.py", "db_engine.py", "plugin_system.py", "ohme.py", "components.py", "fox.py", "carbon.py", "temperature.py", "web_mcp.py", "component_base.py", "axle.py", "solax.py", "solis.py", "unit_test.py", "load_ml_component.py", "load_predictor.py", "oauth_mixin.py", "predbat_metrics.py", "web_metrics_dashboard.py"]
# fmt: on

from download import predbat_update_move, predbat_update_download, check_install
from const import MINUTE_WATT

Expand Down
Loading