MQTT switch : which yaml?

Does it matter which yaml the switch is defined in? if in the esp node yaml or the HA configuration yaml?

You define the switch in ESPHome using yaml.

You bring that switch into home assistant by defining an mqtt switch in yaml.

Or better yet, forget mqtt altogether and use ESPHome’s api. The switch will then be automatically discovered in home assistant.

how do you do that?

Delete

mqtt:
...

And add

api:
  password: YOUR_PASSWORD

thanks you’ve been very responsive and helpful

1 Like