It appears your Hyundai Sonata has had its Emission Monitors erased. This is common when replacing or charging a dead battery. The fix requires driving your Hyundai Sonata through a drive cycle. A drive cycle is a series of driving patterns which allow your vehicle'e engine control unit to perform various emission tests, referred to as Emission Monitors. In order for your Sonata to pass the smog check these monitors must show Ready or Complete.
The following is a description of the Hyundai Sonata Drive Cycle. Prior to beginning the drive cycle ensure your Sonata has at least 1/4 to 3/4 tank of gas. An empty or full gas tank will not allow the EVAP monitor to run. Also begin the drive cycle from a cold start; best achieved by leaving your vehicle sitting overnight.
Hyundai Sonata Drive Cycle
STEP 1:
• Make sure check engine light is not on and that there are no stored trouble codes in the computer. Use a scan tool to check for OBD II trouble codes. Any faults founds need to be repaired first.
• Start the engine. Keep the vehicle in Park.
• Idle the engine for 1 1/2 minutes.
STEP 2: (Steady State Driving - Part 1)
• Accelerate within 15 seconds to 50-55 mph (using 1/4 to 3/4 throttle) and keep this speed steady for 2 to 3 minutes.
• Decelerate to 0 mph without braking.
• Idle engine then idle in Drive for 1 to 2 minutes.
STEP 3: (Steady State Driving - Part 2)
• Accelerate within 15 seconds to 50-55 mph (using 1/4 to 3/4 throttle) and keep this speed steady for 10 to 20 minutes.
• Decelerate to 0 mph without braking.
• Idle engine then idle in Drive for 1 to 2 minutes.
STEP 4: (Engine Stop)
• The drive cycle is completed.
• Turn off the engine (key in the OFF position).
If all other emissions systems are functioning properly, completing the drive cycle above should set or make ready (complete) your Hyundai Sonata's emission monitors. If the emission monitors are still not complete then check for any trouble codes and whether the check engine light is on or not. If faults are found make the appropriate repairs and conduct the drive cycle twice again. Take extreme caution when performing drive cycles on public roadways. Perform the procedure at your own risk.