Tasmota integration retain option

Hi
By configuring a tasmota device manually in a yaml file, I have the possibility to use the option “retain: true” or “retain: false”.
Using the Tasmota integration, after discovering the device, how do I configure the retain option?

Have you inspected the broker to see if the state messages are already have the retained flag set?

Only the state messages.

You do not want to retain the command messages. This will cause all sorts of weird ghost switching.

Forgive me, but I did not understand your explanation.
I currently have all Tasmota devices manually configured in yaml files. Instead of switching to the new MQTT configuration format, I was considering whether to use Tasmota integration.
Having said that, I have some switches that need the retain on and others that need the retain off.
I would therefore like to know if I can also report this configuration using the Tasmota integration.
Example:

    - state_topic: "stat/SO_CH4PROR3_Luci_out/POWER4"
      name: "Luce_davanti_giardino_4"
      command_topic: "cmnd/SO_CH4PROR3_Luci_out/POWER4"
      qos: 0
      payload_on: "ON"
      payload_off: "OFF"
      optimistic: false
      retain: true   

    - state_topic: "stat/SO_CH4PROR3_Irrigazione/POWER4"
      name: "Irrigazione_elettrovalvola_4"
      command_topic: "cmnd/SO_CH4PROR3_Irrigazione/POWER4"
      qos: 0
      payload_on: "ON"
      payload_off: "OFF"
      optimistic: false
      retain: false   

This topic should be retained:

This should not:

Download MQTT Explorer, connect to to your mqtt broker and look to see if the state topic has retained messages when you use the Tasmota integration. It may already be done for you.

To see if a topic is retained look for this: