petretiandrea / home-assistant-tapo-p100

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

Error if a t110 sensor is connected. #777

Closed suprra closed 2 months ago

suprra commented 3 months ago

Version of the integration

3.1.2

Configuration

Tapo T110(US)_V1_1.9.0 Build 230704

Failed to setup cannot connect

Traceback (most recent call last):
  File "/config/custom_components/tapo/config_flow.py", line 317, in _async_get_device
    await device.update()
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/tapodevice.py", line 79, in update
    await component.update(state)
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/components/hub_children_component.py", line 47, in update
    await child_device.update()
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/tapodevice.py", line 79, in update
    await component.update(state)
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/components/smart_door_component.py", line 15, in update
    self.is_open = current_state["is_open"]
                   ~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'is_open'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/tapo/config_flow.py", line 143, in async_step_user
    device = await self._async_get_device(user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/config_flow.py", line 322, in _async_get_device
    raise CannotConnect from error
custom_components.tapo.errors.CannotConnect

Describe the bug

Viewing the integration via settings it shows failed setup will retry. When clicking on the integration itself it says Failed setup will retry 'is_open'. This only occurs if I have the t110 added to the tapo app. Just in case it's relevant, the switch is currently closed and advertised as such in the app. I had to remove it from the app again as my humidity sensor stopped reporting data,

Debug log


2024-06-12 07:44:00.576 INFO (MainThread) [custom_components.tapo.hass_tapo] Detected model of 192.168.68.64: H100
2024-06-12 07:44:00.676 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.100 seconds (success: True)
2024-06-12 07:44:00.677 INFO (MainThread) [custom_components.tapo.hub.hass_tapo_hub] Found 4 children associated to hub 802D6744CB619732124FA5D2B5ACD093212418BA
2024-06-12 07:44:00.779 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.102 seconds (success: True)
2024-06-12 07:44:00.882 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.102 seconds (success: True)
2024-06-12 07:44:00.984 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.102 seconds (success: True)
2024-06-12 07:44:01.550 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.566 seconds (success: True)
2024-06-12 07:44:02.059 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.491 seconds (success: True)
2024-06-12 07:44:02.184 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.616 seconds (success: True)
2024-06-12 07:44:02.300 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.732 seconds (success: True)
2024-06-12 07:44:02.433 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.864 seconds (success: True)
2024-06-12 07:44:02.558 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.989 seconds (success: True)
2024-06-12 07:44:04.448 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 2.876 seconds (success: True)
2024-06-12 07:44:04.534 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 2.962 seconds (success: True)
2024-06-12 07:44:04.630 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 3.057 seconds (success: True)
2024-06-12 07:44:04.726 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.664 seconds (success: True)
2024-06-12 07:44:04.814 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 3.241 seconds (success: True)
2024-06-12 07:44:31.969 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.145 seconds (success: True)
2024-06-12 07:44:32.077 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.248 seconds (success: True)
2024-06-12 07:44:32.218 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.304 seconds (success: True)
2024-06-12 07:44:32.335 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.393 seconds (success: True)
2024-06-12 07:44:34.981 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.095 seconds (success: True)
2024-06-12 07:45:01.952 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.127 seconds (success: True)
2024-06-12 07:45:02.054 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.224 seconds (success: True)
2024-06-12 07:45:02.159 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.246 seconds (success: True)
2024-06-12 07:45:02.273 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.331 seconds (success: True)
2024-06-12 07:45:04.970 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.085 seconds (success: True)
2024-06-12 07:45:32.110 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.286 seconds (success: True)
2024-06-12 07:45:32.227 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.398 seconds (success: True)
2024-06-12 07:45:32.366 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.453 seconds (success: True)
2024-06-12 07:45:32.484 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.542 seconds (success: True)
2024-06-12 07:45:34.974 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.089 seconds (success: True)
2024-06-12 07:46:01.924 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.099 seconds (success: True)
2024-06-12 07:46:02.041 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.212 seconds (success: True)
2024-06-12 07:46:02.165 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.252 seconds (success: True)
2024-06-12 07:46:02.268 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.326 seconds (success: True)
2024-06-12 07:46:04.965 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.080 seconds (success: True)
2024-06-12 07:46:31.929 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.104 seconds (success: True)
2024-06-12 07:46:32.032 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.203 seconds (success: True)
2024-06-12 07:46:32.147 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.234 seconds (success: True)
2024-06-12 07:46:32.271 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.328 seconds (success: True)
2024-06-12 07:46:34.971 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.086 seconds (success: True)
2024-06-12 07:47:01.930 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.106 seconds (success: True)
2024-06-12 07:47:02.034 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.204 seconds (success: True)
2024-06-12 07:47:02.140 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.227 seconds (success: True)
2024-06-12 07:47:02.241 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.299 seconds (success: True)
2024-06-12 07:47:04.971 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.084 seconds (success: True)
2024-06-12 07:47:32.080 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.256 seconds (success: True)
2024-06-12 07:47:32.184 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.355 seconds (success: True)
2024-06-12 07:47:32.297 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.384 seconds (success: True)
2024-06-12 07:47:32.397 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.455 seconds (success: True)
2024-06-12 07:47:34.991 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.105 seconds (success: True)
2024-06-12 07:48:01.990 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.166 seconds (success: True)
2024-06-12 07:48:02.150 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.321 seconds (success: True)
2024-06-12 07:48:02.288 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.374 seconds (success: True)
2024-06-12 07:48:02.392 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.450 seconds (success: True)
2024-06-12 07:48:04.999 DEBUG (MainThread) [custom_components.tapo.coordinators] Finished fetching tapo data in 0.112 seconds (success: True)
2024-06-12 08:07:19.358 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1262, in async_init
    flow, result = await self._async_init(flow_id, handler, context, data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1292, in _async_init
    result = await self._async_handle_step(flow, flow.init_step, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 528, in _async_handle_step
    if result.get("preview") is not None:
       ^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
2024-06-12 08:14:57.457 ERROR (MainThread) [custom_components.tapo.config_flow] Failed to setup cannot connect 
Traceback (most recent call last):
  File "/config/custom_components/tapo/config_flow.py", line 317, in _async_get_device
    await device.update()
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/tapodevice.py", line 79, in update
    await component.update(state)
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/components/hub_children_component.py", line 47, in update
    await child_device.update()
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/tapodevice.py", line 79, in update
    await component.update(state)
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/components/smart_door_component.py", line 15, in update
    self.is_open = current_state["is_open"]
                   ~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'is_open'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/tapo/config_flow.py", line 143, in async_step_user
    device = await self._async_get_device(user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/config_flow.py", line 322, in _async_get_device
    raise CannotConnect from error
custom_components.tapo.errors.CannotConnect
2024-06-12 08:19:19.152 ERROR (MainThread) [custom_components.tapo.config_flow] Failed to setup cannot connect 
Traceback (most recent call last):
  File "/config/custom_components/tapo/config_flow.py", line 317, in _async_get_device
    await device.update()
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/tapodevice.py", line 79, in update
    await component.update(state)
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/components/hub_children_component.py", line 47, in update
    await child_device.update()
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/tapodevice.py", line 79, in update
    await component.update(state)
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/components/smart_door_component.py", line 15, in update
    self.is_open = current_state["is_open"]
                   ~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'is_open'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/tapo/config_flow.py", line 143, in async_step_user
    device = await self._async_get_device(user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/config_flow.py", line 322, in _async_get_device
    raise CannotConnect from error
custom_components.tapo.errors.CannotConnect
2024-06-12 08:20:43.733 ERROR (MainThread) [homeassistant.components.matter] Failed to start the Matter Server add-on: Another job is running for job group addon_core_matter_server
2024-06-12 08:22:06.230 ERROR (MainThread) [custom_components.tapo.config_flow] Failed to setup cannot connect 
Traceback (most recent call last):
  File "/config/custom_components/tapo/config_flow.py", line 317, in _async_get_device
    await device.update()
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/tapodevice.py", line 79, in update
    await component.update(state)
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/components/hub_children_component.py", line 47, in update
    await child_device.update()
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/tapodevice.py", line 79, in update
    await component.update(state)
  File "/usr/local/lib/python3.12/site-packages/plugp100/new/components/smart_door_component.py", line 15, in update
    self.is_open = current_state["is_open"]
                   ~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'is_open'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/tapo/config_flow.py", line 143, in async_step_user
    device = await self._async_get_device(user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/config_flow.py", line 322, in _async_get_device
    raise CannotConnect from error
custom_components.tapo.errors.CannotConnect
suprra commented 3 months ago

I have since bound the hub to matter and added the sensor and it seems fine now but still leaving this here for future searchers.

suprra commented 3 months ago

Turns out by disabling the hub I then lost my battery sensors for my switches Now I can't renenable due to some other error and key is open is still a problem, I guess because the t110 is connected but connected via matter. I guess the underlying issue of the t110 needs to be fixed else the tapo integration breaks entirely

`2024-06-14 11:55:21.078 ERROR (MainThread) [custom_components.tapo.config_flow] Failed to setup cannot connect Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 317, in _async_get_device await device.update() File "/usr/local/lib/python3.12/site-packages/plugp100/new/tapodevice.py", line 79, in update await component.update(state) File "/usr/local/lib/python3.12/site-packages/plugp100/new/components/hub_children_component.py", line 47, in update await child_device.update() File "/usr/local/lib/python3.12/site-packages/plugp100/new/tapodevice.py", line 79, in update await component.update(state) File "/usr/local/lib/python3.12/site-packages/plugp100/new/components/smart_door_component.py", line 15, in update self.is_open = current_state["is_open"]


KeyError: 'is_open'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/tapo/config_flow.py", line 231, in async_step_discovery_auth_confirm
    device = await self._async_get_device_from_discovered(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/config_flow.py", line 295, in _async_get_device_from_discovered
    return await self._async_get_device(config | {CONF_HOST: discovered.ip}, discovered)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/config_flow.py", line 322, in _async_get_device
    raise CannotConnect from error
custom_components.tapo.errors.CannotConnect`
W0ffie commented 3 months ago

I just tried adding a new H100 that had a T110 already paired and I had the same issue.

Failed to setup cannot connect Traceback (most recent call last): File "/config/custom_components/tapo/config_flow.py", line 317, in _async_get_device await device.update() File "/usr/local/lib/python3.12/site-packages/plugp100/new/tapodevice.py", line 79, in update await component.update(state) File "/usr/local/lib/python3.12/site-packages/plugp100/new/components/hub_children_component.py", line 47, in update await child_device.update() File "/usr/local/lib/python3.12/site-packages/plugp100/new/tapodevice.py", line 79, in update await component.update(state) File "/usr/local/lib/python3.12/site-packages/plugp100/new/components/smart_door_component.py", line 15, in update self.is_open = current_state["is_open"]


KeyError: 'is_open'
Danconnolly commented 3 months ago

This is a duplicate of https://github.com/petretiandrea/home-assistant-tapo-p100/issues/759 and is fixed by pull request https://github.com/petretiandrea/plugp100/pull/189

W0ffie commented 3 months ago

Perfect.

I followed the instructions to edit the python file in issue 759 and it worked like a charm.

Thanks for your help.

suprra commented 3 months ago

Sorry I’m new to ha Does this mean I wait for the integration to update or am I meant to do something else?

thanks

github-actions[bot] commented 2 months ago

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

github-actions[bot] commented 2 months ago

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