Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 17, 2025

Octopus Energy integration now supports multiple IOG-enrolled vehicles, but configuring octopus_intelligent_slot as a list caused AttributeError: 'list' object has no attribute 'lower'.

Changes

Config schema (config.py)

  • Changed octopus_intelligent_slot, octopus_ready_time, octopus_charge_limit from sensor to sensor|sensor_list with entries: "num_cars"

Fetch logic (fetch.py)

  • Normalize config to list format (handles both single value and list)
  • Loop through each car's sensor, merge all dispatches into octopus_slots
  • Extract vehicle metadata (battery size, charge rate, limits) per car
  • Populate car_charging_slots individually for each car

Safety check (ha.py)

  • Validate entity_id is not a list before calling .lower(), return clear error instead of crash

Testing (test_multi_car_iog.py)

  • Single car config (backward compatibility)
  • Multi-car dispatch merging
  • Partial configuration (empty/None slots)

Example

Single car (existing):

octopus_intelligent_slot: 'binary_sensor.octopus_energy_intelligent_dispatching'

Multiple cars (new):

octopus_intelligent_slot:
  - 'binary_sensor.octopus_energy_intelligent_dispatching_car1'
  - 'binary_sensor.octopus_energy_intelligent_dispatching_car2'
octopus_ready_time:
  - 'select.octopus_energy_intelligent_target_time_car1'
  - 'select.octopus_energy_intelligent_target_time_car2'
octopus_charge_limit:
  - 'number.octopus_energy_intelligent_charge_target_car1'
  - 'number.octopus_energy_intelligent_charge_target_car2'

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.octopus.energy
    • Triggering command: /home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --quick (dns block)
  • gitlab.com
    • Triggering command: /usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>IOG - Multiple Car Support</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.
Recently Octopus started allowing you to enroll multiple cars for IOG, the latest beta versions of BottlecapDave's Octopus integration supports this, by creating the set of intelligent dispatching, target time, and charge limit for each vehicle.

Attempting to configure the current IOG settings in predbat as a list does not appear to work for octopus_intelligent_slot resulting in an error when trying to run the plan:

2025-09-27 12:56:44.228459: Error: Exception raised 'list' object has no attribute 'lower'
2025-09-27 12:56:44.230799: Error: Traceback (most recent call last):
  File "/config/predbat.py", line 1434, in update_time_loop
    self.update_pred(scheduled=False)
  File "/config/predbat.py", line 682, in update_pred
    self.fetch_sensor_data()
  File "/config/fetch.py", line 1107, in fetch_sensor_data
    completed = self.get_state_wrapper(entity_id=entity_id, attribute="completedDispatches") or self.get_state_wrapper(entity_id=entity_id, attribute="completed_dispatches")
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/predbat.py", line 274, in get_state_wrapper
    state = self.ha_interface.get_state(entity_id=entity_id, default=default, attribute=attribute, refresh=refresh)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/ha.py", line 339, in get_state
    self.db_mirror_list[entity_id.lower()] = True
                        ^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'lower'
2025-09-27 12:56:44.248724: Info: record_status Error: Exception raised 'list' object has no attribute 'lower'
2025-09-27 12:56:44.248868: Error: 'list' object has no attribute 'lower'

Describe the solution you'd like
Allow configuring all current octopus intelligent values as a list to support multiple vehicles

Describe alternatives you've considered
Considered using template helpers in hass to create single 'combined' entities for each of these, but that seems like a poor solution when it could be handled in predbat.

Currently I'm just changing my predbat config based on which car I have plugged in.

Additional context
I haven't tested this, but it seems there is no reason you couldn't have more than 1 IOG vehicle charging at the same time, potentially with different slots so all should probably be taken into account when running the plan.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix issue with multiple car support for IOG settings Support multiple Octopus Intelligent Go vehicles Dec 17, 2025
Copilot AI requested a review from springfall2008 December 17, 2025 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IOG - Multiple Car Support

2 participants