Creating MQTT Cover Device

Trying to create an ESP32 based device for my garage door opener and having issues getting the MQTT Discovery to pick up the cover. The sensor is showing up under the device, but I’m not getting anything for the cover. I’m not seeing anything in the error log either.

I’m using HA as an OS VM, with a separate Mosquitto broker.

homeassistant/cover/mainGarage/config:

{
  "name": "Main Garage Door",
  "cmd_t": "garageDoors/mainGarage/set",
  "stat_t": "garageDoors/mainGarage/state",
  "val_tpl": "{{ value_json.state }}",
  "pos_t": "garageDoors/mainGarage/state",
  "pos_tpl": "{{ value_json.position }}",
  "avty_t": "garageDoors/mainGarage/availability",
  "qos": 0,
  "ret": true,
  "pl_open": "OPEN",
  "pl_cls": "CLOSE",
  "pl_stop": "STOP",
  "stat_open": "open",
  "stat_opening": "opening",
  "stat_clsd": "close",
  "stat_closing": "closing",
  "pl_avail": "online",
  "pl_not_avail": "offline",
  "opt": false,
  "uniq_id": "main_garage.cover",
  "dev_cla": "garage",
  "pos_clsd": 0,
  "pos_open": 100,
  "device": {
    "name": "JNetInc Garage Door System",
    "manufacturer": "JNetInc",
    "model": "GDS-001",
    "identifiers": "SN001",
    "sw_version": "0.9"
  }
}

homeassistant/sensor/mainGarage/config

{
  "availability_topic": "garageDoors/mainGarage/availability",
  "name": "Main Garage Last User",
  "state_topic": "garageDoors/mainGarage/state",
  "unique_id": "main_garage.user_id",
  "value_template": "{{ value_json.user_id}}",
  "icon": "mdi:account",
  "device": {
    "name": "JNetInc Garage Door System",
    "manufacturer": "JNetInc",
    "model": "GDS-001",
    "identifiers": "SN001",
    "sw_version": "0.9"
  }
}

Hi,

In your topic for the cover, there is a leading /.
Remove it and it will be ok.

Opps, that was just a mis-type on the post, there is no leading / in the actual code.

Also, I can see the config message in MQTT Explorer and seems to be in the same format as the sensor that works

So, I figured it out. In my garageDoors/mainGarage/state, I had put "position" : "closed", but in the homeassistant/cover/mainGarage/config, I had "state_closed" : "close" ← without the ending “d”. Apparently, that was enough to make it not show at all. Note to self: better proofreading of my code.