GuyKh / iec-custom-component

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

Integration not working(v0.0.33): AttributeError: 'NoneType' object has no attribute 'reading' #174

Closed oferpaster closed 1 month ago

oferpaster commented 1 month ago

System Health details

Integration version: 0.0.33 Home assistant version: 2024.9.3

Checklist

Describe the issue

I got the following error:

2024-09-26 16:03:47.227 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 423, in _async_update_data
    total_kva_price, estimated_kwh_consumption = await self._estimate_bill(contract_id, device.device_number,
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/iec/coordinator.py", line 648, in _estimate_bill
    last_meter_read = last_meter_reading.reading
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'reading'

image

Reproduction steps

  1. Add entry
  2. The entry created
  3. getting the error AttributeError: 'NoneType' object has no attribute 'reading' ...

Debug logs

2024-09-26 16:03:47.227 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 423, in _async_update_data
    total_kva_price, estimated_kwh_consumption = await self._estimate_bill(contract_id, device.device_number,
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/iec/coordinator.py", line 648, in _estimate_bill
    last_meter_read = last_meter_reading.reading
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'reading'

### Diagnostics dump

2024-09-26 16:03:47.227 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 423, in _async_update_data total_kva_price, estimated_kwh_consumption = await self._estimate_bill(contract_id, device.device_number, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/iec/coordinator.py", line 648, in _estimate_bill last_meter_read = last_meter_reading.reading ^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'reading'

MosquitoByte commented 1 month ago

Still getting same error on 0.0.34 version. @GuyKh

`This error originated from a custom integration.

Logger: custom_components.iec.coordinator Source: helpers/update_coordinator.py:354 integration: Israel Electric Corporation (IEC) (documentation, issues) First occurred: 22:31:47 (2 occurrences) Last logged: 22:32:04

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 423, in _async_update_data total_kva_price, estimated_kwh_consumption = await self._estimate_bill(contract_id, device.device_number, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/iec/coordinator.py", line 648, in _estimate_bill last_meter_read = last_meter_reading.reading ^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'reading'`

GuyKh commented 1 month ago

@MosquitoByte - please check with 0.0.35