HomeKit Cover Service call failed

Anyone else having trouble with a HomeKit-controller garage door opener.

Logger: homeassistant.core
Source: components/homekit_controller/connection.py:336 
First occurred: 7:54:04 PM (1 occurrences) 
Last logged: 7:54:04 PM

Error executing service: <ServiceCall cover.open_cover (c:67e3cd34e34011ea95a72f64fcde14e4): entity_id=['cover.garage_door_opener']>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohomekit/controller/ip/pairing.py", line 90, in _ensure_connected
    await asyncio.wait_for(self.connection.ensure_connection(), _timeout)
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 490, in wait_for
    raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError

Hi - I don’t check the forums very often. For this sort of error you are better off on GitHub, because issues tagged homekit_controller get sent to me automatically :slight_smile:

We have had timeout issues with garage door openers in the past (there is one manufactuer on the tip of my tongue) and most of the time there has been a quirk of the device. I think the last one was if a close request was sent while it was still in motion?

But a timeout in this part of the code is less common. It’s struggling to establish a TCP connection to your device. Is it on the edge of your WiFi range and suffering packet loss? There is a fix in either the current HA or the next big release of HA that slightly improves retrying behaviour. In older versions retrying could be overly agressive and open multiple connections, exacerbating the problem if the device has an embedded microcontroller sized TCP stack.

I’ll pull the power on the bridge when I get the ladder out and see if it clears up.

Are you using MyQ? I noticed that my MyQ homekit_controller integration gets wonky when you trip the safety sensor and then try to close the garage too soon. Not sure if your issue is the same. I think @Jc2k might have been referring to this in his response, as we exchanged a few messages about it.

As a work-around, I wrote the below automation. I actually have the HA integration AND the homekit_controller integration for the garage, but homekit_controller is the primary one. When the below gets triggered (when you close the garage using homekit_controller) it will then wait 7 seconds and then also execute the HA integration. It’s a stupid hack, but works pretty well.

- id: garage_door_close_retry_homekit
  alias: 'Garage Door Close Retry - HomeKit'
  initial_state: true
  trigger:
    - platform: event
      event_type: homekit_state_change
      event_data:
        entity_id: "cover.garage_door"
        service: "close_cover"

  action:
    # Wait 7 seconds, then retry if garage did not close due to an obstruction
    - delay: '00:00:07'

    - service: cover.close_cover
      entity_id: cover.garage_door_ha

For anyone finding this issue on the forums, there is a GH issue for it here.