netzero-labs / tesla-solar-download

Download Tesla solar data using the API
Apache License 2.0
18 stars 3 forks source link

Errors during download #5

Closed michelemilani91 closed 3 months ago

michelemilani91 commented 3 months ago
Downloading power data for battery site ***7128 to download/power/
  2024-07-31.csv
Traceback (most recent call last):
  File "/Users/xxx/tesla-solar-download/./tesla_solar_download.py", line 283, in _download_power_data
    _download_power_day(tesla, site_id, timezone, date, partial_day=partial_day)
  File "/Users/xxx/tesla-solar-download/venv/lib/python3.12/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/tesla-solar-download/venv/lib/python3.12/site-packages/retry/api.py", line 73, in retry_decorator
    return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/tesla-solar-download/venv/lib/python3.12/site-packages/retry/api.py", line 33, in __retry_internal
    return f()
           ^^^
  File "/Users/xxx/tesla-solar-download/./tesla_solar_download.py", line 234, in _download_power_day
    _write_power_csv(response['time_series'], date, site_id, partial_day=partial_day)
                     ~~~~~~~~^^^^^^^^^^^^^^^
TypeError: string indices must be integers, not 'str'
zigam commented 3 months ago

Thanks, I can improve the error message here, but the underlying cause is that no data is returned for the system. Does it work for other days / values?

michelemilani91 commented 3 months ago

Ok. It gave me that error for 10 days in 2 years more or less. It’s not a problem, I got that these days hadn’t data. If you want to improve the error message, it will be useful for other people😊

zigam commented 3 months ago

Improved error message in acba2465a82adf1a9878baae1bf66a7c474aa3cf.