Do action on results of 2 sensors

I have 2 sensors - temperature and pulse counter (I control temperature and water flow in water cool system for CNC spindel). I need something like this:
IF temperature is defined range AND pulse counter > predefined value THEN set GPIOXX to 1, ELSE set GPIOxx to 0

sensor:
  - platform: pulse_counter
    pin: GPIO21
    name: "Pulse Counter"
    update_interval: 5s
    id: pump_speed

    on_value:      
      if:
        condition:
          sensor.in_range:
            id: pump_speed
            above: 0
            below: 30            
        then:
        - switch.turn_on: PUMP_ERR
        - switch.turn_off: PUMP_OK
        else:
        - switch.turn_on: PUMP_OK
        - switch.turn_off: PUMP_ERR

  - platform: ntc
    sensor: resistance_sensor
    id: ntc_sensor
    calibration:
      - 10.0kOhm -> 25°C
      - 950Ohm -> 100°C
      - 21.2kOhm -> 12°C
    name: NTC Temperature

  # Example source sensors:
  - platform: resistance
    id: resistance_sensor
    sensor: source_sensor
    configuration: DOWNSTREAM
    resistor: 10kOhm
    name: Resistance Sensor
  - platform: adc
    id: source_sensor
    attenuation: 11db
    pin: GPIO34
    update_interval: never
    
    on_value:      
      if:
        condition:
          sensor.in_range:
            id: ntc_sensor
            above: 0
            below: 60
        then:
        - switch.turn_on: Temp_OK
        - switch.turn_off: Temp_ERR
        else:
        - switch.turn_on: Temp_ERR
        - switch.turn_off: Temp_OK

#Automations
on_value_range:
   if:
    condition:
      and:
        sensor.in_range
          id: pump_speed
          above: 0
          below: 30            
        sensor.in_range
          id: ntc_sensor
          above: 0
          below: 60
    then:
      - switch.turn_on: ALL_OK
    else:
      - switch.turn_off: ALL_OK
      
switch:
  - platform: gpio
    pin: GPIO19
    id: ntc_vcc
    
  - platform: gpio
    pin: GPIO26
    id: Temp_OK
    name: "Temp_OK"

  - platform: gpio
    pin: GPIO17
    id: Temp_ERR
    name: "Temp_Error"
    
  - platform: gpio
    pin: GPIO16
    id: PUMP_OK
    name: "Pump_OK"

  - platform: gpio
    pin: GPIO15
    id: PUMP_ERR    
    name: "Pump_error"
    
  - platform: gpio
    pin: GPIO23
    id: ALL_OK    
    name: "ALL_OK"
    
  - platform: gpio
    pin: GPIO18
    id: FUN1    
    name: "FUN1_ON"
    
  - platform: gpio
    pin: GPIO22
    id: FUN2    
    name: "FUN2_ON"
    
interval:
  - interval: 30s
    then:
      - switch.turn_on: ntc_vcc
      - component.update: source_sensor
      - switch.turn_off: ntc_vcc

I get such error

INFO Reading configuration /config/esphome/esp.yaml...
ERROR Error while reading config: Invalid YAML syntax. Please see YAML syntax reference or use an online YAML syntax validator:

mapping values are not allowed here
  in "/config/esphome/esp.yaml", line 95, column 13:
              id: pump_speed
    - switch.turn_on: PUMP_ERR
    - switch.turn_off: PUMP_OK

these need to be indented, so do the else items, have a look at the docs for YAML formatting examples. The indenting is critical!

Make indent, same error. Line 95 is here:

#Automations
on_value_range:
   if:
    condition:
      and:
        sensor.in_range
          id: pump_speed  #line 95

unfortunately the example given in the “sensor.in_range” has a bit of an error, the “if” needs a minus sign, try this:

sensor:
  - platform: pulse_counter
    pin: GPIO21
    name: "Pulse Counter"
    update_interval: 5s
    id: pump_speed

    on_value:      
      - if:
        condition:
          sensor.in_range:
            id: pump_speed
            above: 0
            below: 30            
        then:
          - switch.turn_on: PUMP_ERR
          - switch.turn_off: PUMP_OK
        else:
          - switch.turn_on: PUMP_OK
          - switch.turn_off: PUMP_ERR

In sensor part it work fine (if I delete automations part I validate fine). I add “-”, same error.