yaleman / pyaussiebb

Aussie Broadband API Python module
https://yaleman.github.io/aussiebb/
MIT License
13 stars 3 forks source link

Unexpected error fetching 897650 data: list index out of range #27

Closed robertfgoodworth closed 2 years ago

robertfgoodworth commented 2 years ago

Could someone have a look into this error please, started after HA upgrade, i'm on core Version core-2022.3.5 & Supervisor Version supervisor-2022.03.4.

Core Error Log:

2022-03-17 10:10:35 ERROR (MainThread) [homeassistant.components.aussie_broadband] Unexpected error fetching 897650 data: list index out of range Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/aussie_broadband/init.py", line 44, in async_update_data return await client.get_usage(service_id) File "/usr/local/lib/python3.9/site-packages/aussiebb/asyncio/init.py", line 323, in get_usage self.validate_service_type(service) File "/usr/local/lib/python3.9/site-packages/aussiebb/baseclass.py", line 100, in validate_service_type raise UnrecognisedServiceType(f"Service type {service['type']} not recognised - please raise an issue about this - https://github.com/yaleman/aussiebb/issues/new") aussiebb.exceptions.UnrecognisedServiceType: Service type FETCHTV not recognised - please raise an issue about this - https://github.com/yaleman/aussiebb/issues/new During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data return await self.update_method() File "/usr/src/homeassistant/homeassistant/components/aussie_broadband/init.py", line 47, in async_update_data f"Service {service_id} of type '{services[service_id]['type']}' was unrecognised" IndexError: list index out of range

yaleman commented 2 years ago

@robertfgoodworth the above commit fixes it, I'm going to push a PR through for @Bre77 to update Home Assistant. Thank you for your report!

yaleman commented 2 years ago

Actually it probably doesn't, having thought about it for more than 30 seconds 🤦🏻

@robertfgoodworth are you up for running a dev container with some test code for us to grab some details? It requires having docker and visual studio code... https://developers.home-assistant.io/docs/development_environment/#tasks

robertfgoodworth commented 2 years ago

Yeah sure, i'll start to get this setup, please send me the instructions.

robertfgoodworth commented 2 years ago

development Enviroment up and running as per "https://developers.home-assistant.io/docs/development_environment/#tasks" awaiting instructions.

yaleman commented 2 years ago

If you can please run the following commands

apt-get update
apt-get -y install build-essential cmake
git remote add yaleman https://github.com/yaleman/core.git
git fetch yaleman/patch-1
git pull
script/setup
tox -e py39 -- tests/components/aussie_broadband/ && hass -c config

this should install the required things and grab the patched version, run some tests and then start up HASS locally, on http://localhost:8123. Open the browser and just run through the basic set up.

It'll prompt you on the third screen to set up integrations, if you can try setting up the Aussie Broadband integration it should just work (he says, crossing his fingers)...

robertfgoodworth commented 2 years ago

I get the following error/

oot ➜ /workspaces/core (dev) $ git fetch yaleman/patch-1 fatal: 'yaleman/patch-1' does not appear to be a git repository fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

yaleman commented 2 years ago

Sorry, I seem to have messed up a step - adjusted the fetch/checkout ones:

apt-get update
apt-get -y install build-essential cmake
git remote add yaleman https://github.com/yaleman/core.git
git fetch yaleman
git checkout yaleman/patch-1
git pull
script/setup
tox -e py39 -- tests/components/aussie_broadband/ && hass -c config
robertfgoodworth commented 2 years ago

Hi yaleman, got the following error while setting up the aussie_broadband intergration.

2022-03-18 04:23:10 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration aussie_broadband: No module named 'pydantic'

robertfgoodworth commented 2 years ago

I've installed the missing module, giving this another go.

robertfgoodworth commented 2 years ago

Success, all seems to be working. image

robertfgoodworth commented 2 years ago

THANKS yaleman, is this going to be an update soon?

robertfgoodworth commented 2 years ago

Logs with in the HA Dev terminal: 2022-03-18 04:47:00 INFO (MainThread) [homeassistant.setup] Setting up aussie_broadband 2022-03-18 04:47:00 INFO (MainThread) [homeassistant.setup] Setup of domain aussie_broadband took 0.0 seconds 2022-03-18 04:47:01 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.aussie_broadband 2022-03-18 04:47:01 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.aussie_broadband entity: sensor.nbn_data_used 2022-03-18 04:47:01 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.aussie_broadband entity: sensor.nbn_downloaded 2022-03-18 04:47:01 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.aussie_broadband entity: sensor.nbn_uploaded 2022-03-18 04:47:01 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.aussie_broadband entity: sensor.nbn_billing_cycle_length 2022-03-18 04:47:01 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.aussie_broadband entity: sensor.nbn_billing_cycle_remaining

yaleman commented 2 years ago

Sweet! Sorry about the hassle, I've not done much with HASS before. Yep, there's an approved PR in for the update which should fix things