from pyModbusTCP.client import ModbusClient

async def create_modbus_tcp_client(host, port, unit_id, timeout=10):
    """
    Create and return a Modbus TCP client.
    
    :param host: Modbus server IP.
    :param port: Modbus server port.
    :param unit_id: Modbus device unit ID.
    :param timeout: Connection timeout in seconds.
    :return: ModbusClient instance if successful, None otherwise.
    """
    client = ModbusClient(host=host, port=port, auto_open=True, unit_id=unit_id, timeout=timeout)
    if client.open():
        print(f"Connected to Modbus device {unit_id} at {host}:{port}")
        return client
    else:
        print(f"Failed to connect to Modbus device {unit_id} at {host}:{port}")
        return None

