ESPHOME and a Hörmann Garage door

I attached my new Hörmann Garage door to HA via @ESPHOME.

From the Door side i needed an UAP1 which is a connector box, it is plugged to the motor. The UAP1 has all needed in- and outputs i need.
There is a 24V powersupply integrated which i use to power the D1 Mini via a voltage regulator.

I connected the relays to inputs to get the states door close / door fully open and two outputs via MOSFET (e.g. IRF530) to set the direction of the door.

The YAML file looks like this.

esphome:
  name: garage_hoermann
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: 'secret'
  password: 'secret'
  manual_ip:
    static_ip: 192.168.178.250
    gateway: 192.168.178.1
    subnet: 255.255.255.0

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: 'secret'

ota:
  password: 'secret'


#http://heinz-otto.blogspot.com/2016/07/garagentor-mit-fhem-bedienen.html
#http://majorshark.de/index.php/13-hoermann-torantrieb-mit-espeasy-in-fhem-einbinden
#GPIO5 	D6 	Eingang 	O1 	Tor Endlage oben (Geöffnet)
#GPIO0 	D5 	Eingang 	O2 	Tor Endlager unten (Geschlossen)
#GPIO14 	D4 	Ausgang 	S4 	Tor schließen
#GPIO13 	D3 	Ausgang 	S2 	Tor öffnen

binary_sensor:
  - platform: gpio
    id: state_up
    pin: 
      number: D6
      mode: INPUT_PULLUP
    name: "Garage Endlage oben"
    internal: true
    #device_class: binary_sensor #garage_door
    filters:
    - invert:
  - platform: gpio
    id: state_down
    pin: 
      number: D5
      mode: INPUT_PULLUP
    internal: true
    filters:
    - invert:
    name: "Garage Endlage unten"
    #device_class: binary_sensor #garage_door

switch:
  - platform: gpio
    pin: D4
    id: close_switch
    name: "Garage Down"
    icon: "mdi:gate"
    interlock: [open_switch]
    internal: true
    restore_mode: ALWAYS_OFF
    on_turn_on:
    - delay: 500ms
    - switch.turn_off: close_switch
  - platform: gpio
    pin: D3
    id: open_switch
    internal: true
    restore_mode: ALWAYS_OFF
    interlock: [close_switch]
    name: "Garage Up"
    icon: "mdi:gate"
    on_turn_on:
    - delay: 500ms
    - switch.turn_off: open_switch

cover:
  - platform: template
    id: garage_door
    name: "Garagen Tor"
    lambda: |-
      if (id(state_down).state) {
        return cover::COVER_CLOSED;
      } else {
        return cover::COVER_OPEN;
      }
    open_action:
      - switch.turn_on: open_switch
    close_action:
      - switch.turn_on: close_switch
    stop_action:
      - switch.turn_off: close_switch
      - switch.turn_off: open_switch

The state of the light wasn’t relevant to me so i skiped it. Perhaps i will extend the board whit a DHT12 to get the clima from inside the garage.
It works fine for me but use at your own risk.

4 Likes

Hi lubeda,

grat job i also have a UAP1 and implemented your code with an ESP8266.
I can suscessfully open and close the garage door but the code does not change the entity state to “closed” or “opend”.
It is always “opening” or “closing”.

Can anybody support?
The Logfile from ESP is as follows.

[13:35:30][D][cover:072]: 'Garagen Tor' - Setting
[13:35:30][D][cover:082]:   Command: OPEN
[13:35:31][D][switch:021]: 'Garage Up' Turning ON.
[13:35:31][D][switch:045]: 'Garage Up': Sending state ON
[13:35:31][D][cover:152]: 'Garagen Tor' - Publishing:
[13:35:31][D][cover:160]:   State: CLOSED
[13:35:31][D][cover:168]:   Current Operation: OPENING
[13:35:31][D][binary_sensor:033]: 'Garage Endlage unten': Sending state OFF
[13:35:31][D][cover:152]: 'Garagen Tor' - Publishing:
[13:35:31][D][cover:158]:   State: OPEN
[13:35:31][D][cover:168]:   Current Operation: OPENING
[13:35:31][D][switch:025]: 'Garage Up' Turning OFF.
[13:35:31][D][switch:045]: 'Garage Up': Sending state OFF
[13:35:43][D][binary_sensor:033]: 'Garage Endlage oben': Sending state ON
[13:37:26][D][cover:072]: 'Garagen Tor' - Setting
[13:37:26][D][cover:082]:   Command: CLOSE
[13:37:26][D][switch:021]: 'Garage Down' Turning ON.
[13:37:26][D][switch:045]: 'Garage Down': Sending state ON
[13:37:26][D][cover:152]: 'Garagen Tor' - Publishing:
[13:37:26][D][cover:158]:   State: OPEN
[13:37:26][D][cover:168]:   Current Operation: CLOSING
[13:37:27][D][switch:025]: 'Garage Down' Turning OFF.
[13:37:27][D][switch:045]: 'Garage Down': Sending state OFF
[13:37:27][D][binary_sensor:033]: 'Garage Endlage oben': Sending state OFF
[13:37:47][D][binary_sensor:033]: 'Garage Endlage unten': Sending state ON
[13:37:47][D][cover:152]: 'Garagen Tor' - Publishing:
[13:37:47][D][cover:160]:   State: CLOSED
[13:37:47][D][cover:168]:   Current Operation: CLOSING
[13:39:15][D][cover:072]: 'Garagen Tor' - Setting
[13:39:15][D][cover:082]:   Command: OPEN
[13:39:15][D][switch:021]: 'Garage Up' Turning ON.
[13:39:15][D][switch:045]: 'Garage Up': Sending state ON
[13:39:15][D][cover:152]: 'Garagen Tor' - Publishing:
[13:39:15][D][cover:160]:   State: CLOSED
[13:39:15][D][cover:168]:   Current Operation: OPENING
[13:39:15][D][switch:025]: 'Garage Up' Turning OFF.
[13:39:15][D][switch:045]: 'Garage Up': Sending state OFF
[13:39:15][D][binary_sensor:033]: 'Garage Endlage unten': Sending state OFF
[13:39:15][D][cover:152]: 'Garagen Tor' - Publishing:
[13:39:15][D][cover:158]:   State: OPEN
[13:39:15][D][cover:168]:   Current Operation: OPENING
[13:39:28][D][binary_sensor:033]: 'Garage Endlage oben': Sending state ON

THanks!

Crazy,
do you have a special loglevel? I can’t see anything like “OPENING” od “CLOSING” with my current configuration.

One up and down round looks like this with my config:

[17:06:47][D][switch:027]: 'Garage Up' Turning ON.
[17:06:47][D][switch:051]: 'Garage Up': Sending state ON
[17:06:47][D][switch:031]: 'Garage Up' Turning OFF.
[17:06:47][D][switch:051]: 'Garage Up': Sending state OFF
[17:06:47][D][binary_sensor:037]: 'Garage Endlage unten': Sending state OFF
[17:07:01][D][switch:031]: 'Garage Down' Turning OFF.
[17:07:01][D][switch:031]: 'Garage Up' Turning OFF.
[17:07:04][D][binary_sensor:037]: 'Garage Endlage oben': Sending state ON
[17:07:15][D][switch:027]: 'Garage Down' Turning ON.
[17:07:15][D][switch:051]: 'Garage Down': Sending state ON
[17:07:15][D][switch:031]: 'Garage Down' Turning OFF.
[17:07:15][D][switch:051]: 'Garage Down': Sending state OFF
[17:07:16][D][binary_sensor:037]: 'Garage Endlage oben': Sending state OFF
[17:07:39][D][binary_sensor:037]: 'Garage Endlage unten': Sending state ON

I am currently checking out an ESP32-CAM to do this up down thing an also monitor the garage with a cam.

I dont use mqtt i am on the latest hass.io and ESPHOME!

I also only use ESPHome with the code you provided above (no special logleven - only difference is Nodemcu Board and not WEMOS) - no MQTT.

Strange… anybody an idea?

Thanks!

I am on an x64 hass.io, are you on another plattform like raspberry?
Perhaps other platforms compiles the source different.

Think it has something to do with “Current Operation: CLOSING” or “Current Operation: OPENING”, this somehow needs to go to “Current Operation: IDLE” before the state will update based on the sensor.

After triggering an Open or Close, wait till the door is finished its operation. Disconnect your relay wires and hit the stop button, you should see the state go from (Opening/Closing) to (Open/Closed).

Not sure how to get “Current Operation: IDLE” to occur without hitting the stop button.

So I think I got it working, at work and its not connected to my garage at the moment; so I cant really validate it operates as intended.
I’m sure there is a better way of doing this but I just added “- cover.stop: car_door” to the open and close action, and set the stop_action to not really do anything. Down side is the stop button only tells the relay to turn off, which does not have any effect on my garage opener.

My garage opener only has 1 input for open/close actions, So i’m using a single relay. I also only have 1 sensor to identify the state which is configured for closed.

esphome:
  name: esp_cardoor
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: "ssidhere"
  password: "passwordhere"
  # fast_connect: True for hidden ssids
  fast_connect: True

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "passwordhere"

ota:
  password: "passwordhere"

binary_sensor:
- platform: gpio
  id: car_door_sensor
  pin:
    number: GPIO15
    mode: INPUT_PULLUP
    # Inverted since the sensor is positioned for the garage being closed.
    inverted: True
  name: "Car Door Sensor"
  device_class: garage_door
  filters:
    - delayed_on: 20ms

switch:
- platform: gpio
  id: relay
  pin:
    number: GPIO5
    inverted: False
  restore_mode: ALWAYS_OFF
- platform: restart
  name: 'Car Door Reboot'

cover:
  - platform: template
    id: car_door
    name: "Car Door"
    lambda: !lambda |-
      if (id(car_door_sensor).state) {
        return COVER_OPEN;
      } else {
        return COVER_CLOSED;
      }
    optimistic: false
    assumed_state: true
    open_action:
      - switch.turn_off: relay
      - switch.turn_on: relay
      - delay: 0.1s
      - switch.turn_off: relay
      # cover.stop to set "Current Operation" to IDLE
      - cover.stop: car_door
    close_action:
      - switch.turn_off: relay
      - switch.turn_on: relay
      - delay: 0.1s
      - switch.turn_off: relay
      # cover.stop to set "Current Operation" to IDLE
      - cover.stop: car_door
    stop_action:
      - switch.turn_off: relay
1 Like

yes I’m on raspberry 3 but that should not affect the code :face_with_raised_eyebrow:

Hi!

Which particular type of Hörmann Garage door do you own? I am asking because I am planing to buy a new garage door in spring of 2020.

Thanks and kind regards!

Hello, it does not depend on the door it depends on the motor. You need a motor wich is able to connect to the UAP from Hörmann. The UAP is an interfacebox with contacts and relays. My ESP interfaces only with them regardles of the door itself. Perhaps you should take an intense look in the documentation of the UAP.

Greetings

1 Like

Hello lubeda,

I know. :slight_smile: I was asking because I am going to replace my current door with a new one and I was interested which particular model you own.

Nevermind, kind regards from Roman.

I dont know the exact model because our garage is a bit oversized 5x3m
But it is this technic:
https://www.hoermann.de/private-bauherren-und-modernisierer/garagentore/garagen-sektionaltore/
and “LPU 67 Thermo” as panel type.
the people who mount this door to your garage have to be very precise, misalignment of the rails can result in problems.

1 Like

Hello,

Just wanted to give my take on the automation (which I wouldn’t have been able to create without your prototyping board and heinz otto’s blog.

I had a couple of “issues” or annoyances. I wanted to be able to stop the garage from opening and closing. But also to be able to reverse the direction of the current running action.

I’m also using an UAP01, so I guess this should work for you also.

A couple of notes on default UAP behavior (for me)

  • Running the close action while opening → garage stops
  • Running te open action while closing → garage opens
  • Pressing the partial open “button” while opening or closing → garage stops

After first adding the “stop” action by using the partial opening button, I couldn’t choose to then open or close the garage. It assumed a full closed or opened state after stopping, which meant I head to let the garage open completely before being able to close it again.

By using a “virtual” position of 0.5 while moving, both up and down actions are available.
With an extra check in the on_close action, I run the close command twice so the garage is really closing after pressing the close button while it was previously opening.

Hopefully this is of use for someone.

binary_sensor:
  - platform: gpio
    id: garage_opened
    name: Garage Opened
#    internal: true
    pin:
      number: D1
      inverted: true
      mode: INPUT_PULLUP
    filters:
      - delayed_on: 10ms
      - delayed_off: 10ms
    on_press:
    - cover.template.publish:
        id: garage_door
        current_operation: IDLE
        position: 1

  - platform: gpio
    id: garage_closed
    name: Garage Closed
#    internal: true
    pin:
      number: D2
      inverted: true
      mode: INPUT_PULLUP
    filters:
      - delayed_on: 10ms
      - delayed_off: 10ms
    on_press:
    - cover.template.publish:
        id: garage_door
        current_operation: IDLE
        position: 0

switch:
  - platform: gpio
    pin: D5
    id: switch_close
    name: "Garage Close"
    icon: "mdi:gate"
    internal: true
    restore_mode: ALWAYS_OFF
    on_turn_on:
    - cover.template.publish:
        id: garage_door
        current_operation: CLOSING
        position: 0.75
    - delay: 200ms
    - switch.turn_off: switch_close
    
  - platform: gpio
    pin: D7
    id: switch_open
    name: "Garage Open"
    icon: "mdi:gate"
    internal: true
    restore_mode: ALWAYS_OFF
    on_turn_on:
    - cover.template.publish:
        id: garage_door
        current_operation: OPENING
        position: 0.5
    - delay: 200ms
    - switch.turn_off: switch_open
  
  - platform: gpio
    pin: D8
    id: switch_partial
    name: "Garage Partial"
    icon: "mdi:gate"
    internal: true
    restore_mode: ALWAYS_OFF
    on_turn_on:
    - cover.template.publish:
        id: garage_door
        current_operation: IDLE
        position: 0.5
    - delay: 200ms
    - switch.turn_off: switch_partial
    
  - platform: gpio
    pin: D6
    id: switch_light
    name: "Garage Light"
    icon: "mdi:lightbulb"
    restore_mode: ALWAYS_OFF
    on_turn_on:
    - delay: 200ms
    - switch.turn_off: switch_light

cover:
  - platform: template
    id: garage_door
    name: "Garage"
    device_class: garage
    has_position: true
    open_action:
      - switch.turn_on: switch_open
    close_action:
      then:
        - if:
            condition:
              lambda: 'return id(garage_door).current_operation == CoverOperation::COVER_OPERATION_OPENING;'
            then:
              - logger.log: "Extra Close"
              - switch.turn_on: switch_close
              - delay: 1000ms

        - switch.turn_on: switch_close
    stop_action:
      - switch.turn_on: switch_partial

Regards,
Stijn

1 Like

Just wanted to mention this here:

Works nicely on the Promatic 4 and does not require a UAP1

Greetings

Hi, sorry for pulling this one up, but one possibly obvious question: Why do we need the resistors and the NPN transistor here?

I would search for it, but I am missing a starting point.

Thanks

Deutsch:
Hi, die Grundlage zur Hardware habe ich irgendwo in einem FHEM-Forum gefunden. Ich denke es geht um das was man schaltet, du kannst kein Relay direkt mit dem ESP ansteuern (zuviel Strom). Aber das ding läuft bei mir schon eine weile, Details habe ich verdrängt.

English:
Hi, I found the basis for the hardware somewhere in an FHEM forum. I think it’s about what you switch, you can’t control a relay directly with the ESP (too much current). But this thing has been going on for me for a while, I’ve suppressed details.

1 Like

Hello,

I have a Hörmann garage door with an SupraMatic P3. This I also want to integrate in HA like you did. In the opening post only up and down is set as a switch, but I also want to have the ventilation position. Is this the 1/2 position which is also available on the UAP1? And how can I connect it to the ESP (sorry, I’m no electronics technician)? I think I have to add one more resistance and one more MOSFET (NPN in the scheme) and connect them to D2 for example?

@lubeda Have you added a DHT12 to the board like you have mentioned?

@XiteHosting you have added the partial open button I want to have. Can you eventually tell me how you built up the board and show me some pictures of it? I really want to build one.

Thank you in advance!

Hi,
no, but you can use the examples from the esphome documentation, for the i2c bus you need specials ports. For the rest you are free which ports to use for the Hörmann connection.

The partial opening should also be possible by a template. You have to measure the timing to the desired opening from the open and close positions and put some logic to the lambdas. I don’t have hardware-buttons directly connected to the ESP.

Thank you very much for that information. Can you eventually give me some more details about the parts I need? This topic is completely new for me but I want to try to build on board with your scheme in the initial post.

I see that I need a D1 Mini (which one?), a voltage regulator (which one?), 2x IRF530, 2x resistance, 1 condensator?! and some PCB terminal? Is that right?

We can also write per DM (Englisch, German).

Thank you in advance.

Hello lubeda,

the topic has been resolved. I ordered a ready-made additional board for the Hörmann universal adapter board UAP1, which can be integrated using ESP via MQTT.

Nevertheless many thanks!

Best regards
Andreas