MQTT HomeAssistant and AutoDiscovery

I am trying to figure out how to setup the MQTT HomeAssistant AutoDiscovery on OpenHab. I have the MQTT broker connected to Mosquitto which HomeAssistant is also connected to.

In HomeAssistant I have something similar to the following setup to publish to MQTT.

  • id: ‘1590942737754’
    alias: MQTT-Switch-Office-On
    description: ‘’
    trigger:
    • entity_id: light.act_unknown_type_4457_id_3230_level
      platform: state
      to: ‘on’
      condition: []
      action:
    • data:
      payload: ‘on’
      topic: homeassistant/switch/office/state
      service: mqtt.publish
  • id: ‘1590949077643’
    alias: MQTT-Switch-Office-Off
    description: ‘’
    trigger:
    • entity_id: light.act_unknown_type_4457_id_3230_level
      platform: state
      to: ‘off’
      condition: []
      action:
    • data:
      payload: ‘off’
      topic: homeassistant/switch/office/state
      service: mqtt.publish

However, I am unsure how to get these devices to show up with autodiscovery on OpenHab. Besides connecting the MQTT Broker is there something else needed?

Appreciate the help.

Were the devices auto discovered in home assistant? If so they should be in your inbox.

For example on tasmota when I set option 19 to 1(turn on home assistant broadcast) the light appears in both home assistant and openHAB.

I’ve no experience with MqTT auto discovered Things, but if they do not show up in the Inbox automatically, you may need to initiate a scan. Go to the Inbox, click the + icon at the top -> “Search for Things” -> MQTT. That should initiate a scan for MQTT Homie and Home Assistant devices.

But keep in mind, these are looking for a series of topics that follow a given standard that represents a device. This does not look for HomeAssistant instances and somehow figures out what topics it publishes to. See https://www.home-assistant.io/docs/mqtt/discovery/ for details.

Given you are just publishing some stuff to random topics and not following the HomeAssistant device standard, you will probably need to generate a Generic MQTT Thing and manually configure it to subscribe and publish to the topics.

1 Like

The devices were not autodiscovered in Homeassistant I am actually manually publishing the device states to topic homeassistant/switch/office/state. I was trying to figure out what was needed on the openhab from a topic standpoint. All I saw was the openhab subscribing to topic homeassistant/# so I was hoping it would find the devices automatically. :slight_smile: I also tried to do a refresh/search but alas nothing came back. I looked at the article sent but wasn’t able to fully discerned what topic had to be sent for the autodiscovered magic to happen so that I could tailor the topic on the homeassistant side.

Appreciate the help.

If you manually configured in home assistant then you will most likely need to manually setup in openHAB. The topics are the same to subscribe.

The HA MQTT Auto discover is for IOT devices that use the HA MQTT standard. I don’t know if HA actually published devices this way.

Ok, thanks