Help with multiple manually added mqtt entities

Hi everyone, earlier today i updated to the latest HA and my manually added MQTT enttites stopped working. I read the info where they have change how the yaml works for example an old mqtt switch would look like this

switch:
platform: mqtt
name: example
etc…

where now it needs to follow this

mqtt
switch:
name:

i have multiple mqtt switches and with the old way i would have

switch 1:
platform: mqtt
name: example
etc…

switch 2:
platform: mqtt
name: example
etc…

with the new way it won;t let me add multiple devices. I have tried

mqtt:
switch 1:
platform: mqtt
name: example
etc…

mqtt:
switch 2:
platform: mqtt
name: example
etc…

and also

mqtt 1:
switch:
name: example
etc…

mqtt 2:
switch:
name: example
etc…

in the file editor it says there are no errors but then HA won;t let me restart as there is something wrong. Can someone help me out. I just don’t know the correct way to add multiple mqtt devices manually so if someone could give me an example that would be great thank you.

you need to post the code you are trying to use properly formatted exactly as it is in your config.

the way you have it posted above no one can see any issues you may have.

…by editing your code and putting 3 backticks (```) before and after the code (or using </> in the toolbar, which does the same).

it is

mqtt:
  switch:
    name:
      etc
    name:
      etc...
  sensor:
    name:
      etc
    name:
       etc