ESPHome Garage Door in Google Assistant

Hi,

I’ve just started using HomeAssistant, and set up a Shelly1 running ESPHome in order to open my garage door (I have a Liftmaster Pro). The garage door requires a debounce on dry contact (aka momentary switch), so I’ve configured an output button, and use a cover template to make it appear as a garage door. In HA, this works perfectly (see ESPHome config below).

I imported it into HA, and when I press “open”, it closes the relay for 200ms, then opens it, triggering the door to open.

I also have the Google Assistant integration, where the device appears when sync’ed (as do my other devices), but the GA garage door is working like as if I’m handling the underlying relay, requiring two actions to work (If I open, then close the garage door in GA, after the second action it works), instead of working the same way the HA cover works.

Is there something I can do to get the GA garage door to behave properly? I know the underlying GA protocol, and I’m reading the code in traits.py, but it’s not clear to me why the cover behavior isn’t taking effect via GA.

esphome:
  name: garagedoor

esp8266:
  board: esp01_1m

logger:

api:
  encryption:
    key: SOME_KEY

ota:
  password: SOME_PASSWORD

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: SOME_IP
    gateway: SOME_GATEWAY
    subnet: SOME_SUBNET

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Garagedoor Fallback Hotspot"
    password: SOME_PASSWORD

output:
  - platform: gpio
    pin:
      number: GPIO4
    id: relay

button:
  - platform: output
    name: "Garage Door Relay"
    output: relay
    duration: 200ms
    id: door_button
    internal: true

binary_sensor:
  - platform: gpio
    pin: GPIO5
    name: "Garage Door Contact Sensor"
    id: contact_sensor
    internal: true
    filters:
      - invert:
      - delayed_on_off: 500ms

cover:
  - platform: template
    device_class: garage
    name: "Garage Door"
    id: template_cov
    lambda: |-
      if (id(contact_sensor).state) {
        return COVER_OPEN;
      } else {
        return COVER_CLOSED;
      }
    open_action:
      - button.press: door_button
    close_action:
      - button.press: door_button
    stop_action:
      - button.press: door_button

text_sensor:
  - platform: wifi_info
    ip_address:
      name: $friendly_name IP Address

sensor:
  - platform: wifi_signal
    name: $friendly_name WiFi Strength
    update_interval: 60s
  - platform: uptime
    name: $friendly_name "Uptime"

captive_portal:
    

I actually figured this out after reading through enough of the code to debug (via the template in develop tools for inspecting state, and via the services tab).

It turns out that Google Assistant doesn’t require a pin for door close, and since I have a simple push-button opener, Open was failing, but Close was succeeding, and therefore opening the door.

I had added a pin to my configuration, but forgot to save before closing and restarting, so the open command was failing every time.

Once I re-added the pin, saved and restarted, the garage door started working as expected.

Hi there.

Where did you put in the pin code? I have the same setup woth esphome. But i cant figure out where i put a pin code to make the door work with google Voice command.