ESPHome - Help Referring a Variable as a Condition Value

Hi,
I am trying to refer a variable as a “reference value” for a condition. Example:

switch:
  - platform: gpio
    name: "Rele_Calefacción"
    pin: GPIO12
    id: rele_calefaccion
    restore_mode: RESTORE_DEFAULT_OFF
    internal: false

globals: # I also tried with number

  - id: valor_temp_arranque_calentador
    type: float
    restore_value: yes
    initial_value: '3'  # 0..100


sensor:
  - platform: sht4x
    temperature:
      name: "Temperatura Invernadero"
      id: temp_inv
      on_value_range:
        - above: 4
          then:
            - switch.turn_off:
                id: rele_calefaccion
        - below: 3
          then:
            - switch.turn_on: 
                id: rele_calefaccion

  - platform: homeassistant
    entity_id: input_number.inv_temp_arranque_calentador
    id: temp_arranque_calentador
    internal: true
    accuracy_decimals: 1
    on_value:
      then:
        - lambda: |-
            id(valor_temp_arranque_calentador) = x;

What I want to do is to use the HA variable “input_number.inv_temp_arranque_calentador” to state the temperature when “Rele_Calefacción” start or stop.

It is, change:

 on_value_range:
        - above: 4

by:

 on_value_range:
        - above: id(valor_temp_arranque_calentador).status

or something like this.

In that way I would change from HA the temperature where the relay start.
Is it possible??
Thank you in advance

Someone have any idea?