MQTT cover's retain flag

Does the retain flag only apply to messages that HA posts to the MQTT server? I’ve set mine to true and still getting ‘unknown’ state after restart…

cover:
  - platform: mqtt
    name: Garage Door
    friendly_name: Garage
    state_topic: "garage/door/status"
    command_topic: "garage/door/control"
    payload_open: "OPEN"
    payload_close: "OPEN"
    state_open: "Open"
    state_closed: "Closed"
    retain: true

I think you need to set retain on the messages coming FROM the garage door sensor. That way when HA connects, it gets the latest state topic sent from the opener.

1 Like