Core: Homekit state of covers in Home App sometimes not correct

Created on 27 Oct 2020  路  17Comments  路  Source: home-assistant/core

The problem


I am using the Apple Home App as UI with the Homekit integration of Home Assistant. I have integrated a lot of Homematic devices, but with covers I sometimes have this problem:

When I open or close a cover via the physical wall button the Home App stayes in "closing"/"opening" state, even if the cover itself is closed/opened completly. In the Home Assistant UI the cover state is showed correctly, only in the Apple Home App the cover state keeps wrong. A restart of the Home App does not help. I even tried to completly resetup my Home in the App, but the error is still there.

This only happens when using the physical button, and only sometimes (5 out of 10 tries) when using the Home App UI to open/close the covers all covers are always shown with the correct state.

Environment

  • Home Assistant Core release with the issue: 0.116.4
  • Last working Home Assistant Core release (if known): na
  • Operating environment (OS/Container/Supervised/Core): Container
  • Integration causing this issue: Homekit
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/homekit/

Problem-relevant configuration.yaml


Traceback/Error logs


Additional information

homekit

All 17 comments

homekit documentation
homekit source
(message by IssueLinks)

Hey there @bdraco, mind taking a look at this issue as its been labeled with an integration (homekit) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

Which integration provides the covers?

@bdraco its the Homematic integration

        if new_state.state == STATE_OPENING:
            if self.char_position_state.value != HK_POSITION_GOING_TO_MAX:
                self.char_position_state.set_value(HK_POSITION_GOING_TO_MAX)
        elif new_state.state == STATE_CLOSING:
            if self.char_position_state.value != HK_POSITION_GOING_TO_MIN:
                self.char_position_state.set_value(HK_POSITION_GOING_TO_MIN)

Looks like we set char_position_state instead of char_target_position

That actually looks correct.

I don't have any homekit covers that have the issue so I'm not sure I can fix this since I can't replicate it.

Maybe DEVICE_PRECISION_LEEWAY is too low.. setting it to 10

@nicx Can you try changing DEVICE_PRECISION_LEEWAY to 10 in homekit.const and see if the problem goes away?

Also can you paste a dump of the state of the cover from the developer tools when its stuck in homekit?

yes I will try it tomorrow and give you feedback. thanks for your investigation @bdraco :)

have it running niw over the day with DEVICE_PRECISION_LEEWAY set to 10. So far, no problems. I will keep an eye on it over the next days.

Day 2: still no problems... look very good so far :)

If it's good for a week, I'll make the adjustment in the code.

just as an additional information: I had to reconfigure my complete Home in the Apple App after changing this config. Is this to be expected? if yes it should be well documented as a "breaking change" or something similar. ;)

hey @bdraco , the problem just reappears after 3 days working. here is the state dump of a cover wich Stucks in the Home app:

current_position: 100
rssi_peer: -67
level: 1
working: 'No'
id: OEQ0037772
interface: rf
friendly_name: K眉che Rollladen
supported_features: 15
device_class: shutter

IMG_B7E1D08645E3-1

Bildschirmfoto 2020-10-30 um 08 34 27

Bildschirmfoto 2020-10-30 um 08 34 48

thanks for implementing the fix @bdraco, unfortunately the behavior of the covers is now a little bit confusing:

If I close an open shutter with the Home app, the status of the cover icon jumps for a short time to some percent state and then back to "open". After the cover is fully closed, the state of the icon changes correctly to "closed". But the state "closing" is now completely missing, while the cover is closing I see the state "open".

If I want to set the cover to a "percentage level" the state is also not reflected correctly in the Home app while closing/opening happens.

Is that the expected behavior?

The final state is always correct with your fix now, that's the good point 馃憤

This the expected behavior. Previously when we tried to fake the state it was a bit smoother, but the trade off was the state at the end of the operation would be wrong.

@bdraco hm thats a pitty... is there anything we could do to get the smoothness back and in addition the correct end state, too? this non-smooth behaviour is really bad in using it... its absolutely confusing the user now, he/she has a lot of trouble now with pressing the button multiple times etc.

@bdraco hm thats a pitty... is there anything we could do to get the smoothness back and in addition the correct end state, too? this non-smooth behaviour is really bad in using it... its absolutely confusing the user now, he/she has a lot of trouble now with pressing the button multiple times etc.

Since most covers (maybe all) don't update when the position changes between 2-99 (unless the cover stops), we simplify don't have enough information to determine the position of the cover beyond open / closed (and opening/closing for the integrations that due report that).

Some of the covers do an optimistic set so the behavior is better, but that's up to the developer of the integration on how to implement that. We can only report the state that the integration gives us if we want it to be reliable.

lutron_caseta, lutrion_caseta_pro (custom), somfy implement optimistic state as an option or by default.

homematic does not so that might be a feature request worth posting here: https://community.home-assistant.io/c/feature-requests/13

Was this page helpful?
0 / 5 - 0 ratings

Related issues

WilldabeastHA picture WilldabeastHA  路  203Comments

abouelric picture abouelric  路  165Comments

Gio76 picture Gio76  路  223Comments

balloob picture balloob  路  371Comments

aguilaair picture aguilaair  路  162Comments