Help with esphome controlling HVAC dampers

Hi. I am trying to control a set of HVAC dampers. The damper has 3 wires, common, open, close, and requires 40v for 15 secs to fully move from open to closed. I am using a lilygo t-relay-8 as the controller (see here: https://www.aliexpress.us/item/3256804149327347.html?gatewayAdapt=bra2usa&_randl_shipto=US)

I have the relays set up so that for the first damper, relay1 switches the power on when closed, and relay2 controls open/closed, for the second damper, relay 3 controls the power, relay 4 controls open closed, etc…

What I would like is to have a switch exposed to home assitant for each damper, and when it is commanded to open or close on that state change, the power is applied for 15 secs, and then is shut off.

Here is the yaml I have so far for the relays and their logic using a template switch:

switch:
  - platform: gpio
    pin: GPIO33
    id: relay8 # damper 4 open/close
  - platform: gpio
    pin: GPIO32
    id: relay7 # damper 4 power
    restore_mode: RESTORE_DEFAULT_OFF
  - platform: gpio
    pin: GPIO13
    id: relay6 # damper 3 open/close
  - platform: gpio
    pin: GPIO12
    id: relay5 # damper 3 power
    restore_mode: RESTORE_DEFAULT_OFF
  - platform: gpio
    pin: GPIO21
    id: relay4 # damper 2 open/close
  - platform: gpio
    pin: GPIO19
    id: relay3 # damper 2 power
    restore_mode: RESTORE_DEFAULT_OFF
  - platform: gpio
    pin: GPIO18
    id: relay2 # damper 1 open/close
  - platform: gpio
    pin: GPIO5
    id: relay1 # damper 1 power
    restore_mode: RESTORE_DEFAULT_OFF

  - platform: gpio
    pin: GPIO25
    id: redled # onboard LED - damper active
    restore_mode: RESTORE_DEFAULT_OFF

cover:
  - platform: template
    name: "Damper 1"
    optimistic: true
    open_action: 
      - switch.turn_off: relay2
      - switch.turn_on: relay1
      delay: 15s
      - switch.turn_off: relay1
          
    close_action:
      - switch.turn_on: relay2
      - switch.turn_on: relay1
      delay: 15s
      - switch.turn_off: relay1

When trying to install, I am getting this error:

RROR Error while reading config: Invalid YAML syntax:

while parsing a block collection
in “/config/esphome/damper-control.yaml”, line 72, column 7:
- switch.turn_off: relay2
^
expected , but found ‘?’
in “/config/esphome/damper-control.yaml”, line 74, column 7:
delay: 15s
^

I don’t understand the error - I have no ? in the yaml, and I don’t get why the there is a yaml syntax error for the switch.turnoff command when the other turn on and turn off commands don’t throw errors?

I’d love some help in figuring out why this is not working.

Thanks!

1 Like

Your delays in the cover actions need dashes in front of them too.

1 Like

Sigh. Rookie error. Thanks!

1 Like