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

Multiple contracts #40

Open
m4h3 opened this issue Aug 13, 2023 · 1 comment
Open

Multiple contracts #40

m4h3 opened this issue Aug 13, 2023 · 1 comment

Comments

@m4h3
Copy link

m4h3 commented Aug 13, 2023

My veolia account has multiple contracts attached (I recently moved to a new house). For some reason, the default contract doesn't have any data, resulting in some error. Only my second contract do have some hourly telemetry data

It seems that the pyolia doesn't support switching/selecting contracts and defaults to the first one. I'll try to understand what needs to be done at the pyolia level to select the contractr and probably update the lib there first.

Reference of the backtrace

2023-08-13 10:39:39.707 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up veolia platform for sensor 
Traceback (most recent call last):                                                                                             
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 370, in _async_setup_platform                   
    await asyncio.gather(*pending)                                                                                             
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in async_add_entities                      
    await asyncio.gather(*tasks)                                                                                               
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 750, in _async_add_entity                       
    await entity.add_to_platform_finish()                                                                                      
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in add_to_platform_finish                          
    self.async_write_ha_state()                                                                                                
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 746, in async_write_ha_state                             
    self._async_write_ha_state()                                                                                               
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 808, in _async_write_ha_state                            
    state = self._stringify_state(available)                                                                                   
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                   
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 752, in _stringify_state                                 
    if (state := self.state) is None:                                                                                          
                 ^^^^^^^^^^                                                                                                    
  File "/config/custom_components/veolia/sensor.py", line 42, in state                                                         
    state = self.coordinator.data[DAILY][-1]                                                                                   
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^                                                                                   
IndexError: list index out of range                         
2023-08-13 11:09:39.169 ERROR (MainThread) [custom_components.veolia] Unexpected error fetching veolia consumption update data:
 list index out of range                                                                                                       
Traceback (most recent call last):                                                                                             
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh                       
    self.data = await self._async_update_data()                                                                                
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 242, in _async_update_data                   
    return await self.update_method()                                                                                          
           ^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                          
  File "/config/custom_components/veolia/__init__.py", line 68, in _get_consumption                                            
    and 0 < previous_data[DAILY][-1] < 10000                                                                                   
            ~~~~~~~~~~~~~~~~~~~~^^^^                                                                                           
IndexError: list index out of range        
@DavidTre07
Copy link

Same from my side, multiple accounts and same error.

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

No branches or pull requests

2 participants