petretiandrea / plugp100

Work in progress implementation of tapo protocol in python.
GNU General Public License v3.0
72 stars 28 forks source link

P110 - cannot control switch when energy sensors are enabled #190

Open KoenVcBE opened 6 months ago

KoenVcBE commented 6 months ago

This weekend I updated a P110 (V1) to the latest firmware (1.3.0 build 230905 rel 152200) After processing the update, suddenly the 'today energy' sensor started working (printing out the actual load) but the switch became "not provided" within HASS. To verify the issue, I updated another P110 (V1) from 1.1.6 build 221114 rel 203339 (working) to 1.3.0 (not working anymore) ending up with the same result.

When I disabled all energy sensors, the ability to switch on/off started working again.

Debug log: 2024-05-27 10:35:53.196 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 4.235 seconds (success: True) 2024-05-27 10:35:53.197 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners update_callback() File "/config/custom_components/tapo/entity.py", line 45, in _handle_coordinator_update 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 26, in get_value return energy.energy_info.today_energy / 1000 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'today_energy' 2024-05-27 10:35:54.052 ERROR (MainThread) [custom_components.tapo.coordinators] Error fetching tapo data: Unexpected exception: 2024-05-27 10:35:54.053 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 10.001 seconds (success: False) 2024-05-27 10:35:54.996 ERROR (MainThread) [custom_components.tapo.coordinators] Error fetching tapo data: Unexpected exception: 2024-05-27 10:35:54.996 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 10.001 seconds (success: False)