How to replace yaml with lambda? Help please

Friends, help me figure it out. I am not a programmer, so it is difficult to use lambda.
I need to create a stand-alone fan control module depending on the humidity sensor.

But it is also important that the on and off levels can be changed from the HA.

For this, I have used global variables, services and sensors for HA from various sources. But the automation itself does not work (How can the numbers (60, 90 )in this code be replaced with global variables? Or how can the automation itself be replaced with lambda?

  - id: min_${device_name}
    restore_value: true
    initial_value: '70'
    type: int
  - id: max_${device_name}
    type: int
    restore_value: true
    initial_value: '90'
  - platform: dht
    pin: 00
    model: AM2302
      name: "Bathroom Temperature"
      name: "Humidity ${device_name}"
      id: hum_${device_name}
        - above: 90.0
            - switch.turn_on: dehumidifier1
        - below: 70.0
            - switch.turn_off: dehumidifier1