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.
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 …
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.