GuyKh / iec-custom-component

HomeAssistant Custom Component for IEC
MIT License
131 stars 5 forks source link

Update to version 0.0.38.2 fails to load and throws an error: object of type 'NoneType' has no len() #203

Closed sefininio closed 1 week ago

sefininio commented 1 week ago

System Health details

System Information

version core-2024.10.4
installation_type Home Assistant Container
dev false
hassio false
docker true
user root
virtualenv false
python_version 3.12.4
os_name Linux
os_version 4.15.0-194-generic
arch x86_64
timezone Asia/Jerusalem
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok HACS Data | ok GitHub API Calls Remaining | 4963 Installed Version | 2.0.1 Stage | running Available Repositories | 1471 Downloaded Repositories | 22
AccuWeather can_reach_server | ok -- | -- remaining_requests | 11
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | August 17, 2025 at 3:00 AM relayer_connected | true relayer_region | eu-central-1 remote_enabled | true remote_connected | true alexa_enabled | false google_enabled | true remote_server | eu-central-1-14.ui.nabu.casa certificate_status | ready instance_id | a4de4ad502b54059a52696a01502c0d2 can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Dashboards dashboards | 4 -- | -- resources | 10 views | 42 mode | storage
Recorder oldest_recorder_run | November 1, 2024 at 5:32 AM -- | -- current_recorder_run | November 6, 2024 at 7:48 AM estimated_db_size | 1808.80 MiB database_engine | mysql database_version | 11.5.2

Checklist

Describe the issue

After upgrading to version 0.0.38.2 I started getting errors in the log and the integration fails to load.

Reproduction steps

  1. Update to 0.0.38.2
  2. Check the logs

Debug logs

2024-11-06 08:12:34.715 ERROR (MainThread) [custom_components.iec.coordinator] Unexpected error fetching Iec data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/iec/coordinator.py", line 389, in _async_update_data
    kva_tariff = await self._get_kva_tariff()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/iec/coordinator.py", line 189, in _get_kva_tariff
    self._kva_tariff = await self.api.get_kva_tariff()
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/iec_api/iec_client.py", line 511, in get_kva_tariff
    return await static_data.get_kva_tariff(self._session)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/iec_api/static_data.py", line 93, in get_kva_tariff
    await _get_tariffs(session)
  File "/usr/local/lib/python3.12/site-packages/iec_api/static_data.py", line 42, in _get_tariffs
    response = await commons.send_get_request(session=session, url=GET_KWH_TARIFF_URL)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/iec_api/commons.py", line 125, in send_get_request
    parse_error_response(resp, json_resp)
  File "/usr/local/lib/python3.12/site-packages/iec_api/commons.py", line 92, in parse_error_response
    if len(json_resp) > 0:
       ^^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()

Diagnostics dump

No response

GuyKh commented 1 week ago

Try with 0.0.39