Help needed for retrieving mqtt value

Then there should be no need for you to configure an MQTT Sensor in YAML. Zigbee2MQTT has already created climate entities containing the information you want.

There’s no need to read that value directly from an MQTT topic because Zigbee2MQTT has already created a climate entity containing it. A climate entity’s state value is the operating mode (heat, cool, auto, etc) so it has what you want.

Go to Developer tools → States and find your climate entities in the displayed list. Let’s say one of them is climate.thermostat_salon. Find it in the list and click it. All of it’s available properties will be displayed at the top of the list.

You can read an entity’s state value with a template. For example, copy-paste the following template into the Template Editor (Developer tools → Template):

{{ states('climate.thermostat_salon') }}