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
72.97k stars 30.53k forks source link

Closing/Opening seems to be swapped #25945

Closed tleegaard closed 5 years ago

tleegaard commented 5 years ago

Home Assistant release with the issue: 0.97.0

Component/platform: https://www.home-assistant.io/components/homekit_controller/

Description of problem: The state of cover is going from Closed → Closing → Open → Opening → Closed image

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

  - entity: cover.velux_window_entre
probot-home-assistant[bot] commented 5 years ago

Hey there @Jc2k, mind taking a look at this issue as its been labeled with a integration (homekit_controller) you are listed as a codeowner for? Thanks!

Jc2k commented 5 years ago

Wow, good spot @tleegaard. I've double checked in the HAP spec and it does look like this is inverted. This line here:

https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/homekit_controller/cover.py#L36

Should be something like (off the top of my head):

CURRENT_WINDOW_STATE_MAP = {0: STATE_CLOSING, 1: STATE_OPENING, 2: STATE_STOPPED}

Could you possibly try making that change?

Even better, if it works would you mind raising a pull request again. If you do you'll need to update one of the tests in two places:

(Just need to swap opening and closing round)

(I don't have any HomeKit window covers so I have no way to test changes like this myself)

tleegaard commented 5 years ago

I will look into it :-)

Madseason41 commented 5 years ago

Just out of curiosity... would this cause the native iOS Home notifications to trigger on restart?

I have notifications in the iphone home app turned on for my garage doors. Each time I restart Hassio, i get a notification on my phone that each one of the (three) garage doors is closed.