question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

list index out of range error

See original GitHub issue

Describe the bug

2021-10-26 14:31:07 ERROR (MainThread) [custom_components.hildebrandglow_dcc.sensor] Key Error - plan (list index out of range): ({'status': 'OK', 'name': 'gas consumption', 're
sourceTypeId': '08ab415f-d851-423f-adf4-c2b1e0529e27', 'resourceId': 'b1f5af6e-3507-453c-ab8f-66ff9606b7de', 'data': [], 'classifier': 'gas.consumption'})
2021-10-26 14:31:08 ERROR (MainThread) [custom_components.hildebrandglow_dcc.sensor] Lookup Error - plan (list index out of range): ({'status': 'OK', 'name': 'gas consumption',
'resourceTypeId': '08ab415f-d851-423f-adf4-c2b1e0529e27', 'resourceId': 'b1f5af6e-3507-453c-ab8f-66ff9606b7de', 'data': [], 'classifier': 'gas.consumption'})

To Reproduce only added in my bright iOS details (im a british gas customer with a smart elec/gas/monitor all DCC with no glow hub)

Expected behaviour not sure?

Screenshots If applicable, add screenshots to help explain your problem.

Version LATEST - v0.5.0 and HA core-2021.10.6

Debug log Enable debug logging by following the instructions here TO FOLLOW

Additional context i think this error is because british gas have goofed up my gas tariff, so its showing in HA AND the bright iOS app as NO TRARIFF and its not calculating the cost either

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:27 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ColinRobbinscommented, Oct 26, 2021

That is what I’d expect.

UPDATED

“Unavailable” while it is in a boot up phase. It can be several minutes before it tries to collect data. (Or the sensor / code has been removed)

“Unknown” it has tried to get the data, but there is nothing there.

1reaction
ColinRobbinscommented, Oct 26, 2021

@townsmcp I’ve had a go at changing the error handling, so it only reports “no data” once. HOWEVER, as I have data, I am unable to test it!

Would you be able to replace your "custom_components/hildebrandglow_dcc/sensor.py with sensor.py and try it?

The expected behaviour is you will see the error reported only once.

@si458 rather than report a 0, it should report the sensor is unavailable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

List Index Out of Range – Python Error Message Solved
You'll get the Indexerror: list index out of range error when iterating through a list and trying to access an item that doesn't...
Read more >
Python IndexError: List Index Out of Range Error Explained
We can break down the text a little bit. We can see here that the message tells us that the index is out...
Read more >
Python IndexError: List Index Out of Range [Easy Fix] - Finxter
The error “list index out of range” arises if you access invalid indices in your Python list. For example, if you try to...
Read more >
Indexerror: list Index Out of Range in Python - STechies
In the above case, the error occurs inline 5, as shown in output where print(list_fruits[i]) means that the value of “i” exceeds the...
Read more >
Index Error: list index out of range (Python) - Stack Overflow
Generally it means that you are providing an index for which a list element does not exist. E.g, if your list was [1,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found