How to change from auto-discovery to explicit configuration


I’m trying to build a simple smart home based on HomeAssistant.
So far I got a bunch of Comet-DECT (fritzbox based) thermostats, and a bunch of Sonoff S20 switches with tasmota firmware.
The thermostats are auto-enumerated by the HomeAssistant “fritzbox” component, and the sonoffs are MQTT-discovery-enabled and discovered by HomeAssistant built in MQTT broker (as long as they are restarted after every restart of the hass service).

Now they all appear in the web-UI overview, can be nicely controlled, etc.
But I’d like to add simple automation rules for the thermostats, put the switches into groups - stuff that, if I understand correctly, requires the explicit names, attributes etc. of the gadgets.
I’d also like to have the MQTT switches explicitly listed, so I don’t have to rely on the auto discovery that requires the switches to be restarted every time the hass service restarts.

Now what’s the easiest way to obtain the syntax that I have to enter into the config.yaml in order to explicitly cover the gadgets that were discovered before?
I noticed that there is some info about the discovered devices in the .homeassistant/.storage/core.device_registry & entity_registry but it seems to be all over the place and in a different format than the config.yaml.


You can get the list right from the GUI. Click on the menu/hamburger button on left, and select the <> icon.

Then just manually create your sensors and switches. You don’t need to do anything in that case. Take the devices that are autodiscovered, put them in the appropriate sections of the config yaml. That’s it.

You don’t need to do anything to stop auto discovery

You mean the “states” view?
It gives me the info shown below, for one of the switches.
So what exactly do I have to enter into configuration.yaml to have this switch explicitly covered?
(Sorry if this a stupid question, but I’d be surprised if hass can set up this switch with the info “friendly_name” alone).

Look below at the “attributes” in the table

There’s also just the friendly_name
Am I missing something?

The name of the switch is Yours also happens to be the same as friendly name.

So I just add a line saying switch.schreibtisch to the configuration.yaml and then that switch will magically appear?

You add

  - platform: mqtt
    name: schreibtisch
    state_topic: "your mqtt topic for state"

Etc, etc

Just like the documentation tells you.

You should familiarize yourself with the documentation

1 Like

Yeah I was wondering if there was a way to derive the missing Etc, etc stuff from existing files, since that information must already be there from the auto-discovery. Seems that there isn’t and that stuff must be obtained using trial and error. But thanks anyway!

I’m not familiar with MQTT switches just yet but what additional info does it give you if you click this?


It brings info about that gadget on top of the page in a JSON field, in my case it was only the friendly_name

@sparkydave ah, no, sorry - that particular button triggers the same dialog that is shown in Configuration -> Integrations -> MQTT ->

It features a toggle button, the history and when I click on the cog on the top right it allows me to edit the name and entity ID.

Bummer. I wasn’t sure if maybe you would get some other info such as this example:

it’s not trial and error.

you will need to find the MQTT topics that the switch subscribes/publishes to and then follow the documentation that @flamingm0e pointed you to above.

you can find the topics by either using a MQTT sniffer (ex. MQTTFx) or by going to the tasmota site and learning about the topics to use from there.