ooii / pySuez

Get your water consumption data from your Suez account (www.toutsurmoneau.fr)
Apache License 2.0
8 stars 12 forks source link

List index out of range #13

Open lesensei opened 3 years ago

lesensei commented 3 years ago

Hello !

I'm trying to use the "Suez Water" integration on home assistant, but it looks like it's having a problem rooted in this library. Here's the stacktrace I'm getting:

2021-03-30 10:12:15 ERROR (MainThread) [homeassistant.components.sensor] suez_water: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 360, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 465, in async_device_update
await task
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/suez_water/sensor.py", line 124, in update
self._fetch_data()
File "/usr/src/homeassistant/homeassistant/components/suez_water/sensor.py", line 88, in _fetch_data
self.client.update()
File "/usr/local/lib/python3.8/site-packages/pysuez/client.py", line 234, in update
self._fetch_data()
File "/usr/local/lib/python3.8/site-packages/pysuez/client.py", line 111, in _fetch_data
self.state = int(float(data.json()[int(
IndexError: list index out of range

Please tell me if there's any additional info that may help solving this.

Thanks for your work !

laurent-martin commented 1 year ago

Home assistant uses an older version of this library. I had the same error. I have manually replaced this lib with the latest version, and now it works in home assistant. There was one problem though: the newer version expects one aditional mandatory argument : provider. I have made a pull request to add a default value for this parameter, so that Home assistant can use next version without code change...

ooii commented 8 months ago

Guys, I'm sorry for not responding to these issues. I was very busy with other stuff and, to be honest, the integration was not satisfactory for me, so I stopped using it (and looking to this repo). I got some complaints recently and decided to give a look and discovered all these issues. I'll try to bring a new and better integration that takes into consideration all the issues and sub-providers, and I'll try to make it doable from the UI. Please, be patient.