home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.53k stars 30.72k forks source link

HomeKit Garage Door State incorrect during Motion #103336

Closed jvmahon closed 1 year ago

jvmahon commented 1 year ago

The problem

For the HomeKit integration, the garage door state incorrectly shows (in the iOS Home App), a state of "closing" when the door is transitioning to the Open state, and a state of "opening" when the door is transitioning to the closed state.

It appears this may be simply a case of the HomeKit integration having incorrectly swapped the values of "opening" and "closing".

The HomeAssistant LogBook on the garage door web page does show the correct transition state of "opening" when transitioning to Open, and "closing" when transitioning to Close.

What version of Home Assistant Core has the issue?

2023.11.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Homekit

Link to integration documentation on our website

https://www.home-assistant.io/integrations/homekit

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @bdraco, mind taking a look at this issue as it has been labeled with an integration (homekit) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `homekit` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign homekit` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


homekit documentation homekit source (message by IssueLinks)

jfroy commented 1 year ago

I don’t know if it’s related, but the HomeKit bridge integration no longer closes my garage door (which is controlled by a ratgdo esphome). Opening works, closing does nothing.

bdraco commented 1 year ago

I think thats a bug in ratgdo esphome unrelated to HomeKit. I just tested it and I have to call the cover.close_cover service twice to get it to close

jfroy commented 1 year ago

I think thats a bug in ratgdo esphome unrelated to HomeKit. I just tested it and I have to call the cover.close_cover service twice to get it to close

I'll do more testing tomorrow, but I did try once or twice from my HA dashboard instead of the Home app and closing did work with one press of the close button on the entity's info card. Hence why I started suspecting a homekit bridge issue.

bdraco commented 1 year ago

I can replicate the need to hit the close button twice in the Home Assistant UI

close door wait for open fully wait a moment close door - button doesn't work in UI close door - button works

I watched the websocket connection and the second cover.close_cover started it closing but the first one didn't

bdraco commented 1 year ago

Probably need to do it with the esphome logs open in verbose mode to see what the esp is doing.

Assuming you can replicate, please continue at https://github.com/ratgdo/esphome-ratgdo/issues/new since I don't think its a HomeKit issue

https://github.com/ratgdo/esphome-ratgdo/blob/2091be83126968c4e57316116474578dbfaaa6bd/components/ratgdo/ratgdo.cpp#L531

bdraco commented 1 year ago

I see the homekit integration making the service call when the button is clicked to close the door in the Home App but the door doesn't close so definitely not a HomeKit issue. I'm 99.9% sure its a bug / race in esphome ratgdo code

bdraco commented 1 year ago

Its definitely the ratgdo esphome code.

https://github.com/ratgdo/esphome-ratgdo/pull/88

bdraco commented 1 year ago

@jfroy Please reflash with latest esphome-ratgdo

jfroy commented 1 year ago

@jfroy Please reflash with latest esphome-ratgdo

Yeah saw the PR this morning. Really unsatisfying not knowing why the normal send command is not reliable. It used to work? I don't think I'll have time to do a bisect :/

bdraco commented 1 year ago

Really unsatisfying not knowing why the normal send command is not reliable. It used to work? I don't think I'll have time to do a bisect :/

Yup, same problem for me. I won't have time to bisect for a while as I'm going to be traveling a lot this month. I tried reverting some of the last few PRs, but the problem has likely gone unnoticed for a while so it needs a lot more time investment to find it.

More than happy to revert that PR and replace it with something better if the root cause is found.

jvmahon commented 1 year ago

@bdraco
Just to clarify, this went into an esphome side discussion, but my original post had nothing to do with esphome, so I think there is still a HomeKit issue.

In my setting, I'm using a MyQ bridge that is connected to HomeAssistant via the HomeKit intergration. That part all works fine. There is no esphome.

The garage doors, as now set up in HomeAssistant, are then exported to iOS 17 using the HomeKit Bridge exporting the "Cover" domain.

In HomeAssistant, all states and transitions look fine. In iOS, there transition state of "closing" and "opening" seem to have been reversed.

bdraco commented 1 year ago

@jvmahon The MyQ bridges I previously used sent the wrong states for the GDO all the time and they ended up stuck in opening/closing states when I had it linked to iOS directly. I had complained to liftmaster about it but they said they didn't intend on fixing the issue. I don't think we can do anything about the problem.

jvmahon commented 1 year ago

@jvmahon The MyQ bridges I previously used sent the wrong states for the GDO all the time and they ended up stuck in opening/closing states when I had it linked to iOS directly. I had complained to liftmaster about it but they said they didn't intend on fixing the issue. I don't think we can do anything about the problem.

Well this is bizarre, but its working properly today. The only difference is I updated HomeAssistant from 2023.11.0 to 2023.11.1. I don't see anything in the 2023.11.1 release notes that would be a fix for the problem I had, but since it is working now, I'll close this out.

Thanks!