How to control two seperate relays with garage door control?

Hi,

I’m sure this will be super simple for someone, but I’ve been trying code all evening and I’m stumped.

I’ve got a Sonoff SV with an extra relay connected to control my garage door (2 in total on the board now). I’ve got one relay working fine but it’s triggered by the up, down and stop buttons in HA. I only want it controlled by the up button. If I change the MQTT topic from power to Power2 then the other relay is controlled instead, so I know I’m very close.

If anyone could help me have the up button control one relay “Power” and the down button control the other relay “power2” it would be greatly appreciated. Here’s my current code: (can’t see any option to insert code for some reason so I’ll have to copy and paste it)

cover:

  • platform: mqtt
    name: “garage_door_right”
    state_topic: “cmnd/garagestate/POWER2”
    command_topic: “cmnd/Sonoff_GarageDoorRight/POWER”
    payload_open: “ON”
    payload_close: “ON”
    payload_stop: “ON”
    state_open: “ON”
    state_closed: “OFF”
    optimistic: false

I don’t have the sonoff, but I’m guessing it is close enough. Each door should have its own state topic. Here is what I have.

BTW - if you highlight your code and then press select the “</>” icon, it will format it correctly for the forum.

cover:
  - platform: mqtt
    name: "Garage Door - Prius"
    state_topic: "garage/door/1/status"
    command_topic: "garage/door/1/action"
    availability_topic: "GarHAge/availability"
    qos: 0
    optimistic: false
    retain: false
    payload_open: "OPEN"
    payload_close: "CLOSE"
    payload_stop: "STATE"
    state_open: "open"
    state_closed: "closed"
    payload_available: "online"
    payload_not_available: "offline"

  - platform: mqtt
    name: "Garage Door - Audi"
    state_topic: "garage/door/2/status"
    command_topic: "garage/door/2/action"
    availability_topic: "GarHAge/availability"
    qos: 0
    optimistic: false
    retain: false
    payload_open: "OPEN"
    payload_close: "CLOSE"
    payload_stop: "STATE"
    state_open: "open"
    state_closed: "closed"
    payload_available: "online"
    payload_not_available: "offline"

You will probably have to use a template cover to do what you want since the normal MQTT cover only allows one command topic with different payloads. The link below has examples of garage doors:

You will need to modify it to your use. the way you will need to do that is in the “open_cover” & “close_cover” sections you will use a mqtt_publish service with your command topics for your different relays and the required payload.