OpenGarage service calls intermittently fail

I’ve configured an OpenGarage device via the core OpenGarage integration.

The problem is that service calls to open or close the garage intermittently fail, while the dashboard open/close buttons work 100% of the time. I don’t understand why this would be since I assume the dashboard buttons call the same services on the backend, but I’m not so familiar with this aspect of HA architecture.

There’s nothing suspicious in the logs when the service calls fail. I’ve tried making them via an Android widget and the developer tools.

The service I’m calling is cover.toggle and the target entity is cover.my_opengarage. Again, it works about half of the time, usually for long periods at a time.

With not even an error in the logs when the service call fails, how can I approach debugging this?

I made a minor discovery: cover:toggle fails intermittently, but cover:open_cover and cover:close_cover work consistently. This explains why the dashboard works (since it has explicit open and close controls).

The question then is why cover:toggle fails. Clearly HA understands the current state of the cover since it’s reflected correctly on the dashboard.

I think I figured it out, though I’m not sure how to fix it. The problem is in the cover toggle function.

Basically, HA will only toggle a cover closed if it was previously opened by HA. If it was previously opened manually, outside of HA, HA will try to open it even though it already knows that it’s open. I have no idea if that’s intentional or not.

I think this would apply to any cover, not just garages.

I’m confident enough that this is a bug: Cover toggle intermittently fails · Issue #91863 · home-assistant/core · GitHub

I enabled debug logging for the integration, but there’s nothing interesting when the problem occurs, just this over and over:

DEBUG (MainThread) [homeassistant.components.opengarage] Finished fetching opengarage data in 0.018 seconds (success: True)