Garage door/cover called via Alexa ignores state

I have a ESPHome device I built to open/close my garage door. This device includes a magnetic sensor to sense the state of the door.

It appears in Home Assistant as a cover and operates as expected. The open/close buttons are enabled/disabled as excepted as the state of the door changes. i.e. you can’t call the close action when the door is already closed and you can’t call the open action when the door is already open.

I then exposed the entity to Alexa via Home Assistant Cloud. It seems to work as expected, and Alexa can also tell me the state of the door; “alexa, is garage door open?” And she will respond back with the correct state of the door.

Except I also discovered the state of the door is apparently ignored when asking Alexa to open/close it… I can tell Alexa to “close garage door” when it is already closed, and Home Assistant will send the open action. Conversely I can ask Alexa to “open garage door” when it is already open and HA will send the close action.

image

In the above image, the door was already closed… At 7:48:06 I asked Alexa to “close the garage door”. At 7:48:07 Home Assistant executed the open action.

When you ask Alexa to open a cover, she asks you for a PIN for security. Which it does correctly for me. However the PIN doesn’t matter as you can just ask her to close the door, which makes it open anyways. Obviously this is not desirable behavior.

Is there any way to fix this?

I have same issue, have you resolved?

I have not yet…

My device is a custom ESPHome device. So I posted this question on the ESPHome subreddit. Someone made the comment I should add a condition to the ESPHome code to ignore the close command if the door is already closed. (see: https://www.reddit.com/r/Esphome/comments/ujnqao/restrict_cover_openclose_action_to_sensor_state/)

I have procrastinated about messing with it. I am going to try it tonight and see if that fixes the problem in my case.

I have a feeling it will “fix it” but not really… It will still send the command regardless of the door state, but the door opener will just ignore it because the door is already closed.