Generic thermostat - Switch on, not switch off

Trying to run a generic thermostat. The Mqtt switch goes ‘ON’ when set temperature in higher than actual temperature. Then, setting temperature lower than actual temperature, the Mqtt switch remain on (no change, no Mqtt messages).
This my configuration:

climate:
  - platform: generic_thermostat
    name: Piano terra
    heater: switch.termostato_piano_terra
    target_sensor: sensor.temperatura_piano_terra
    min_temp: 10
    max_temp: 25
    ac_mode: False
    initial_operation_mode: "off"

switch 5:
  - platform: mqtt
    name: "termostato piano terra"
    state_topic: "switch/relay_termostato_piano_inferiore/state"
    command_topic: "switch/relay_termostato_piano_inferiore/switch"
    payload_on: "1"
    payload_off: "2"
    state_on: "ON"
    optimistic: false
    qos: 0
    retain: true

Thank you.
Fabio

You are describing the switch turning on when the sensor temperature is higher than the set point. This sounds like you are using it for AC but you have AC mode set to false?

BlockquoteYou are describing the switch turning on when the sensor temperature is higher than the set point. This sounds like you are using it for AC but you have AC mode set to false?

No exactly the opposite, the switch turno on when the setpoint is higher respect the sensor temperture. Also, I
already test whit ac_mode = true.

The problem still remain the same, the system swith only on or off, depending on the ac_mode, but never goes in the opposite.

Ok, solved.
My switch was not sending the state command.