Adaptive heating

Hello. Need help.
I have:

  • Thermostat: climate.thermostat_room
  • Temperature sensor: sensor.mi_climate_room_temperature

I need to make adaptive heating, increase and decrease of temperature depending on the set value.
I wrote a part of the configuration, but it looks like there is an error and it does not work.

input_number:
    thermostats_adaptive:
        name: Температура
        icon: mdi:thermometer-lines
        initial: 25
        min: 20
        max: 27
        step: 0.5

input_boolean:
  thermostats_adaptive:
    name: Адаптивное управление
    icon: mdi:home-thermometer-outline

automation:
  - alias: Термостаты. Адаптивное управление.
    trigger:
      platform: numeric_state
      entity_id: sensor.mi_climate_room_temperature
      above: 27
      below: 20
    condition:
      condition: state
      entity_id: input_boolean.thermostats_adaptive
      state: 'on'
    action:
      service: climate.set_temperature
      entity_id: climate.thermostat_room
      data_template:
        temperature: >
            {% if states.sensor.mi_climate_room_temperature.state | int < states("input_number.thermostats_adaptive") %}
              {{ states.climate.thermostat_room.temperature|int + 1 }}
            {% else %}
              off
            {% endif %}

The code looks ok.
What kind of a device are you using for a climate entity?
Chances are there’s already a thermostat in there and it is doing what it is supposed to do and ruining your automation.