automatic import of Employee Checkin entries fails to save correct time and sets to NOW

Hi all
I have created a python script that takes clock in/out entries from a postgres database and saves them to the Employee Checkin doctype in ERPNext. Everything works fine, except the Time, it just sets it to the current time for everything it gets. In the log it shows that the correct time is received and passed to erpnext but when it gets saved the current time is added.

I have checked everything and cant figure out whats going on, anyone have any ideas?
Thank you

This is how I’m building the payload:

def build_payload(row: Tuple) → Dict[str, Any] | None:
(
rec_id,
employee_id,
event_type,
ts, # timezone-aware UTC datetime
site_id,
device_id,
project_code,
) = row

log_type = LOGTYPE_MAP.get(event_type.strip())
if log_type is None:
    logging.error("Unknown log_type %s for id=%s", event_type, rec_id)
    return None

# Convert to a string ERPNext can parse: “YYYY-MM-DD HH:MM:SS”
# Keep it in UTC to avoid double conversion later.
time_str = ts.astimezone(timezone.utc).strftime("%Y-%m-%d %H:%M:%S")

payload: Dict[str, Any] = {
    "employee":      employee_id,
    "log_type":      log_type,
    "time":          time_str,          
    "device_id":     device_id,
    "skip_auto_attendance": 0,          
}
if site_id:
    payload["location"] = site_id
if project_code:
    payload["project"] = project_code

logging.debug("Record %s → %s", rec_id, payload)
return payload

My log for an entry imported:

2025-05-18 16:27:06,129 [DEBUG] Starting new HTTP connection (1): 178.xxx.xxx.xxx:80
2025-05-18 16:27:06,166 [DEBUG] http://178.xxx.xxx.xxx:80 “POST /api/method/frappe.client.insert HTTP/1.1” 200 None
2025-05-18 16:27:06,168 [INFO] Synced id=17744 OK
2025-05-18 16:27:06,168 [DEBUG] ERPNext response: {“message”:{“name":“EMP-CKIN-05-2025-000089”,“owner”:"user@user.com”,“creation”:“2025-05-18 17:27:06.141304ce”,“modified”:“2025-05-18 17:27:06.141304",“modified_by”:"user@user.com”,“docstatus”:0,“idx”:0,“employee”:“EMP00026”,“employee_name”:“John Smith”,“log_type”:“IN”,“shift”:null,“custom_project”:null,“time”:“2025-05-18 17:27:06”,“device_id”:“device_002”,“skip_auto_attendance”:0,“attendance”:null,“latitude”:0.0,“longitude”:0.0,“geolocation”:null,“shift_start”:null,“shift_end”:null,“offshift”:1,“shift_actual_start”:null,“shift_actual_end”:null,“doctype”:“Employee Checkin”}}
2025-05-18 16:27:06,168 [DEBUG] Record 17745 → {‘employee’: ‘EMP00029’, ‘log_type’: ‘IN’, ‘time’: ‘2025-05-13 07:54:56’, ‘device_id’: ‘device_002’, ‘skip_auto_attendance’: 0, ‘project’: ‘00-001’}