MQTT cover ? interface automation garage door

Hi All,

I have a garage door controller that has an external switch interconnect that needs a momentary connection to make it go up or down.
See below for exact details from someone interfacing a garadget with it.
http://community.garadget.com/t/installation-gliderol-glidermatic-gts-optima/321

I have two things, a 8266 relay and a nodemcu with a simple reed switch.
Ideally Id like to replicate the momentary push with the 8266 relay and use the reed switch to detect the door as open.

My question is I have been experimenting with the “cover” but I dont think this is going to work. When I want to trigger the door to open, I need to trigger an ON and OFF state for either the open or close of the door.
Anyone suggest how to integrate this with HASS?

cover:
  - platform: mqtt
    name: "Garage"
#    state_topic: "/jsdev3/relay/state" <---- 8266 relay state
    state_topic: "/garage/REED_SENSOR/Switch" <---- nodemcu reed switch
    command_topic: "/jsdev3/gpio/12"
    qos: 1
    retain: true

My garage door works the same way. I ended up doing on the Arduino side: https://github.com/madpilot/GarageDoorOpener/blob/master/GarageDoorOpener.ino#L89

I don’t know LUA, but you should be able to do something similar. Or if it has the concept of a timeout, it would be even easier.

Thanks @madpilot. I ended up getting this running tonight.
The momentary switch was done by using a script to publish a sequence of MQTT commands.

scripts.yaml

alias: 'ROLLERDOOR BUTTON PUSHED'
sequence:
  - service: mqtt.publish
    data:
      topic: "/jsdev3/gpio/12"
      payload: "1"
      qos: "1"
  - delay:
      seconds: 2
  - service: mqtt.publish
    data:
      topic: "/jsdev3/gpio/12"
      payload: "0"
      qos: "1" 

switch.yaml:

- platform: template
  switches:
    rollerdoor:
      friendly_name: "Rollerdoor"
      value_template: "{{ is_state('binary_sensor.garage_door', 'on') }}"
      turn_on:
        service: script.turn_on
        entity_id: script.rollerdoor_momentaryswitch
      turn_off:
        service: script.turn_on
        entity_id: script.rollerdoor_momentaryswitch

There is a reed sensor I turned into a binary sensor that is attached to the rollerdoor which is what it uses to read the status of the door.

Works well, now the switch will truly reflect the state of the rollerdoor, all DIY for under $15.

Hi switched - I know this thread is a few months old, but I’m having a similar issue to what you originally had. I’ve been able to implement the momentary switch for my garage door, but I’d like to make it work with the “cover”. Were you ever able to get this working?

Hi Minez,
No - i didnt pursue it - I was happy in the end with the script arrangement and its been faultless.

Cheers for getting back to me. Ah fair enough - the main reason I’m trying to get it working with the cover is because when using it with homebridge (control from Apple devices), the garage door cover will show up as an actual garage door, rather than a switch. Not a big deal, just being overly pedantic haha