Subscribe to an external MQTT server / topic and create a related MQTT sensor

Hi all,

I’m trying to subscribe to an external Mosquitto server / topic to add the topic values to an MQTT sensor in HA. Like the image shown, I can from MQTT explorer connect to this box and subscribe to the topic. When the box publish, I can see the values.

I’m already using MQTT sensors from Tasmota devices that were auto-discovered, by that “box”, is not auto-discovered and I cannot change it. Tasmota is connecting to my HA/MQTT and publish switch/sensor values.

What I need is HA to connect to an external MQTT server and subscribe to a topic and attach those values to a sensor in HA.

So, what are the steps to subscribe to an external MQTT server / topic.

I have read

I cannot, after reading forums for 3 hours and those pages, find how to do this!

Likewise, I must be missing some basic understanding!

Thanks for any pointers.

Hi,
i have also done this recently.
my steps:

  • install integration mqtt (MQTT - Home Assistant)
    • mqtt settings:
    • server: (here, i took the ip of my internal mqtt server)
    • port: (default 1883)
    • username: …
    • passwort: …
      go on … to set more options … (but not necessary)
  • to define my sensor, i modified my configuration.yaml
configuration.yaml:

# mqtt INSTAR IN-8015 Example configuration.yaml entry
mqtt:
  sensor:
    - name: "Alarm IN-8015FullHD Frontdoor"                         # name of sensor
      state_topic: "instar/10D1DC215F44/status/alarm/triggered"     # listen to topic
      payload_available: '{"val":"7"}'
      expire_after: 10

now i can get an alarm via mqtt message of my camera via HA
in my case, the sensor name was created automatically from my given name as sensor.alarm_in_8015fullhd_frontdoor

may be, there are other ways …
it is working here …

If I try to add another MQTT, I get a message that I already have one

So this would not work for me.

Thanks

ok.
i do not use the broker add on in HA and i only use 1 broker.

may be, this can help

It’s hard to believe that there’s not a simple solution to this.

Maybe I don’t understand the inner workings of HA enough.

I will try to modify the “box” to publish to the HA MQTT instead of making the sensors values only available through subscribe.

Thanks for the info on bridging MQTT, if I can publish the data, like any Tasmota devices, that will be simpler than adding a bridge.

1 Like

I know this is almost 2 years old, but it is also surreal to me that I can’t just click “Add Topic” and have it create devices with entities as a result of a topic automatically and have it understand json numbers to automatically create the measurement, classes, etc.

It is sorely needed to have a GUI to just do this.