MQTT good practice for topics. Arduino ESP MQTT set/get examples needed

Hi,

I finally know how the MQTT devices work. Normally I use this topic setup:
*First my name or company name
*Unique device name. for instance “ESP32_ABCDEF”. ABCDEF is unique ID of ESP in hex.
*As last the functions of the device. for instance “IO0/set”
so my full topic would be “Name/ESP32_ABCDEF/IO0/set”
Is this the right way to make unique devices? Using this topic setup?

How about he set and get function in home assistant?
this is an example of the internet…

switch:
  - platform: mqtt # Again, it's an MQTT device
    name: "LED Switch 1" # Choose an easy-to-recognize name
    state_topic: "home/office/led/get" # Topic to read the current state
    command_topic: "home/office/led/set" # Topic to publish commands
    qos: 1
    payload_on: 0 # or "on", depending on your MQTT device
    payload_off: 1 # or "off", depending on your MQTT device
    retain: true # or false if you want to wait for changes

how does this work? Must I subscribe only to the set function and publish the get function in the arduino callback set procedure? So if the set is “on” or “1”, I will publish “get” with “1” in the set callback function?
Why is there a get and a set? why don’t they use the same mqtt topic at both state_topic and command_topic (just led topic for instance for both without set or get)?
Arduino MQTT beginner code would be helpful. With this get and set function fully implemented.
I also want a button to enable lights in my home. Any Arduino ESP pushbutton examples would be helpful. So if I push the button a light will go on and if I push the button again the light will go out. I will use a pushbutton and a LED that are both connected to the ESP at first.
So I have to figure out the set and get configuration of a mqtt device and how I can get the input signals from an external mqqt device (to switch something). Just publish the button state (Topic Name/ESP32_ABCDEF/Button1, Message button state “0” or “1”)? How do I configure that MQTT pushbutton input in the configuration.yaml? Can home assistant toggle a setting each time the button gets pushed? How about a double click? Configure that in Home assistant or the ESP?
Sorry for these beginner questions. Just have to find my way of handling this the correct way.
Thanks for your reply.

Kind regards,
Erik

Having a separate command and state topic makes it a lot easier to determine what the state of the device is. You don’t have to reject all the command messages with a value template.