Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error occurs when refreshing historic data #1185

Open
2 tasks done
RobWaterhouse95 opened this issue Jan 23, 2025 · 3 comments
Open
2 tasks done

Error occurs when refreshing historic data #1185

RobWaterhouse95 opened this issue Jan 23, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@RobWaterhouse95
Copy link

Describe the bug

When trying to re-populate some of my earliest months, which currently seem to be bugged. I am getting this error:

Image

Image

Image

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 764, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<9 lines>...
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 727, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2795, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2838, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1006, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
        hass, entity, func, data, call.context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1078, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/octopus_energy/gas/previous_accumulative_consumption_cubic_meters.py", line 182, in async_refresh_previous_consumption_data
    await async_refresh_previous_gas_consumption_data(
    ...<8 lines>...
    )
  File "/config/custom_components/octopus_energy/statistics/refresh.py", line 164, in async_refresh_previous_gas_consumption_data
    previous_m3_consumption_result =  await async_import_external_statistics_from_consumption(
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<9 lines>...
    )
    ^
  File "/config/custom_components/octopus_energy/statistics/consumption.py", line 104, in async_import_external_statistics_from_consumption
    return ImportConsumptionStatisticsResult(statistics[-1]["sum"] if statistics[-1] is not None else 0,
                                                                      ~~~~~~~~~~^^^^
IndexError: list index out of range```

### Reproduction steps

Refresh the Gas kWH entity

### Expected behaviour

The data is repopulated and no errors are thrown

### Tariff Code

G-1R-OE-FIX-12M-24-07-25-D

### Integration Version

13.5.4

### Home Assistant Version

Core 2025.1.3 Supervisor 2024.12.3 Operating System 14.1 Frontend 20250109.0

### Fresh Install?

Not specified

### Home Assistant Logs

File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 764, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<9 lines>...
)
^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 727, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2795, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2838, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1006, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
hass, entity, func, data, call.context
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1078, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/octopus_energy/gas/previous_accumulative_consumption_cubic_meters.py", line 182, in async_refresh_previous_consumption_data
await async_refresh_previous_gas_consumption_data(
...<8 lines>...
)
File "/config/custom_components/octopus_energy/statistics/refresh.py", line 164, in async_refresh_previous_gas_consumption_data
previous_m3_consumption_result = await async_import_external_statistics_from_consumption(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<9 lines>...
)
^
File "/config/custom_components/octopus_energy/statistics/consumption.py", line 104, in async_import_external_statistics_from_consumption
return ImportConsumptionStatisticsResult(statistics[-1]["sum"] if statistics[-1] is not None else 0,
~~~~~~~~~~^^^^
IndexError: list index out of range```

Confirmation

  • I confirm that I cannot find my solution within the documentation
  • I confirm that I cannot find my solution within the FAQ
@RobWaterhouse95 RobWaterhouse95 added the bug Something isn't working label Jan 23, 2025
@marksteward
Copy link

I'm also seeing this, on all dates. I've only just started using this integration, so I'm not sure if it's meant to work, as I don't have a home mini, and it looks from reading between the lines that that's not really supported?

@BottlecapDave
Copy link
Owner

Thanks for raising this and sorry that you've both encountered this. I'll try and fix it in the next release.

@RobWaterhouse95
Copy link
Author

Much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants