#Is there a way to get all available MQTT topics?

1 messages · Page 1 of 1 (latest)

mellow flint
#

Hi everyone,
I have a bunch of MQTT climate devices and of course they also have command topics.
I would like to get those topics from HA and modify them so I can send commands with an automation.

I could not find anything in the frontend that would show me the MQTT topics that are used for commands, e.g. "temperature_command_topic": "cmnd/EQ3/001A2208B97D/settemp" or "mode_command_topic": "cmnd/EQ3/001A2208B97D/mode".
Essentially in this example I would like to extract cmnd/EQ3/001A2208B97D/so I can add a custom command.

Anybody know if this can be done, e.g. using a template?

Thank you
Alex

sterile pivot
#

You can see everything there.

mellow flint
#

Thank you @sterile pivot.

I already know the topics because I created the MQTT climate devices.
But I do not want to add them manually to the automation because I then need to update everytime I add another one.

I am trying to get this information within HA so I can use templates to create the automation publish topics 🙂

sterile pivot
#

Well they either have to drop in the right spot for Ha to find and auto-populate them, or you have to create sensors doe them in the randomp[laces they exist.
AFAIK that is the only 2 ways.

#

The auto ones you can look in in the individual integration type, but they are like...

  ha_topic: 'homeassistant/button/{{ dv_id }}'
  ha_select_topic: 'homeassistant/select/{{ dv_id }}'
#

for button and select for instance

#

Post stuff there, it populates in HA. (If you get the JSON right)

#

MQTT Explorer helps with the get it right part. If the JSON is right it shows in color, othersise its B/W

mellow flint
#

Thank you for your detailed explanations 🙂

I think we are maybe talking about two different issues.
I have created the entities and they are working fine, i.e. all syntax is working.

My issue is:
The climate devices I have created of course use a command topic to send specific commands to. That topic is known to me because I created the devices.
But where in HA can I read this topic from using e.g. a template?

I want to process these command topics without entering them manually for each device. Since HA uses them to communicate with the device, it obviously has them stored somewhere (in the json files in .core) but that information must somehow be available also to templates. But how?

lucid widget
#

It’s not available. What you could do is create a template sensor that stores the topics as attributes and then reference that. Should take no more than 5-10 minutes, some YAML and some copy and pasting.

sterile pivot
#

this I just communicated it poorly. You have to have the integration drop stuff into the right folder for auto, or you need to make the YAML for the entities yourself.

mellow flint
lucid widget
#

The latter. You create a template sensor and then add attributes for all the topics you need to store. Then you could use something like state_attr(‘sensor.topics’, ‘sensor_you_want_to_use’)