actions:
- choose:
  - conditions:
    - condition: template
      value_template: '{{ diff | abs >= 0.1 }}

        '
    sequence:
    - action: number.set_value
      data:
        value: '{{ new_cal }}

          '
      target:
        entity_id: number.heaterlazienkatrv07_local_temperature_calibration
  default: []
alias: Set heaterLazienkaTRV07 temperature calibration for heater steering
conditions: []
description: ''
id: '1766345640142'
mode: single
triggers:
- seconds: /40
  trigger: time_pattern
variables:
  current_cal: '{% set current_correction = states(''number.heaterlazienkatrv07_local_temperature_calibration'') | float(0) %} {{ current_correction }}

    '
  diff: '{{ [1.5, [room_temp - trv_temp, -1.5] | max] | min }}

    '
  new_cal: '{% set raw = current_cal + diff %}

    {{ ([5, [raw, -5] | max] | min) | round(1) }}

    '
  room_temp: '{{ states(''sensor.thtuyalazienka_temperature'') | float(0) }}

    '
  trv_temp: '{{ state_attr(''climate.heaterlazienkatrv07'', ''current_temperature'') | float(0) }}

    '
