How to create a topic @ MQTT-broker


I need a pointer.

I want to control Rpi from HA through MQTT.

I have a broker running on HA

And have the Paho-MQTT Library installed on my pi

I now want to make a “hello world” and I get stuck there.

The first step seems to create a MQTT topic within HA, but how do you do that?
Here in the config tab?

I assume not here in the developers tab (mainly for testing and debugging I assume)

Somewhere else in the HA GUI?

Via configuration in configuration.yaml?
And if yes, what is the most convenient way to do that: putty + nano, or …?

All your tips and suggestions are greatly appreciated.

Regards, Ko

You don’t need to create a topic. Topics are created automatically when you publish something to the topic.

what exactly do you want to do?

MQTT switch as one option

Ok, thanks.

To test, you can go to Developer Tools -> MQTT and in the Listen to a topic enter # and press start listening (this will listen to all topics). Now publish a message from another device to any topic you like and see if it shows anything. You can also check out this page for more info on MQTT testing

I am builidung a measurement and controller application for my aquarium with an Rpi that I can manage from HA.

For example, being able to give an order from the HA to the pi “start temperature measurement”.
And then get back a status and measurement value that I can further process in HA (storage in database, making images, etc.).

I build it up slowly.
First I want to send a meesage from HA via MQTT to the pi that starts a python script (I think via developers tools “publish a packet”?).
And then being able to send a message to HA from a python script and receive it there (I think through developers tools “listen to a topic”?).

Is this a good approach, or would you do it differently?

Thanks, your msg crossed mine :wink:

I’d use HA and some devices I can control from HA - like Wemos D1/Nodemcu flashed with ESPHome.