petretiandrea / home-assistant-tapo-p100

A custom integration to control Tapo devices from home assistant.
MIT License
771 stars 99 forks source link

P110 Month and Daily Energy Unavailable #771

Closed fredmorais closed 9 hours ago

fredmorais commented 1 month ago

Version of the integration

3.1.2

Configuration

Tapo P110 v 1.3.0 Build 230905

Describe the bug

After I restarted Home Assistant my Month and Daily energy entities became unavailable. This has happened before and so I tried to reload the integration. After that I tried removing the device and adding again, updating the integration, update Home Assistant and nothing worked. I tried seeing current issues but I only found old ones that were fixed by previous updates.

Error adding entity sensor.nao_mexer_month_energy for domain sensor with platform tapo

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 892, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1359, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 543, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/sensor.py", line 98, in native_value
    return self._sensor_source.get_value(self.coordinator)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/sensors/__init__.py", line 41, in get_value
    return energy.energy_info.month_energy / 1000
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'month_energy'
github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 9 hours ago

This issue was closed because it has been inactive for 14 days since being marked as stale.