Report the temperature with ESP8266 to MQTT

where ( which file or config ) to put
sensor:
platform: mqtt
name: “Temperature”
state_topic: “sensor/temperature”
qos: 0
unit_of_measurement: “ºC”

configuration.yaml of course.

I am still fairly new to MQTT. Can someone confirm for me how I would use this sketch if I wanted to connect with multiple ESP MCUs?

Would I just replace ESP8266Client with a unique name for each unit in
if (client.connect("ESP8266Client", mqtt_user, mqtt_password))

Thanks!