Garage door with sonoff & tasmota

Here’s my solution, I based my template off of my previous MQTT cover. I also found I didn’t need the scripts, I could just use the body of the script in the template actions for the new cover. I didn’t need the automation because I configured Tasmota to make the sonoff’s relay open again after 1 second. Renamed my old garage door entity, and named the new one what the old one used to be. No other actions needed to be changed.

[covers.yaml]

- platform: mqtt
  name: garagedoor_mqtt
  command_topic: "cmnd/GarageDoor/POWER"
  payload_open: "ON"
  payload_close: "ON"
  payload_stop: "ON"
  state_topic: "cmnd/GarageDoor/POWER2"
  state_open: "ON"
  state_closed: "OFF"
  optimistic: false
  retain: false

- platform: template
  covers:
    garagedoor:
      friendly_name: Garage Door
      value_template: '{{ states.cover.garagedoor_mqtt.state == "open" }}'
      icon_template: '{% if states.cover.garagedoor_mqtt.state == "open" %}mdi:garage-open{% else %}mdi:garage{% endif %}'
      open_cover:
        - condition: state
          entity_id: cover.garagedoor_mqtt
          state: 'closed'
        - service: cover.open_cover
          entity_id: cover.garagedoor_mqtt
      close_cover:
        - condition: state
          entity_id: cover.garagedoor_mqtt
          state: 'open'
        - service: cover.close_cover
          entity_id: cover.garagedoor_mqtt
4 Likes